feat: refactorResponse Paletizado refs #7827
This commit is contained in:
parent
e18125420b
commit
5b8c089734
|
@ -3,7 +3,7 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.lifecycle.Observer
|
import androidx.core.content.res.ResourcesCompat
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentExpeditionPalletDetailBinding
|
import es.verdnatura.databinding.FragmentExpeditionPalletDetailBinding
|
||||||
|
@ -19,8 +19,6 @@ import es.verdnatura.presentation.view.feature.paletizador.adapter.ExpeditionPal
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO
|
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
|
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletViewListVO
|
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletViewListVO
|
||||||
import java.text.SimpleDateFormat
|
|
||||||
import java.util.Calendar
|
|
||||||
|
|
||||||
class ExpeditionPalletDetailFragment(
|
class ExpeditionPalletDetailFragment(
|
||||||
var itemExpeditionTruckVO: ItemExpeditionTruckVO? = null,
|
var itemExpeditionTruckVO: ItemExpeditionTruckVO? = null,
|
||||||
|
@ -46,6 +44,7 @@ class ExpeditionPalletDetailFragment(
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_expedition_pallet_detail
|
override fun getLayoutId(): Int = R.layout.fragment_expedition_pallet_detail
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
|
println("ExpeditionPalletDetail")
|
||||||
customDialog = CustomDialog(requireContext())
|
customDialog = CustomDialog(requireContext())
|
||||||
binding.expeditionPalletDetailPallet.text =
|
binding.expeditionPalletDetailPallet.text =
|
||||||
buildString {
|
buildString {
|
||||||
|
@ -59,12 +58,7 @@ class ExpeditionPalletDetailFragment(
|
||||||
append(itemExpeditionTruckVO!!.eta)
|
append(itemExpeditionTruckVO!!.eta)
|
||||||
append(" ")
|
append(" ")
|
||||||
append(
|
append(
|
||||||
if (itemExpeditionTruckVO!!.Destino.isNullOrEmpty()) {
|
itemExpeditionTruckVO!!.description
|
||||||
|
|
||||||
itemExpeditionTruckVO!!.description
|
|
||||||
} else {
|
|
||||||
itemExpeditionTruckVO!!.Destino
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,13 +84,14 @@ class ExpeditionPalletDetailFragment(
|
||||||
private fun setToolBar() {
|
private fun setToolBar() {
|
||||||
val listIcons: ArrayList<Drawable> = ArrayList()
|
val listIcons: ArrayList<Drawable> = ArrayList()
|
||||||
val iconReload: Drawable =
|
val iconReload: Drawable =
|
||||||
resources.getDrawable(R.drawable.ic_autorenew_black_24dp, resources.newTheme())
|
ResourcesCompat.getDrawable(resources, R.drawable.ic_autorenew_black_24dp, null)!!
|
||||||
val iconEditar: Drawable =
|
val iconEditar: Drawable =
|
||||||
resources.getDrawable(R.drawable.ic_mode_edit_black_24dp, resources.newTheme())
|
ResourcesCompat.getDrawable(resources, R.drawable.ic_mode_edit_black_24dp, null)!!
|
||||||
val iconBorrar: Drawable =
|
val iconBorrar: Drawable =
|
||||||
resources.getDrawable(R.drawable.ic_delete_forever_black_24dp, resources.newTheme())
|
ResourcesCompat.getDrawable(resources, R.drawable.ic_delete_forever_black_24dp, null)!!
|
||||||
val iconPrint: Drawable =
|
val iconPrint: Drawable =
|
||||||
resources.getDrawable(R.drawable.ic_print_black_24dp, resources.newTheme())
|
ResourcesCompat.getDrawable(resources, R.drawable.ic_print_black_24dp, null)!!
|
||||||
|
|
||||||
listIcons.add(iconEditar)
|
listIcons.add(iconEditar)
|
||||||
listIcons.add(iconBorrar)
|
listIcons.add(iconBorrar)
|
||||||
listIcons.add(iconPrint)
|
listIcons.add(iconPrint)
|
||||||
|
@ -130,7 +125,9 @@ class ExpeditionPalletDetailFragment(
|
||||||
} else if (item == iconPrint) {
|
} else if (item == iconPrint) {
|
||||||
|
|
||||||
if (ma.havePrinter() && ma.haveSector()) {
|
if (ma.havePrinter() && ma.haveSector()) {
|
||||||
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(PRINTERNAME)).toast(
|
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
||||||
|
PRINTERNAME
|
||||||
|
)).toast(
|
||||||
requireContext()
|
requireContext()
|
||||||
)
|
)
|
||||||
viewModel.expeditionPalletPrintSet(
|
viewModel.expeditionPalletPrintSet(
|
||||||
|
@ -152,40 +149,22 @@ class ExpeditionPalletDetailFragment(
|
||||||
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getCURDATE(date: String): String {
|
|
||||||
val c = Calendar.getInstance()
|
|
||||||
val df = SimpleDateFormat(getString(R.string.dateCompleteFormat))
|
|
||||||
val df2 = SimpleDateFormat(getString(R.string.timeFormat))
|
|
||||||
c.time = df.parse(date)!!
|
|
||||||
return df2.format(c.time)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
loadExpeditionPalletList.observe(viewLifecycleOwner, Observer { event ->
|
loadExpeditionPalletList.observe(viewLifecycleOwner) { event ->
|
||||||
event.getContentIfNotHandled().notNull { printExpeditionList(it) }
|
event.getContentIfNotHandled().notNull { printExpeditionList(it) }
|
||||||
})
|
}
|
||||||
|
|
||||||
response.observe(viewLifecycleOwner, Observer {
|
response.observe(viewLifecycleOwner) {
|
||||||
if (it.isError) {
|
ma.openFragmentTruckFragment()
|
||||||
ma.messageWithSound(it.errorMessage, true, false)
|
}
|
||||||
} else {
|
|
||||||
ma.openFragmentTruckFragment()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
responsePrintPallet.observe(viewLifecycleOwner, Observer {
|
responsePrintPallet.observe(viewLifecycleOwner) {
|
||||||
if (it.isError) {
|
viewModel.expeditionStateAddByPallet(
|
||||||
ma.messageWithSound(it.errorMessage, true, true, isToasted = false)
|
itemPallet!!.Pallet,
|
||||||
|
"PALLETIZED"
|
||||||
} else {
|
)
|
||||||
viewModel.expeditionStateAddByPallet(
|
}
|
||||||
itemPallet!!.Pallet,
|
|
||||||
"PALLETIZED"
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,7 @@ import androidx.lifecycle.map
|
||||||
import es.verdnatura.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.domain.formatWithQuotes
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
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.Event
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletViewListVO
|
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletViewListVO
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletViewVO
|
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletViewVO
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
@ -18,72 +15,31 @@ import retrofit2.Response
|
||||||
class ExpeditionPalletDetailViewModel(var context: Context) : BaseViewModel(context) {
|
class ExpeditionPalletDetailViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
private val _expeditionPalletList by lazy { MutableLiveData<ItemPalletViewListVO>() }
|
private val _expeditionPalletList by lazy { MutableLiveData<ItemPalletViewListVO>() }
|
||||||
val loadExpeditionPalletList: LiveData<Event<ItemPalletViewListVO>> = _expeditionPalletList.map { Event(it) }
|
val loadExpeditionPalletList: LiveData<Event<ItemPalletViewListVO>> =
|
||||||
|
_expeditionPalletList.map { Event(it) }
|
||||||
|
|
||||||
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _response by lazy { MutableLiveData<Boolean>() }
|
||||||
val response: LiveData<ResponseItemVO>
|
val response: LiveData<Boolean>
|
||||||
get() = _response
|
get() = _response
|
||||||
|
|
||||||
private val _responsePrintPallet by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _responsePrintPallet by lazy { MutableLiveData<Boolean>() }
|
||||||
val responsePrintPallet: LiveData<ResponseItemVO>
|
val responsePrintPallet: LiveData<Boolean>
|
||||||
get() = _responsePrintPallet
|
get() = _responsePrintPallet
|
||||||
|
|
||||||
fun expeditionPalletView(vPalletFk: Int) {
|
fun expeditionPalletView(vPalletFk: Int) {
|
||||||
salix.expeditionPalletView(arrayListOf(vPalletFk))
|
salix.expeditionPalletView(arrayListOf(vPalletFk))
|
||||||
.enqueue(object :
|
.enqueue(object : SalixCallback<List<ItemPalletViewVO>>(context) {
|
||||||
SalixCallback<List<ItemPalletViewVO>>(context) {
|
|
||||||
override fun onSuccess(response: Response<List<ItemPalletViewVO>>) {
|
override fun onSuccess(response: Response<List<ItemPalletViewVO>>) {
|
||||||
if (response.body() != null) {
|
_expeditionPalletList.value = response.body()?.let { ItemPalletViewListVO(it) }
|
||||||
_expeditionPalletList.value =
|
|
||||||
response.body()?.let { ItemPalletViewListVO(it) }
|
|
||||||
} else {
|
|
||||||
val listError: ArrayList<ItemPalletViewVO> = ArrayList()
|
|
||||||
listError.add(
|
|
||||||
ItemPalletViewVO(
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
_expeditionPalletList.value = ItemPalletViewListVO(listError)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onError(t: Throwable) {
|
|
||||||
val listError: ArrayList<ItemPalletViewVO> = ArrayList()
|
|
||||||
listError.add(
|
|
||||||
ItemPalletViewVO(
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
t.message!!
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
_expeditionPalletList.value = ItemPalletViewListVO(listError)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun expeditionPalletDel(vPalletFk: Int) {
|
fun expeditionPalletDel(vPalletFk: Int) {
|
||||||
salix.expeditionPalletDel(vPalletFk).enqueue(object : SalixCallback<Any>(context) {
|
salix.expeditionPalletDel(vPalletFk).enqueue(object : SalixCallback<Any>(context) {
|
||||||
override fun onError(t: Throwable) {
|
|
||||||
_response.value = ResponseItemVO(
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSuccess(response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
_response.value = ResponseItemVO(
|
_response.value = true
|
||||||
isError = false,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -94,16 +50,9 @@ class ExpeditionPalletDetailViewModel(var context: Context) : BaseViewModel(cont
|
||||||
salix.expeditionPalletPrintLabel(arrayListOf(vPalletFk))
|
salix.expeditionPalletPrintLabel(arrayListOf(vPalletFk))
|
||||||
.enqueue(object : SalixCallback<Any>(context) {
|
.enqueue(object : SalixCallback<Any>(context) {
|
||||||
override fun onSuccess(response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
_responsePrintPallet.value =
|
_responsePrintPallet.value = true
|
||||||
ResponseItemVO(isError = false, response = response.message())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onError(t: Throwable) {
|
|
||||||
_responsePrintPallet.value = ResponseItemVO(
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,19 +62,12 @@ class ExpeditionPalletDetailViewModel(var context: Context) : BaseViewModel(cont
|
||||||
) {
|
) {
|
||||||
salix.expeditionStateAddByPallet(
|
salix.expeditionStateAddByPallet(
|
||||||
arrayListOf(vPalletFk, vStateCode).formatWithQuotes()
|
arrayListOf(vPalletFk, vStateCode).formatWithQuotes()
|
||||||
)
|
).enqueue(object : SalixCallback<Unit>(context) {
|
||||||
.enqueue(object : SalixCallback<Unit>(context) {
|
override fun onSuccess(response: Response<Unit>) {
|
||||||
override fun onSuccess(response: Response<Unit>) {
|
_response.value = true
|
||||||
_response.value = ResponseItemVO(isError = false, response = response.message())
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override fun onError(t: Throwable) {
|
})
|
||||||
_response.value = ResponseItemVO(
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -6,7 +6,7 @@ import android.media.MediaPlayer
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import androidx.lifecycle.Observer
|
import androidx.core.content.res.ResourcesCompat
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentExpeditionPalletBinding
|
import es.verdnatura.databinding.FragmentExpeditionPalletBinding
|
||||||
|
@ -27,14 +27,12 @@ import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionT
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletListVO
|
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletListVO
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
|
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemScanList
|
import es.verdnatura.presentation.view.feature.paletizador.model.ItemScanList
|
||||||
import java.text.SimpleDateFormat
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||||
class ExpeditionPalletFragment(
|
class ExpeditionPalletFragment(
|
||||||
var itemExpeditionTruckVO: ItemExpeditionTruckVO? = null
|
var itemExpeditionTruckVO: ItemExpeditionTruckVO? = null
|
||||||
) : BaseFragment<FragmentExpeditionPalletBinding, ExpeditionPalletViewModel>(
|
) : BaseFragment<FragmentExpeditionPalletBinding, ExpeditionScanViewModel>(
|
||||||
ExpeditionPalletViewModel::class
|
ExpeditionScanViewModel::class
|
||||||
) {
|
) {
|
||||||
|
|
||||||
private var adapter: ExpeditionPalletAdapter? = null
|
private var adapter: ExpeditionPalletAdapter? = null
|
||||||
|
@ -61,6 +59,7 @@ class ExpeditionPalletFragment(
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_expedition_pallet
|
override fun getLayoutId(): Int = R.layout.fragment_expedition_pallet
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
println("ExpeditionPalletFragment")
|
||||||
mperror = MediaPlayer.create((activity as MainActivity), R.raw.error)
|
mperror = MediaPlayer.create((activity as MainActivity), R.raw.error)
|
||||||
mpok = MediaPlayer.create((activity as MainActivity), R.raw.ok)
|
mpok = MediaPlayer.create((activity as MainActivity), R.raw.ok)
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
@ -70,12 +69,11 @@ class ExpeditionPalletFragment(
|
||||||
customDialog = CustomDialog(requireContext())
|
customDialog = CustomDialog(requireContext())
|
||||||
customDialogList = CustomDialogList(requireContext())
|
customDialogList = CustomDialogList(requireContext())
|
||||||
ma.hideBottomNavigation(View.GONE)
|
ma.hideBottomNavigation(View.GONE)
|
||||||
binding.mainToolbar.toolbarTitle.text =
|
binding.mainToolbar.toolbarTitle.text = getString(
|
||||||
itemExpeditionTruckVO!!.eta + " " + if (itemExpeditionTruckVO!!.Destino.isNullOrBlank()) {
|
R.string.expeditionInfo,
|
||||||
itemExpeditionTruckVO!!.description
|
itemExpeditionTruckVO!!.eta,
|
||||||
} else {
|
itemExpeditionTruckVO!!.description
|
||||||
itemExpeditionTruckVO!!.Destino
|
)
|
||||||
}
|
|
||||||
setToolBar()
|
setToolBar()
|
||||||
setEvents()
|
setEvents()
|
||||||
viewModel.expeditionPalletList(
|
viewModel.expeditionPalletList(
|
||||||
|
@ -95,9 +93,9 @@ class ExpeditionPalletFragment(
|
||||||
private fun setToolBar() {
|
private fun setToolBar() {
|
||||||
val listIcons: ArrayList<Drawable> = ArrayList()
|
val listIcons: ArrayList<Drawable> = ArrayList()
|
||||||
val iconReload: Drawable =
|
val iconReload: Drawable =
|
||||||
resources.getDrawable(R.drawable.ic_autorenew_black_24dp, resources.newTheme())
|
ResourcesCompat.getDrawable(resources, R.drawable.ic_autorenew_black_24dp, null)!!
|
||||||
val iconPlus: Drawable =
|
val iconPlus: Drawable =
|
||||||
resources.getDrawable(R.drawable.ic_add_black_24dp, resources.newTheme())
|
ResourcesCompat.getDrawable(resources, R.drawable.ic_add_black_24dp, null)!!
|
||||||
listIcons.add(iconReload)
|
listIcons.add(iconReload)
|
||||||
listIcons.add(iconPlus)
|
listIcons.add(iconPlus)
|
||||||
binding.mainToolbar.toolbarIcons.adapter =
|
binding.mainToolbar.toolbarIcons.adapter =
|
||||||
|
@ -108,7 +106,9 @@ class ExpeditionPalletFragment(
|
||||||
itemExpeditionTruckVO!!.id
|
itemExpeditionTruckVO!!.id
|
||||||
)
|
)
|
||||||
} else if (item == iconPlus) {
|
} else if (item == iconPlus) {
|
||||||
expeditionScanAdd()
|
viewModel.expeditionScanAdd(
|
||||||
|
vPalletFk = 0, vTruckFk = itemExpeditionTruckVO!!.id
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -116,31 +116,29 @@ class ExpeditionPalletFragment(
|
||||||
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getCURDATE(date: String): String {
|
|
||||||
val c = Calendar.getInstance()
|
|
||||||
val df = SimpleDateFormat(getString(R.string.dateCompleteFormat))
|
|
||||||
val df2 = SimpleDateFormat(getString(R.string.timeFormat))
|
|
||||||
c.time = df.parse(date)!!
|
|
||||||
return df2.format(c.time)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
loadExpeditionPalletList.observe(viewLifecycleOwner, Observer { event ->
|
loadExpeditionPalletList.observe(viewLifecycleOwner) { event ->
|
||||||
event.getContentIfNotHandled().notNull { printExpeditionList(it) }
|
event.getContentIfNotHandled().notNull { printExpeditionList(it) }
|
||||||
})
|
}
|
||||||
|
|
||||||
loadScanList.observe(viewLifecycleOwner, Observer { event ->
|
loadScanList.observe(viewLifecycleOwner) { event ->
|
||||||
event.getContentIfNotHandled().notNull { showScanExpeditions(it) }
|
event.getContentIfNotHandled().notNull { showScanExpeditions(it) }
|
||||||
})
|
}
|
||||||
|
|
||||||
responseCheckexpeditionScanPut.observe(viewLifecycleOwner, Observer {
|
responseExpeditionAddHasNotSameRoute.observe(viewLifecycleOwner) {
|
||||||
|
if (it) {
|
||||||
if (it.response == "1") {
|
|
||||||
mperror?.start()
|
mperror?.start()
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
loadResponseScanPut.observe(viewLifecycleOwner) { event ->
|
||||||
|
event.getContentIfNotHandled().notNull {
|
||||||
|
listExpeditions.add(0, BarcodeVO(code = responseScanPut.value.toString()))
|
||||||
|
customDialogList.setDescription(getString(R.string.total) + listExpeditions.size)
|
||||||
|
expeditionAdapter!!.notifyItemInserted(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,12 +157,6 @@ class ExpeditionPalletFragment(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun expeditionScanAdd() {
|
|
||||||
viewModel.expeditionScanAdd(
|
|
||||||
vPalletFk = 0, vTruckFk = itemExpeditionTruckVO!!.id
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun showScanExpeditions(it: ItemScanList) {
|
private fun showScanExpeditions(it: ItemScanList) {
|
||||||
|
|
||||||
listExpeditions = ArrayList()
|
listExpeditions = ArrayList()
|
||||||
|
@ -183,7 +175,7 @@ class ExpeditionPalletFragment(
|
||||||
|
|
||||||
if (listExpeditions.size > 0) {
|
if (listExpeditions.size > 0) {
|
||||||
onComprobarPalletViewClickListener!!.onComprobarPalletViewClickListener(
|
onComprobarPalletViewClickListener!!.onComprobarPalletViewClickListener(
|
||||||
itemExpeditionTruckVO!!, ItemPalletVO(Pallet = it.list.get(0).palletFk)
|
itemExpeditionTruckVO!!, ItemPalletVO(Pallet = it.list[0].palletFk)
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
customDialog.setTitle(getString(R.string.info))
|
customDialog.setTitle(getString(R.string.info))
|
||||||
|
@ -208,27 +200,22 @@ class ExpeditionPalletFragment(
|
||||||
|
|
||||||
customDialogList.getEditText().setOnEditorActionListener { v, actionId, event ->
|
customDialogList.getEditText().setOnEditorActionListener { v, actionId, event ->
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||||
if (!customDialogList.getValue().isNullOrEmpty()) {
|
if (customDialogList.getValue().isNotEmpty()) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (customDialogList.getValue().length >= 7) {
|
viewModel.expeditionScanPut(
|
||||||
listExpeditions.add(0, BarcodeVO(code = customDialogList.getValue()))
|
it.list[0].palletFk, customDialogList.getValue().toInt()
|
||||||
customDialogList.setDescription(getString(R.string.total) + listExpeditions.size)
|
)
|
||||||
viewModel.expeditionScanPut(
|
viewModel.checkRouteExpeditionScanPut(
|
||||||
it.list.get(0).palletFk, customDialogList.getValue().toInt()
|
it.list[0].palletFk, customDialogList.getValue().toInt()
|
||||||
)
|
)
|
||||||
viewModel.expeditionCheckRoute(
|
|
||||||
it.list[0].palletFk, customDialogList.getValue().toInt()
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
if (mperror != null) mperror!!.start()
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
if (mperror != null) mperror!!.start()
|
if (mperror != null) mperror!!.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
expeditionAdapter!!.notifyDataSetChanged()
|
|
||||||
}
|
}
|
||||||
customDialogList.setValue("")
|
customDialogList.setValue("")
|
||||||
ma.hideKeyboard(customDialogList.getEditText())
|
ma.hideKeyboard(customDialogList.getEditText())
|
||||||
|
|
|
@ -1,96 +0,0 @@
|
||||||
package es.verdnatura.presentation.view.feature.paletizador.fragment
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import androidx.lifecycle.LiveData
|
|
||||||
import androidx.lifecycle.MutableLiveData
|
|
||||||
import androidx.lifecycle.map
|
|
||||||
import es.verdnatura.domain.SalixCallback
|
|
||||||
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.ResponseItemVO
|
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletListVO
|
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
|
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemScanList
|
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemScanVO
|
|
||||||
import retrofit2.Call
|
|
||||||
import retrofit2.Response
|
|
||||||
|
|
||||||
class ExpeditionPalletViewModel(val context: Context) : BaseViewModel(context) {
|
|
||||||
|
|
||||||
private val _expeditionPalletList by lazy { MutableLiveData<ItemPalletListVO>() }
|
|
||||||
val loadExpeditionPalletList: LiveData<Event<ItemPalletListVO>> =
|
|
||||||
_expeditionPalletList.map { Event(it) }
|
|
||||||
|
|
||||||
private val _scanList by lazy { MutableLiveData<ItemScanList>() }
|
|
||||||
val loadScanList: LiveData<Event<ItemScanList>> = _scanList.map { Event(it) }
|
|
||||||
|
|
||||||
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
|
||||||
val response: LiveData<ResponseItemVO>
|
|
||||||
get() = _response
|
|
||||||
|
|
||||||
//sergio: añadido para comprobar rutas escaneado desde PalletFragment
|
|
||||||
private val _responseCheckexpeditionScanPut by lazy { MutableLiveData<ResponseItemVO>() }
|
|
||||||
val responseCheckexpeditionScanPut: LiveData<ResponseItemVO>
|
|
||||||
get() = _responseCheckexpeditionScanPut
|
|
||||||
|
|
||||||
fun expeditionPalletList(vTruckFk: Int) {
|
|
||||||
salix.expeditionPalletList(
|
|
||||||
arrayListOf(vTruckFk)
|
|
||||||
)
|
|
||||||
.enqueue(object :
|
|
||||||
SalixCallback<List<ItemPalletVO>>(context) {
|
|
||||||
override fun onSuccess(response: Response<List<ItemPalletVO>>) {
|
|
||||||
|
|
||||||
_expeditionPalletList.value =
|
|
||||||
response.body()?.let { ItemPalletListVO(it) }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fun expeditionScanAdd(vPalletFk: Int, vTruckFk: Int) {
|
|
||||||
salix.expeditionScanAdd(
|
|
||||||
arrayListOf(vPalletFk, vTruckFk)
|
|
||||||
)
|
|
||||||
.enqueue(object :
|
|
||||||
SalixCallback<List<ItemScanVO>>(context) {
|
|
||||||
override fun onSuccess(response: Response<List<ItemScanVO>>) {
|
|
||||||
_scanList.value = response.body()?.let { ItemScanList(it) }
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fun expeditionScanPut(vPalletFk: Int, vExpeditionFk: Int) {
|
|
||||||
salix.expeditionScanPut(arrayListOf(vPalletFk, vExpeditionFk))
|
|
||||||
.enqueue(object : SalixCallback<Any>(context) {
|
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
|
||||||
_response.value = ResponseItemVO(isError = false, response = response.message())
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onError(t: Throwable) {
|
|
||||||
_response.value = ResponseItemVO(
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fun expeditionCheckRoute(vPalletFk: Int, vExpeditionFk: Int) {
|
|
||||||
salix.expeditionCheckRoute(arrayListOf(vPalletFk, vExpeditionFk))
|
|
||||||
.enqueue(object : SalixCallback<String>(context) {
|
|
||||||
override fun onSuccess(response: Response<String>) {
|
|
||||||
|
|
||||||
_responseCheckexpeditionScanPut.value =
|
|
||||||
ResponseItemVO(isError = false, response = response.body()!!)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -15,10 +15,10 @@ import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewM
|
||||||
import es.verdnatura.presentation.view.feature.ubicador.adapter.AutomaticAdapter
|
import es.verdnatura.presentation.view.feature.ubicador.adapter.AutomaticAdapter
|
||||||
|
|
||||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||||
class ExpeditionPreparedStateFragment(
|
class ExpeditionPreparedStateFragment :
|
||||||
) : BaseFragment<FragmentAutomaticAddExpeditionBinding, DeliveryViewModel>(
|
BaseFragment<FragmentAutomaticAddExpeditionBinding, DeliveryViewModel>(
|
||||||
DeliveryViewModel::class
|
DeliveryViewModel::class
|
||||||
) {
|
) {
|
||||||
|
|
||||||
private var adapter: AutomaticAdapter? = null
|
private var adapter: AutomaticAdapter? = null
|
||||||
private var contador = 0
|
private var contador = 0
|
||||||
|
|
|
@ -6,13 +6,17 @@ import android.media.MediaPlayer
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import androidx.lifecycle.Observer
|
import androidx.core.content.res.ResourcesCompat
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentExpeditionScanBinding
|
import es.verdnatura.databinding.FragmentExpeditionScanBinding
|
||||||
import es.verdnatura.domain.notNull
|
import es.verdnatura.domain.notNull
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.*
|
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
|
||||||
|
import es.verdnatura.presentation.common.OnComprobarPalletViewClickListener
|
||||||
|
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||||
|
import es.verdnatura.presentation.common.OnPalletClickListener
|
||||||
|
import es.verdnatura.presentation.common.OnScanLongClickListener
|
||||||
import es.verdnatura.presentation.view.component.CustomDialog
|
import es.verdnatura.presentation.view.component.CustomDialog
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogList
|
import es.verdnatura.presentation.view.component.CustomDialogList
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogTwoButtons
|
import es.verdnatura.presentation.view.component.CustomDialogTwoButtons
|
||||||
|
@ -21,9 +25,11 @@ import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
|
||||||
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
|
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.adapter.ExpeditionScanAdapter
|
import es.verdnatura.presentation.view.feature.paletizador.adapter.ExpeditionScanAdapter
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.*
|
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionScanList
|
||||||
import java.text.SimpleDateFormat
|
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionScanVO
|
||||||
import java.util.*
|
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO
|
||||||
|
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
|
||||||
|
import es.verdnatura.presentation.view.feature.paletizador.model.ItemScanList
|
||||||
|
|
||||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||||
class ExpeditionScanFragment(
|
class ExpeditionScanFragment(
|
||||||
|
@ -65,20 +71,16 @@ class ExpeditionScanFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
|
println("ExpeditionScanFragment")
|
||||||
customDialog = CustomDialog(requireContext())
|
customDialog = CustomDialog(requireContext())
|
||||||
customDialogList = CustomDialogList(requireContext())
|
customDialogList = CustomDialogList(requireContext())
|
||||||
customDialogTwoButtons = CustomDialogTwoButtons(requireContext())
|
customDialogTwoButtons = CustomDialogTwoButtons(requireContext())
|
||||||
binding.expeditionScanDetailPallet.text =
|
binding.expeditionScanDetailPallet.text = getString(
|
||||||
getString(R.string.pallet) + " " + itemPalletVO!!.Pallet
|
R.string.expeditionInfo, getString(R.string.pallet), itemPalletVO!!.Pallet.toString()
|
||||||
|
)
|
||||||
ma.hideBottomNavigation(View.GONE)
|
ma.hideBottomNavigation(View.GONE)
|
||||||
binding.mainToolbar.toolbarTitle.text =
|
binding.mainToolbar.toolbarTitle.text =
|
||||||
itemExpeditionTruckVO!!.eta.toString() + " " + if (itemExpeditionTruckVO!!.Destino.isNullOrBlank()) {
|
getString(R.string.expeditionInfo, itemExpeditionTruckVO?.eta.orEmpty(), itemExpeditionTruckVO?.description.orEmpty())
|
||||||
itemExpeditionTruckVO!!.description
|
|
||||||
} else {
|
|
||||||
|
|
||||||
itemExpeditionTruckVO!!.Destino
|
|
||||||
}
|
|
||||||
|
|
||||||
setToolBar()
|
setToolBar()
|
||||||
setEvents()
|
setEvents()
|
||||||
viewModel.expeditionScanList(
|
viewModel.expeditionScanList(
|
||||||
|
@ -97,9 +99,9 @@ class ExpeditionScanFragment(
|
||||||
private fun setToolBar() {
|
private fun setToolBar() {
|
||||||
val listIcons: ArrayList<Drawable> = ArrayList()
|
val listIcons: ArrayList<Drawable> = ArrayList()
|
||||||
val iconReload: Drawable =
|
val iconReload: Drawable =
|
||||||
resources.getDrawable(R.drawable.ic_autorenew_black_24dp, resources.newTheme())
|
ResourcesCompat.getDrawable(resources, R.drawable.ic_autorenew_black_24dp, null)!!
|
||||||
val iconPlus: Drawable =
|
val iconPlus: Drawable =
|
||||||
resources.getDrawable(R.drawable.ic_add_black_24dp, resources.newTheme())
|
ResourcesCompat.getDrawable(resources, R.drawable.ic_add_black_24dp, null)!!
|
||||||
listIcons.add(iconReload)
|
listIcons.add(iconReload)
|
||||||
listIcons.add(iconPlus)
|
listIcons.add(iconPlus)
|
||||||
binding.mainToolbar.toolbarIcons.adapter =
|
binding.mainToolbar.toolbarIcons.adapter =
|
||||||
|
@ -108,7 +110,9 @@ class ExpeditionScanFragment(
|
||||||
if (item == iconReload) {
|
if (item == iconReload) {
|
||||||
viewModel.expeditionScanList(itemPalletVO!!.Pallet)
|
viewModel.expeditionScanList(itemPalletVO!!.Pallet)
|
||||||
} else if (item == iconPlus) {
|
} else if (item == iconPlus) {
|
||||||
expeditionScanAdd()
|
viewModel.expeditionScanAdd(
|
||||||
|
vPalletFk = itemPalletVO!!.Pallet, vTruckFk = itemExpeditionTruckVO!!.id
|
||||||
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,54 +121,25 @@ class ExpeditionScanFragment(
|
||||||
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getCURDATE(date: String): String {
|
|
||||||
val c = Calendar.getInstance()
|
|
||||||
val df = SimpleDateFormat(getString(R.string.dateCompleteFormat))
|
|
||||||
val df2 = SimpleDateFormat(getString(R.string.timeFormat))
|
|
||||||
c.time = df.parse(date)!!
|
|
||||||
return df2.format(c.time)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
loadExpeditionScanList.observe(viewLifecycleOwner, Observer { event ->
|
loadExpeditionScanList.observe(viewLifecycleOwner) { event ->
|
||||||
event.getContentIfNotHandled().notNull { printExpeditionList(it) }
|
event.getContentIfNotHandled().notNull { printExpeditionList(it) }
|
||||||
})
|
}
|
||||||
|
|
||||||
loadScanList.observe(viewLifecycleOwner, Observer { event ->
|
|
||||||
event.getContentIfNotHandled().notNull { showScanExpeditions(it) }
|
|
||||||
})
|
|
||||||
|
|
||||||
response.observe(viewLifecycleOwner, Observer {
|
|
||||||
if (it.isError) {
|
|
||||||
ma.messageWithSound(it.errorMessage, true, false)
|
|
||||||
|
|
||||||
|
loadScanList.observe(viewLifecycleOwner) { event ->
|
||||||
|
event.getContentIfNotHandled().notNull {
|
||||||
|
showScanExpeditions(it)
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
responseCheckexpeditionScanPut.observe(viewLifecycleOwner, Observer {
|
responseExpeditionAddHasNotSameRoute.observe(viewLifecycleOwner) {
|
||||||
if (it.isError) {
|
if (it) {
|
||||||
ma.messageWithSound(it.errorMessage, true, false)
|
mperror?.start()
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
|
|
||||||
if (it.response == "1") {
|
|
||||||
mperror?.start()
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
|
|
||||||
responseDeleteScan.observe(viewLifecycleOwner, Observer {
|
|
||||||
if (it.isError) {
|
|
||||||
ma.messageWithSound(it.errorMessage, true, false)
|
|
||||||
|
|
||||||
} else {
|
|
||||||
viewModel.expeditionScanList(itemPalletVO!!.Pallet)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,16 +147,15 @@ class ExpeditionScanFragment(
|
||||||
|
|
||||||
val lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
val lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
adapter = ExpeditionScanAdapter(it.list, object : OnScanLongClickListener {
|
adapter = ExpeditionScanAdapter(it.list, object : OnScanLongClickListener {
|
||||||
override fun onScanLongClickListener(itemExpeditionScan: ItemExpeditionScanVO) {
|
override fun onScanLongClickListener(itemExpeditionScanVO: ItemExpeditionScanVO) {
|
||||||
customDialogTwoButtons.setTitle(
|
customDialogTwoButtons.setTitle(
|
||||||
getString(R.string.ticket) + itemExpeditionScan.Ticket + getString(
|
getString(R.string.ticket) + itemExpeditionScanVO.Ticket + getString(
|
||||||
R.string.pallet
|
R.string.pallet
|
||||||
) + itemPalletVO!!.Pallet
|
) + itemPalletVO!!.Pallet
|
||||||
)
|
).setDescription(getString(R.string.expedit) + itemExpeditionScanVO.expeditionFk)
|
||||||
.setDescription(getString(R.string.expedit) + itemExpeditionScan.expeditionFk)
|
|
||||||
.setOkButton(getString(R.string.delete)) {
|
.setOkButton(getString(R.string.delete)) {
|
||||||
viewModel.expeditionScanDel(
|
viewModel.expeditionScanDel(
|
||||||
itemExpeditionScan.id
|
itemExpeditionScanVO.id, itemPalletVO!!.Pallet
|
||||||
)
|
)
|
||||||
customDialogTwoButtons.dismiss()
|
customDialogTwoButtons.dismiss()
|
||||||
}.setKoButton(getString(R.string.cancel)) {
|
}.setKoButton(getString(R.string.cancel)) {
|
||||||
|
@ -193,23 +167,13 @@ class ExpeditionScanFragment(
|
||||||
binding.expeditionPalletRecyclerview.adapter = adapter
|
binding.expeditionPalletRecyclerview.adapter = adapter
|
||||||
binding.expeditionPalletRecyclerview.layoutManager = lm
|
binding.expeditionPalletRecyclerview.layoutManager = lm
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun expeditionScanAdd() {
|
|
||||||
viewModel.expeditionScanAdd(
|
|
||||||
vPalletFk = itemPalletVO!!.Pallet,
|
|
||||||
vTruckFk = itemExpeditionTruckVO!!.id
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showScanExpeditions(it: ItemScanList) {
|
private fun showScanExpeditions(it: ItemScanList) {
|
||||||
|
|
||||||
listExpeditions = ArrayList()
|
listExpeditions = ArrayList()
|
||||||
it.list.forEach {
|
it.list.forEach {
|
||||||
if (it.expeditionFk != "0")
|
if (it.expeditionFk != "0") listExpeditions.add(BarcodeVO(code = it.expeditionFk))
|
||||||
listExpeditions.add(BarcodeVO(code = it.expeditionFk))
|
|
||||||
}
|
}
|
||||||
customDialogList.setTitle(getString(R.string.pallet) + " " + itemPalletVO!!.Pallet + " \n(" + binding.mainToolbar.toolbarTitle.text + ")")
|
customDialogList.setTitle(getString(R.string.pallet) + " " + itemPalletVO!!.Pallet + " \n(" + binding.mainToolbar.toolbarTitle.text + ")")
|
||||||
.setOkButton(getString(R.string.test)) {
|
.setOkButton(getString(R.string.test)) {
|
||||||
|
@ -219,8 +183,7 @@ class ExpeditionScanFragment(
|
||||||
if (listExpeditions.size > 0) {
|
if (listExpeditions.size > 0) {
|
||||||
|
|
||||||
onComprobarPalletViewClickListener!!.onComprobarPalletViewClickListener(
|
onComprobarPalletViewClickListener!!.onComprobarPalletViewClickListener(
|
||||||
itemExpeditionTruckVO!!,
|
itemExpeditionTruckVO!!, ItemPalletVO(Pallet = it.list[0].palletFk)
|
||||||
ItemPalletVO(Pallet = it.list.get(0).palletFk)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -236,7 +199,6 @@ class ExpeditionScanFragment(
|
||||||
|
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
|
|
||||||
|
|
||||||
}.setKoButton(getString(R.string.close)) {
|
}.setKoButton(getString(R.string.close)) {
|
||||||
ma.hideKeyboard(customDialogList.getEditText())
|
ma.hideKeyboard(customDialogList.getEditText())
|
||||||
listExpeditions = ArrayList()
|
listExpeditions = ArrayList()
|
||||||
|
@ -248,24 +210,22 @@ class ExpeditionScanFragment(
|
||||||
|
|
||||||
customDialogList.getEditText().setOnEditorActionListener { v, actionId, event ->
|
customDialogList.getEditText().setOnEditorActionListener { v, actionId, event ->
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||||
if (!customDialogList.getValue().isNullOrEmpty()) {
|
if (customDialogList.getValue().isNotEmpty()) {
|
||||||
try {
|
try {
|
||||||
listExpeditions.add(BarcodeVO(code = customDialogList.getValue()))
|
listExpeditions.add(BarcodeVO(code = customDialogList.getValue()))
|
||||||
viewModel.expeditionScanPut(
|
viewModel.expeditionScanPut(
|
||||||
it.list[0].palletFk,
|
it.list[0].palletFk, customDialogList.getValue().toInt()
|
||||||
customDialogList.getValue().toInt()
|
|
||||||
)
|
|
||||||
checkRouteExpeditionScanPut(
|
|
||||||
it.list[0].palletFk,
|
|
||||||
customDialogList.getValue().toInt()
|
|
||||||
)
|
)
|
||||||
|
|
||||||
expeditionAdapter!!.notifyDataSetChanged()
|
viewModel.checkRouteExpeditionScanPut(
|
||||||
|
it.list[0].palletFk, customDialogList.getValue().toInt()
|
||||||
|
)
|
||||||
|
|
||||||
|
expeditionAdapter!!.notifyItemInserted(listExpeditions.size - 1)
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
getString(R.string.errorInput)
|
getString(R.string.errorInput)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
customDialogList.setValue("")
|
customDialogList.setValue("")
|
||||||
ma.hideKeyboard(customDialogList.getEditText())
|
ma.hideKeyboard(customDialogList.getEditText())
|
||||||
|
@ -284,14 +244,6 @@ class ExpeditionScanFragment(
|
||||||
customDialogList.getRecyclerView().layoutManager =
|
customDialogList.getRecyclerView().layoutManager =
|
||||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun checkRouteExpeditionScanPut(palletFk: Int, expedition: Int) {
|
|
||||||
|
|
||||||
viewModel.checkRouteExpeditionScanPut(palletFk, expedition)
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -52,7 +52,7 @@ class ExpeditionScanSorterFragment(
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
|
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
responsescan.observe(viewLifecycleOwner) {
|
loadResponseScan.observe(viewLifecycleOwner) {
|
||||||
listExpeditionScan.add(GeneralItem(itemScaned, itemScaned))
|
listExpeditionScan.add(GeneralItem(itemScaned, itemScaned))
|
||||||
customDialogList.setDescription(getString(R.string.total) + ":" + listExpeditionScan.size)
|
customDialogList.setDescription(getString(R.string.total) + ":" + listExpeditionScan.size)
|
||||||
expeditionScanAdapter!!.notifyItemInserted(listExpeditionScan.size - 1)
|
expeditionScanAdapter!!.notifyItemInserted(listExpeditionScan.size - 1)
|
||||||
|
@ -91,7 +91,7 @@ class ExpeditionScanSorterFragment(
|
||||||
|
|
||||||
expeditionScanAdapter =
|
expeditionScanAdapter =
|
||||||
GeneralAdapter(listExpeditionScan, object : OnGeneralItemRowClickListener {
|
GeneralAdapter(listExpeditionScan, object : OnGeneralItemRowClickListener {
|
||||||
override fun OnGeneralItemRowClickListener(item: GeneralItem) {
|
override fun onGeneralItemRowClickListener(item: GeneralItem) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ import retrofit2.Response
|
||||||
|
|
||||||
class ExpeditionScanSorterViewModel(val context: Context) : BaseViewModel(context) {
|
class ExpeditionScanSorterViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
private val _responseScan by lazy { MutableLiveData<String>() }
|
private val _responseScan by lazy { MutableLiveData<Any>() }
|
||||||
val responsescan: LiveData<String>
|
val loadResponseScan: LiveData<Any>
|
||||||
get() = _responseScan
|
get() = _responseScan
|
||||||
|
|
||||||
fun expeditionScan(vExpeditionId: String) {
|
fun expeditionScan(vExpeditionId: String) {
|
||||||
|
|
|
@ -6,73 +6,58 @@ import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.map
|
import androidx.lifecycle.map
|
||||||
import es.verdnatura.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
|
||||||
import es.verdnatura.presentation.common.Event
|
import es.verdnatura.presentation.common.Event
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionScanList
|
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionScanList
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionScanVO
|
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionScanVO
|
||||||
|
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletListVO
|
||||||
|
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemScanList
|
import es.verdnatura.presentation.view.feature.paletizador.model.ItemScanList
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemScanVO
|
import es.verdnatura.presentation.view.feature.paletizador.model.ItemScanVO
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class ExpeditionScanViewModel(val context: Context) : BaseViewModel(context) {
|
class ExpeditionScanViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
|
private val _expeditionPalletList by lazy { MutableLiveData<ItemPalletListVO>() }
|
||||||
|
val loadExpeditionPalletList: LiveData<Event<ItemPalletListVO>> =
|
||||||
|
_expeditionPalletList.map { Event(it) }
|
||||||
|
|
||||||
private val _expeditionScanList by lazy { MutableLiveData<ItemExpeditionScanList>() }
|
private val _expeditionScanList by lazy { MutableLiveData<ItemExpeditionScanList>() }
|
||||||
val loadExpeditionScanList: LiveData<Event<ItemExpeditionScanList>> = _expeditionScanList.map { Event(it) }
|
val loadExpeditionScanList: LiveData<Event<ItemExpeditionScanList>> =
|
||||||
|
_expeditionScanList.map { Event(it) }
|
||||||
|
|
||||||
private val _scanList by lazy { MutableLiveData<ItemScanList>() }
|
private val _scanList by lazy { MutableLiveData<ItemScanList>() }
|
||||||
val loadScanList: LiveData<Event<ItemScanList>> = _scanList.map { Event(it) }
|
val loadScanList: LiveData<Event<ItemScanList>> = _scanList.map { Event(it) }
|
||||||
|
|
||||||
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _responseExpeditionAddHasNotSameRoute by lazy { MutableLiveData<Boolean>() }
|
||||||
val response: LiveData<ResponseItemVO>
|
val responseExpeditionAddHasNotSameRoute: LiveData<Boolean>
|
||||||
get() = _response
|
get() = _responseExpeditionAddHasNotSameRoute
|
||||||
|
|
||||||
private val _responseDeleteScan by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _responseScanPut by lazy { MutableLiveData<Int>() }
|
||||||
val responseDeleteScan: LiveData<ResponseItemVO>
|
val responseScanPut: LiveData<Int> = _responseScanPut
|
||||||
get() = _responseDeleteScan
|
|
||||||
|
|
||||||
private val _responseCheckexpeditionScanPut by lazy { MutableLiveData<ResponseItemVO>() }
|
val loadResponseScanPut: LiveData<Event<Int>> =
|
||||||
val responseCheckexpeditionScanPut: LiveData<ResponseItemVO>
|
_responseScanPut.map { Event(it) }
|
||||||
get() = _responseCheckexpeditionScanPut
|
fun expeditionPalletList(vTruckFk: Int) {
|
||||||
|
salix.expeditionPalletList(
|
||||||
|
arrayListOf(vTruckFk)
|
||||||
|
)
|
||||||
|
.enqueue(object :
|
||||||
|
SalixCallback<List<ItemPalletVO>>(context) {
|
||||||
|
override fun onSuccess(response: Response<List<ItemPalletVO>>) {
|
||||||
|
|
||||||
|
_expeditionPalletList.value =
|
||||||
|
response.body()?.let { ItemPalletListVO(it) }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fun expeditionScanList(vPalletFk: Int) {
|
fun expeditionScanList(vPalletFk: Int) {
|
||||||
salix.expeditionScanList(arrayListOf(vPalletFk))
|
salix.expeditionScanList(arrayListOf(vPalletFk))
|
||||||
.enqueue(object :
|
.enqueue(object : SalixCallback<List<ItemExpeditionScanVO>>(context) {
|
||||||
SalixCallback<List<ItemExpeditionScanVO>>(context) {
|
|
||||||
override fun onSuccess(response: Response<List<ItemExpeditionScanVO>>) {
|
override fun onSuccess(response: Response<List<ItemExpeditionScanVO>>) {
|
||||||
if (response.body() != null) {
|
_expeditionScanList.value = response.body()?.let { ItemExpeditionScanList(it) }
|
||||||
_expeditionScanList.value =
|
|
||||||
response.body()?.let { ItemExpeditionScanList(it) }
|
|
||||||
} else {
|
|
||||||
val listError: ArrayList<ItemExpeditionScanVO> = ArrayList()
|
|
||||||
listError.add(
|
|
||||||
ItemExpeditionScanVO(
|
|
||||||
0,
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
_expeditionScanList.value = ItemExpeditionScanList(listError)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onError(t: Throwable) {
|
|
||||||
val listError: ArrayList<ItemExpeditionScanVO> = ArrayList()
|
|
||||||
listError.add(
|
|
||||||
ItemExpeditionScanVO(
|
|
||||||
0,
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
t.message!!
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
_expeditionScanList.value = ItemExpeditionScanList(listError)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -80,120 +65,51 @@ class ExpeditionScanViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
fun expeditionScanAdd(vPalletFk: Int, vTruckFk: Int) {
|
fun expeditionScanAdd(vPalletFk: Int, vTruckFk: Int) {
|
||||||
salix.expeditionScanAdd(arrayListOf(vPalletFk, vTruckFk))
|
salix.expeditionScanAdd(arrayListOf(vPalletFk, vTruckFk))
|
||||||
.enqueue(object :
|
.enqueue(object : SalixCallback<List<ItemScanVO>>(context) {
|
||||||
SalixCallback<List<ItemScanVO>>(context) {
|
|
||||||
override fun onSuccess(response: Response<List<ItemScanVO>>) {
|
override fun onSuccess(response: Response<List<ItemScanVO>>) {
|
||||||
if (response.body() != null) {
|
|
||||||
_scanList.value = response.body()?.let { ItemScanList(it) }
|
|
||||||
} else {
|
|
||||||
val listError: ArrayList<ItemScanVO> = ArrayList()
|
|
||||||
listError.add(
|
|
||||||
ItemScanVO(
|
|
||||||
"", 0,
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
_scanList.value = ItemScanList(listError)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onError(t: Throwable) {
|
_scanList.value = response.body()?.let { ItemScanList(it) }
|
||||||
val listError: ArrayList<ItemScanVO> = ArrayList()
|
|
||||||
listError.add(
|
|
||||||
ItemScanVO(
|
|
||||||
"", 0,
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
t.message!!
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
_scanList.value = ItemScanList(listError)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun expeditionScanPut(
|
fun expeditionScanPut(
|
||||||
vPalletFk: Int,
|
vPalletFk: Int, vExpeditionFk: Int
|
||||||
vExpeditionFk: Int
|
|
||||||
) {
|
) {
|
||||||
salix.expeditionScanPut(
|
salix.expeditionScanPut(
|
||||||
arrayListOf(vPalletFk, vExpeditionFk)
|
arrayListOf(vPalletFk, vExpeditionFk)
|
||||||
)
|
).enqueue(object : SalixCallback<Any>(context) {
|
||||||
.enqueue(object : SalixCallback<Any>(context) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
override fun onSuccess(response: Response<Any>) {
|
_responseScanPut.value = vExpeditionFk
|
||||||
_response.value =
|
}
|
||||||
ResponseItemVO(isError = false, response = response.message())
|
|
||||||
|
|
||||||
}
|
})
|
||||||
|
|
||||||
override fun onError(t: Throwable) {
|
|
||||||
_response.value = ResponseItemVO(
|
|
||||||
isError = true, errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this), t.message!!
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun checkRouteExpeditionScanPut(
|
fun checkRouteExpeditionScanPut(
|
||||||
vPalletFk: Int,
|
vPalletFk: Int, vExpeditionFk: Int
|
||||||
vExpeditionFk: Int
|
|
||||||
) {
|
) {
|
||||||
salix.expeditionCheckRoute(
|
salix.expeditionCheckRoute(
|
||||||
arrayListOf(
|
arrayListOf(
|
||||||
vPalletFk,
|
vPalletFk, vExpeditionFk
|
||||||
vExpeditionFk
|
|
||||||
)
|
)
|
||||||
).enqueue(object : SalixCallback<String>(context) {
|
).enqueue(object : SalixCallback<Int>(context) {
|
||||||
override fun onSuccess(response: Response<String>) {
|
override fun onSuccess(response: Response<Int>) {
|
||||||
if (response.body() == null) {
|
|
||||||
_responseCheckexpeditionScanPut.value = ResponseItemVO(
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
_responseCheckexpeditionScanPut.value =
|
|
||||||
ResponseItemVO(isError = false, response = response.body()!!)
|
|
||||||
|
|
||||||
}
|
_responseExpeditionAddHasNotSameRoute.value = response.body()!! == 1
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onError(t: Throwable) {
|
})
|
||||||
_responseCheckexpeditionScanPut.value = ResponseItemVO(
|
}
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
fun expeditionScanDel(expeditionFk: Int, palletId: Int) {
|
||||||
)
|
salix.expeditionScanDel(expeditionFk).enqueue(object : SalixCallback<Any>(context) {
|
||||||
|
|
||||||
|
override fun onSuccess(response: Response<Any>) {
|
||||||
|
expeditionScanList(palletId)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun expeditionScanDel(vScanFk: Int) {
|
|
||||||
salix.expeditionScanDel(vScanFk)
|
|
||||||
.enqueue(object : SalixCallback<Any>(context) {
|
|
||||||
override fun onError(t: Throwable) {
|
|
||||||
_responseDeleteScan.value = ResponseItemVO(
|
|
||||||
isError = true, errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this), t.message!!
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSuccess(response: Response<Any>) {
|
|
||||||
|
|
||||||
_responseDeleteScan.value =
|
|
||||||
ResponseItemVO(isError = false, response = response.message())
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,9 +91,7 @@ class ExpeditionTruckListFragment :
|
||||||
loadExpeditionTruckList.observe(viewLifecycleOwner) { event ->
|
loadExpeditionTruckList.observe(viewLifecycleOwner) { event ->
|
||||||
event.getContentIfNotHandled().notNull { printExpeditionList(it) }
|
event.getContentIfNotHandled().notNull { printExpeditionList(it) }
|
||||||
}
|
}
|
||||||
loadResponseExpeditionAdd.observe(viewLifecycleOwner) { event ->
|
|
||||||
viewModel.expeditionTruckList()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,6 @@ class ExpeditionTruckListViewModel(val context: Context) : BaseViewModel(context
|
||||||
val loadExpeditionTruckList: LiveData<Event<ItemExpeditionTruckList>> =
|
val loadExpeditionTruckList: LiveData<Event<ItemExpeditionTruckList>> =
|
||||||
_expeditionTruckList.map { Event(it) }
|
_expeditionTruckList.map { Event(it) }
|
||||||
|
|
||||||
private val _response by lazy { MutableLiveData<String>() }
|
|
||||||
val loadResponseExpeditionAdd: LiveData<Event<String>> = _response.map { Event(it) }
|
|
||||||
|
|
||||||
fun expeditionTruckList() {
|
fun expeditionTruckList() {
|
||||||
salix.roadMapStopGet(
|
salix.roadMapStopGet(
|
||||||
"""{"where": { "eta": {
|
"""{"where": { "eta": {
|
||||||
|
@ -33,8 +30,7 @@ class ExpeditionTruckListViewModel(val context: Context) : BaseViewModel(context
|
||||||
}"]}},"order": "eta ASC"}"""
|
}"]}},"order": "eta ASC"}"""
|
||||||
).enqueue(object : SalixCallback<List<ItemExpeditionTruckVO>>(context) {
|
).enqueue(object : SalixCallback<List<ItemExpeditionTruckVO>>(context) {
|
||||||
override fun onSuccess(response: Response<List<ItemExpeditionTruckVO>>) {
|
override fun onSuccess(response: Response<List<ItemExpeditionTruckVO>>) {
|
||||||
_expeditionTruckList.value =
|
_expeditionTruckList.value = response.body()?.let { ItemExpeditionTruckList(it) }
|
||||||
response.body()?.let { ItemExpeditionTruckList(it) }
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -42,12 +38,11 @@ class ExpeditionTruckListViewModel(val context: Context) : BaseViewModel(context
|
||||||
fun roadMapStopAdd(vHour: String, vDescription: String) {
|
fun roadMapStopAdd(vHour: String, vDescription: String) {
|
||||||
salix.roadMapStopAdd(
|
salix.roadMapStopAdd(
|
||||||
ExpeditionTruckSalix(
|
ExpeditionTruckSalix(
|
||||||
eta = "${LocalDate.now()} $vHour",
|
eta = "${LocalDate.now()} $vHour", description = vDescription
|
||||||
description = vDescription
|
|
||||||
)
|
)
|
||||||
).enqueue(object : SalixCallback<Any>(context) {
|
).enqueue(object : SalixCallback<Any>(context) {
|
||||||
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
override fun onResponse(call: Call<Any>, response: Response<Any>) {
|
||||||
_response.value = response.message()
|
expeditionTruckList()
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue