feat: refs #8150 moveExpeditions
This commit is contained in:
parent
d0e5e5d748
commit
26e13bb7d0
|
@ -25,6 +25,7 @@ import es.verdnatura.presentation.view.feature.delivery.model.DeliveryInfo
|
||||||
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.model.ExpeditionInfoLog
|
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLog
|
||||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoSummary
|
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoSummary
|
||||||
|
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionWithTicket
|
||||||
import es.verdnatura.presentation.view.feature.delivery.model.RouteAction
|
import es.verdnatura.presentation.view.feature.delivery.model.RouteAction
|
||||||
import es.verdnatura.presentation.view.feature.delivery.model.RouteComplement
|
import es.verdnatura.presentation.view.feature.delivery.model.RouteComplement
|
||||||
import es.verdnatura.presentation.view.feature.delivery.model.RouteComplementAdd
|
import es.verdnatura.presentation.view.feature.delivery.model.RouteComplementAdd
|
||||||
|
@ -188,6 +189,18 @@ interface SalixService {
|
||||||
fun getRoutes(
|
fun getRoutes(
|
||||||
): Call<MutableList<RouteInfo>>
|
): Call<MutableList<RouteInfo>>
|
||||||
|
|
||||||
|
@POST("Expeditions/moveExpeditions")
|
||||||
|
fun moveExpeditions(
|
||||||
|
@Query("clientId") clientId: Number,
|
||||||
|
@Query("warehouseId") warehouseId: Number,
|
||||||
|
@Query("addressId") addressId: Number,
|
||||||
|
@Query("agencyModeId") agencyModeId: Number,
|
||||||
|
@Query("routeId") routeId: Number,
|
||||||
|
@Query("expeditionIds") expeditionIds: ArrayList<Number>,
|
||||||
|
@Query("landed") landed: String
|
||||||
|
|
||||||
|
): Call<Any>
|
||||||
|
|
||||||
@GET("Workers/Summary")
|
@GET("Workers/Summary")
|
||||||
fun getNameWorker(
|
fun getNameWorker(
|
||||||
@Query("filter") filter: String
|
@Query("filter") filter: String
|
||||||
|
@ -558,6 +571,11 @@ interface SalixService {
|
||||||
@Query("filter") filter: Any = """{"fields": {"id": true,"name": true,"price":true},"order": "name"}"""
|
@Query("filter") filter: Any = """{"fields": {"id": true,"name": true,"price":true},"order": "name"}"""
|
||||||
): Call<List<RouteAction>>
|
): Call<List<RouteAction>>
|
||||||
|
|
||||||
|
@GET("Expeditions")
|
||||||
|
fun getDataFromExpedition(
|
||||||
|
@Query("filter") filter: Any,
|
||||||
|
): Call<List<ExpeditionWithTicket>>
|
||||||
|
|
||||||
@POST("RouteComplements")
|
@POST("RouteComplements")
|
||||||
fun addRouteComplements(
|
fun addRouteComplements(
|
||||||
@Body params: RouteComplementAdd
|
@Body params: RouteComplementAdd
|
||||||
|
|
|
@ -7,9 +7,10 @@ import androidx.recyclerview.widget.RecyclerView
|
||||||
import es.verdnatura.databinding.ItemGeneralRowBinding
|
import es.verdnatura.databinding.ItemGeneralRowBinding
|
||||||
|
|
||||||
class GeneralAdapter(
|
class GeneralAdapter(
|
||||||
private val items: List<GeneralItem>,
|
private var items: List<GeneralItem>,
|
||||||
private val OnGeneralItemRowClickListener: OnGeneralItemRowClickListener,
|
private val onDeleteItemRowClickListener: OnGeneralItemRowClickListener,
|
||||||
// private var showDelete: Boolean = false
|
private var showDelete: Boolean = false,
|
||||||
|
private val onRowClickListener: OnGeneralRowClickListener? = null
|
||||||
) : RecyclerView.Adapter<GeneralAdapter.ItemHolder>() {
|
) : RecyclerView.Adapter<GeneralAdapter.ItemHolder>() {
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
|
||||||
|
@ -23,9 +24,9 @@ class GeneralAdapter(
|
||||||
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
|
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
|
||||||
holder.bind(items[position])
|
holder.bind(items[position])
|
||||||
|
|
||||||
holder.binding.root.setOnClickListener {
|
/*holder.binding.root.setOnClickListener {
|
||||||
OnGeneralItemRowClickListener.onGeneralItemRowClickListener(items[position])
|
onGeneralItemRowClickListener.onGeneralItemRowClickListener(items[position])
|
||||||
}
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,11 +37,31 @@ class GeneralAdapter(
|
||||||
fun bind(item: GeneralItem) {
|
fun bind(item: GeneralItem) {
|
||||||
binding.apply {
|
binding.apply {
|
||||||
this.item = item
|
this.item = item
|
||||||
/*if (showDelete) itemImage.visibility = View.VISIBLE
|
if (showDelete) itemImage.visibility = View.VISIBLE
|
||||||
else itemImage.visibility = View.GONE*/
|
else itemImage.visibility = View.GONE
|
||||||
|
|
||||||
itemCode.visibility = View.GONE
|
itemCode.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
binding.itemImage.setOnClickListener {
|
||||||
|
onDeleteItemRowClickListener.onGeneralItemRowClickListener(item)
|
||||||
|
}
|
||||||
|
binding.itemCode.setOnClickListener {
|
||||||
|
onRowClickListener?.onRowClickListener(item)
|
||||||
|
}
|
||||||
|
binding.itemTitle.setOnClickListener {
|
||||||
|
onRowClickListener?.onRowClickListener(item)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun updateItems(list: List<GeneralItem>) {
|
||||||
|
items = list
|
||||||
|
notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setShowDelete(hasVisibility: Boolean) {
|
||||||
|
showDelete = hasVisibility
|
||||||
|
notifyDataSetChanged()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,6 +107,10 @@ interface OnGeneralItemRowClickListener {
|
||||||
fun onGeneralItemRowClickListener(item: GeneralItem)
|
fun onGeneralItemRowClickListener(item: GeneralItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface OnGeneralRowClickListener {
|
||||||
|
fun onRowClickListener(item: GeneralItem)
|
||||||
|
}
|
||||||
|
|
||||||
interface OnImageTrashClickListener {
|
interface OnImageTrashClickListener {
|
||||||
fun onImageTrashClickListener(item: Any)
|
fun onImageTrashClickListener(item: Any)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,11 @@ import android.os.Bundle
|
||||||
import android.text.Editable
|
import android.text.Editable
|
||||||
import android.text.TextWatcher
|
import android.text.TextWatcher
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.view.inputmethod.EditorInfo
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentRouteBinding
|
import es.verdnatura.databinding.FragmentRouteBinding
|
||||||
|
@ -17,11 +19,18 @@ import es.verdnatura.domain.toDateString
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.base.database
|
import es.verdnatura.presentation.base.database
|
||||||
|
import es.verdnatura.presentation.common.GeneralAdapter
|
||||||
|
import es.verdnatura.presentation.common.GeneralItem
|
||||||
import es.verdnatura.presentation.common.ItemDescorationCustomized
|
import es.verdnatura.presentation.common.ItemDescorationCustomized
|
||||||
|
import es.verdnatura.presentation.common.OnGeneralItemRowClickListener
|
||||||
|
import es.verdnatura.presentation.common.OnGeneralRowClickListener
|
||||||
import es.verdnatura.presentation.common.OnItemImageRouteRowClickListener
|
import es.verdnatura.presentation.common.OnItemImageRouteRowClickListener
|
||||||
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||||
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
||||||
|
import es.verdnatura.presentation.common.hideKeyboard
|
||||||
|
import es.verdnatura.presentation.common.itemScanValue
|
||||||
|
import es.verdnatura.presentation.view.component.CustomDialogList
|
||||||
import es.verdnatura.presentation.view.feature.delivery.adapters.RouteAdapter
|
import es.verdnatura.presentation.view.feature.delivery.adapters.RouteAdapter
|
||||||
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.model.ExpeditionSalixPosition
|
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionSalixPosition
|
||||||
|
@ -45,6 +54,34 @@ class RoutesFragment(
|
||||||
private lateinit var myListRoute: MutableList<RouteInfo>
|
private lateinit var myListRoute: MutableList<RouteInfo>
|
||||||
private lateinit var db: DeliveryDatabase
|
private lateinit var db: DeliveryDatabase
|
||||||
private lateinit var myListRouteLoaded: List<RouteLoaded>
|
private lateinit var myListRouteLoaded: List<RouteLoaded>
|
||||||
|
private val customDialogList: CustomDialogList by lazy {
|
||||||
|
CustomDialogList(requireContext())
|
||||||
|
}
|
||||||
|
private var listExpeditionScan: ArrayList<GeneralItem> = ArrayList()
|
||||||
|
private var listMyRoutes: ArrayList<GeneralItem> = ArrayList()
|
||||||
|
|
||||||
|
private val expeditionScanAdapter: GeneralAdapter? by lazy {
|
||||||
|
GeneralAdapter(listExpeditionScan, object : OnGeneralItemRowClickListener {
|
||||||
|
override fun onGeneralItemRowClickListener(item: GeneralItem) {
|
||||||
|
|
||||||
|
listExpeditionScan.remove(item)
|
||||||
|
expeditionScanAdapter?.notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
}, onRowClickListener = object : OnGeneralRowClickListener {
|
||||||
|
override fun onRowClickListener(item: GeneralItem) {
|
||||||
|
getDataForMoveExpeditions(item.code!!)
|
||||||
|
}
|
||||||
|
}, showDelete = true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private val recyclerViewConfigured: RecyclerView by lazy {
|
||||||
|
customDialogList.getRecyclerView().apply {
|
||||||
|
layoutManager =
|
||||||
|
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
|
adapter = expeditionScanAdapter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance(title: String) = RoutesFragment(title)
|
fun newInstance(title: String) = RoutesFragment(title)
|
||||||
|
@ -108,7 +145,7 @@ class RoutesFragment(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun deleteExpeditionsPending(codeState: String) {
|
private fun deleteExpeditionsPending() {
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
db.expedicionDao().getDeleteAllState()
|
db.expedicionDao().getDeleteAllState()
|
||||||
|
@ -137,6 +174,13 @@ class RoutesFragment(
|
||||||
iconInfo.tooltipText = getTooltip(R.drawable.ic_info_delivery)
|
iconInfo.tooltipText = getTooltip(R.drawable.ic_info_delivery)
|
||||||
iconRefresh.tooltipText = getTooltip(R.drawable.ic_info_refresh)
|
iconRefresh.tooltipText = getTooltip(R.drawable.ic_info_refresh)
|
||||||
iconSearch.tooltipText = getTooltip(R.drawable.expedition_find)
|
iconSearch.tooltipText = getTooltip(R.drawable.expedition_find)
|
||||||
|
|
||||||
|
val iconMove = ImageView(context)
|
||||||
|
iconMove.setImageResource(R.drawable.ic_move_expedition)
|
||||||
|
iconMove.tooltipText = getString(R.string.moveExpedition)
|
||||||
|
|
||||||
|
//Tarea 8150
|
||||||
|
// listIcons.add(iconMove)
|
||||||
listIcons.add(iconInfo)
|
listIcons.add(iconInfo)
|
||||||
listIcons.add(iconRefresh)
|
listIcons.add(iconRefresh)
|
||||||
listIcons.add(iconSearch)
|
listIcons.add(iconSearch)
|
||||||
|
@ -164,6 +208,10 @@ class RoutesFragment(
|
||||||
getString(R.string.titleLog)
|
getString(R.string.titleLog)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iconMove.drawable -> {
|
||||||
|
showExpeditionScan()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -173,6 +221,81 @@ class RoutesFragment(
|
||||||
binding.mainToolbar.toolbarIcons.visibility = View.VISIBLE
|
binding.mainToolbar.toolbarIcons.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun showExpeditionScan() {
|
||||||
|
listExpeditionScan.clear()
|
||||||
|
listMyRoutes.clear()
|
||||||
|
expeditionScanAdapter!!.updateItems(listExpeditionScan)
|
||||||
|
expeditionScanAdapter!!.setShowDelete(true)
|
||||||
|
customDialogList.setTitle(getString(R.string.scanExpeditionForMove))
|
||||||
|
.setOkButton(getString(R.string.moveToRoute)) {
|
||||||
|
ma.hideKeyboard(customDialogList.getEditText())
|
||||||
|
customDialogList.dismiss()
|
||||||
|
showRoutes()
|
||||||
|
|
||||||
|
}.setKoButton(getString(R.string.cancel)) {
|
||||||
|
customDialogList.dismiss()
|
||||||
|
requireContext().hideKeyboard(binding.scanInput)
|
||||||
|
}.setValue("").showDialog().show()
|
||||||
|
|
||||||
|
customDialogList.getEditText().requestFocus()
|
||||||
|
ma.hideKeyboard(customDialogList.getEditText())
|
||||||
|
customDialogList.getEditText().setOnEditorActionListener { _, actionId, _ ->
|
||||||
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||||
|
if (customDialogList.getValue().isNotEmpty()) {
|
||||||
|
val expeditionScan = itemScanValue(
|
||||||
|
customDialogList.getValue(), arrayOf("expeditionPallet"), "id"
|
||||||
|
).toString()
|
||||||
|
listExpeditionScan.add(
|
||||||
|
GeneralItem(
|
||||||
|
expeditionScan, expeditionScan
|
||||||
|
)
|
||||||
|
)
|
||||||
|
expeditionScanAdapter?.notifyItemChanged(0)
|
||||||
|
}
|
||||||
|
customDialogList.setValue("")
|
||||||
|
ma.hideKeyboard(customDialogList.getEditText())
|
||||||
|
return@setOnEditorActionListener true
|
||||||
|
}
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
recyclerViewConfigured
|
||||||
|
requireContext().hideKeyboard(customDialogList.getEditText())
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun showRoutes() {
|
||||||
|
listMyRoutes.clear()
|
||||||
|
expeditionScanAdapter!!.updateItems(
|
||||||
|
ArrayList(myListRoute.map { routeInfo ->
|
||||||
|
GeneralItem(
|
||||||
|
code = routeInfo.id.toString(), text = routeInfo.id.toString()
|
||||||
|
)
|
||||||
|
})
|
||||||
|
)
|
||||||
|
expeditionScanAdapter!!.setShowDelete(false)
|
||||||
|
customDialogList.setTitle(getString(R.string.selectRoute))
|
||||||
|
.setKoButton(getString(R.string.cancel)) {
|
||||||
|
customDialogList.dismiss()
|
||||||
|
requireContext().hideKeyboard(binding.scanInput)
|
||||||
|
}.setValue("").hideDialog().show()
|
||||||
|
requireContext().hideKeyboard(customDialogList.getEditText())
|
||||||
|
recyclerViewConfigured
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getDataForMoveExpeditions(routeId: String) {
|
||||||
|
val routeItem = myListRoute.find { it.id == routeId.toLong() }
|
||||||
|
for (expedition in listExpeditionScan) {
|
||||||
|
viewModel.getDataFromExpedition(
|
||||||
|
routeId = routeId.toLong(),
|
||||||
|
expeditionId = expedition.code!!.toLong(),
|
||||||
|
landed = routeItem!!.created.toString()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
customDialogList.dismiss()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private fun setEvents() {
|
private fun setEvents() {
|
||||||
binding.mainToolbar.backButton.setOnClickListener {
|
binding.mainToolbar.backButton.setOnClickListener {
|
||||||
ma.onMyBackPressed()
|
ma.onMyBackPressed()
|
||||||
|
@ -189,7 +312,6 @@ class RoutesFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun afterTextChanged(s: Editable?) {
|
override fun afterTextChanged(s: Editable?) {
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -247,7 +369,7 @@ class RoutesFragment(
|
||||||
|
|
||||||
if (it) {
|
if (it) {
|
||||||
binding.mainToolbar.toolbarIcons.visibility = View.VISIBLE
|
binding.mainToolbar.toolbarIcons.visibility = View.VISIBLE
|
||||||
deleteExpeditionsPending("")
|
deleteExpeditionsPending()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,3 +105,16 @@ data class RouteComplementAdd(
|
||||||
val routeActionFk: Number,
|
val routeActionFk: Number,
|
||||||
val dated: String,
|
val dated: String,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
data class ExpeditionWithTicket(
|
||||||
|
val id: Number,
|
||||||
|
val ticket: TicketExpedition,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
data class TicketExpedition(
|
||||||
|
val clientFk: Number,
|
||||||
|
val warehouseFk: Number,
|
||||||
|
val addressFk: Number,
|
||||||
|
val agencyModeFk: Number
|
||||||
|
)
|
||||||
|
|
|
@ -180,7 +180,8 @@ class RouteInfo(
|
||||||
var finished: String,
|
var finished: String,
|
||||||
var header: Boolean = false,
|
var header: Boolean = false,
|
||||||
//tarea 5867
|
//tarea 5867
|
||||||
var email: String? = null
|
var email: String? = null,
|
||||||
|
var agencyModeFk: Int
|
||||||
) : Serializable {
|
) : Serializable {
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "$driver$id$name$numberPlate$m3$created$hour$"
|
return "$driver$id$name$numberPlate$m3$created$hour$"
|
||||||
|
|
|
@ -21,6 +21,7 @@ import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLog
|
||||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoSummary
|
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoSummary
|
||||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionList
|
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionList
|
||||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionSummaryList
|
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionSummaryList
|
||||||
|
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionWithTicket
|
||||||
import es.verdnatura.presentation.view.feature.delivery.model.FreeLanceDeliveryInfoList
|
import es.verdnatura.presentation.view.feature.delivery.model.FreeLanceDeliveryInfoList
|
||||||
import es.verdnatura.presentation.view.feature.delivery.model.RouteAction
|
import es.verdnatura.presentation.view.feature.delivery.model.RouteAction
|
||||||
import es.verdnatura.presentation.view.feature.delivery.model.RouteActionList
|
import es.verdnatura.presentation.view.feature.delivery.model.RouteActionList
|
||||||
|
@ -135,6 +136,39 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getDataFromExpedition(expeditionId: Number, routeId: Number, landed: String) {
|
||||||
|
salix.getDataFromExpedition(
|
||||||
|
filter = """
|
||||||
|
|{
|
||||||
|
|"where":
|
||||||
|
|{"id":$expeditionId},
|
||||||
|
|"fields":["id","ticketFk"],
|
||||||
|
|"include":
|
||||||
|
|{
|
||||||
|
|"relation":"ticket",
|
||||||
|
|"scope":{
|
||||||
|
|"fields":["clientFk","addressFk","warehouseFk","agencyModeFk"]
|
||||||
|
| }
|
||||||
|
|}
|
||||||
|
|}""".trimMargin()
|
||||||
|
)
|
||||||
|
.enqueue(object : SalixCallback<List<ExpeditionWithTicket>>(context) {
|
||||||
|
override fun onSuccess(response: Response<List<ExpeditionWithTicket>>) {
|
||||||
|
val myTicketData = response.body()!![0]
|
||||||
|
moveExpeditions(
|
||||||
|
clientId = myTicketData.ticket.clientFk,
|
||||||
|
addressId = myTicketData.ticket.addressFk,
|
||||||
|
warehouseId = myTicketData.ticket.warehouseFk,
|
||||||
|
routeId = routeId,
|
||||||
|
agencyModeId = myTicketData.ticket.agencyModeFk,
|
||||||
|
expeditionsId = arrayListOf(expeditionId),
|
||||||
|
landed = landed
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fun addRouteComplements(routeComplementAdd: RouteComplementAdd) {
|
fun addRouteComplements(routeComplementAdd: RouteComplementAdd) {
|
||||||
salix.addRouteComplements(routeComplementAdd)
|
salix.addRouteComplements(routeComplementAdd)
|
||||||
.enqueue(object : SalixCallback<Any>(context) {
|
.enqueue(object : SalixCallback<Any>(context) {
|
||||||
|
@ -144,19 +178,60 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
routeComplementAdd.dated,
|
routeComplementAdd.dated,
|
||||||
DateTimeFormatter.ofPattern("yyyy-MM-dd")
|
DateTimeFormatter.ofPattern("yyyy-MM-dd")
|
||||||
)
|
)
|
||||||
.format(DateTimeFormatter.ofPattern("dd-MM-yyyy"))
|
.format(DateTimeFormatter.ofPattern("dd-MM-yyyy")),
|
||||||
|
workerFk = routeComplementAdd.workerFk
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getRouteComplements(date: String) {
|
fun moveExpeditions(
|
||||||
|
clientId: Number,
|
||||||
|
warehouseId: Number,
|
||||||
|
addressId: Number,
|
||||||
|
agencyModeId: Number,
|
||||||
|
routeId: Number,
|
||||||
|
expeditionsId: ArrayList<Number>,
|
||||||
|
landed: String
|
||||||
|
) {
|
||||||
|
salix.moveExpeditions(
|
||||||
|
clientId, warehouseId, addressId, agencyModeId, routeId, expeditionsId, landed
|
||||||
|
|
||||||
|
).enqueue(object : SalixCallback<Any>(context) {
|
||||||
|
override fun onSuccess(response: Response<Any>) {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getRouteComplements(date: String, workerFk: Number) {
|
||||||
val (startOfDay, endOfDay) = getDayBounds(date)
|
val (startOfDay, endOfDay) = getDayBounds(date)
|
||||||
salix.getRouteComplements(
|
salix.getRouteComplements(
|
||||||
"""{"where": {"dated": {
|
"""{
|
||||||
"between": ["$startOfDay",
|
|"where": {
|
||||||
"$endOfDay"]}},"include":[{"relation":"routeAction","scope":{"fields":{"routeActionFk":true,"name":true}}}]}"""
|
|"and": [
|
||||||
|
|{
|
||||||
|
|"dated": {
|
||||||
|
|"between": ["$startOfDay", "$endOfDay"]
|
||||||
|
|}
|
||||||
|
|},
|
||||||
|
|{
|
||||||
|
|"workerFK": "$workerFk"
|
||||||
|
|}
|
||||||
|
|]
|
||||||
|
|},
|
||||||
|
|"include": [
|
||||||
|
|{
|
||||||
|
|"relation": "routeAction",
|
||||||
|
|"scope": {
|
||||||
|
|"fields": {
|
||||||
|
|"routeActionFk": true,
|
||||||
|
|"name": true
|
||||||
|
|}
|
||||||
|
|}
|
||||||
|
|}
|
||||||
|
|]
|
||||||
|
|}""".trimMargin()
|
||||||
)
|
)
|
||||||
.enqueue(object : SalixCallback<List<RouteComplement>>(context) {
|
.enqueue(object : SalixCallback<List<RouteComplement>>(context) {
|
||||||
override fun onSuccess(response: Response<List<RouteComplement>>) {
|
override fun onSuccess(response: Response<List<RouteComplement>>) {
|
||||||
|
@ -167,11 +242,11 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun routeComplementDelete(id: Number, date: String) {
|
fun routeComplementDelete(id: Number, date: String, workerFk: Number) {
|
||||||
salix.routeComplementDelete(id)
|
salix.routeComplementDelete(id)
|
||||||
.enqueue(object : SalixCallback<Any>(context) {
|
.enqueue(object : SalixCallback<Any>(context) {
|
||||||
override fun onSuccess(response: Response<Any>) {
|
override fun onSuccess(response: Response<Any>) {
|
||||||
getRouteComplements(date)
|
getRouteComplements(date, workerFk)
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="960"
|
||||||
|
android:viewportHeight="960"
|
||||||
|
android:tint="?attr/colorOnPrimaryFixed">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M280,840L280,597Q280,597 280,597Q280,597 280,597Q192,583 136,515.5Q80,448 80,360Q80,260 150,190Q220,120 320,120Q408,120 475.5,176Q543,232 557,320Q557,320 557,320Q557,320 557,320L727,320L664,256L720,200L880,360L720,520L663,464L727,400L556,400Q527,400 505,381Q483,362 478,333Q468,275 423.5,237.5Q379,200 320,200Q254,200 207,247Q160,294 160,360Q160,419 197.5,463.5Q235,508 293,518Q322,523 341,545Q360,567 360,596L360,840L280,840Z"/>
|
||||||
|
</vector>
|
|
@ -897,6 +897,11 @@
|
||||||
<string name="salarySupplementTitle">Complementos salariales reparto</string>
|
<string name="salarySupplementTitle">Complementos salariales reparto</string>
|
||||||
<string name="complement">Tus complementos:</string>
|
<string name="complement">Tus complementos:</string>
|
||||||
<string name="supplementDelivery">Complementos reparto</string>
|
<string name="supplementDelivery">Complementos reparto</string>
|
||||||
|
<string name="moveExpedition">Mueve expedición/es a otra ruta</string>
|
||||||
|
<string name="boxScanned">Caja ya escaneada</string>
|
||||||
|
<string name="selectRoute">Selecciona ruta destino</string>
|
||||||
|
<string name="moveToRoute">Mover a nueva ruta</string>
|
||||||
|
<string name="scanExpeditionForMove">Escanea la/s caja/s que cambia/n de ruta</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -897,5 +897,10 @@
|
||||||
<string name="salarySupplementTitle">Complementos salariales reparto</string>
|
<string name="salarySupplementTitle">Complementos salariales reparto</string>
|
||||||
<string name="complement">Tus complementos:</string>
|
<string name="complement">Tus complementos:</string>
|
||||||
<string name="supplementDelivery">Complementos reparto</string>
|
<string name="supplementDelivery">Complementos reparto</string>
|
||||||
|
<string name="moveExpedition">Mueve expedición/es a otra ruta</string>
|
||||||
|
<string name="boxScanned">Caja ya escaneada</string>
|
||||||
|
<string name="selectRoute">Selecciona ruta destino</string>
|
||||||
|
<string name="moveToRoute">Mover a nueva ruta</string>
|
||||||
|
<string name="scanExpeditionForMove">Escanea la/s caja/s que cambia/n de ruta</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -897,5 +897,10 @@
|
||||||
<string name="salarySupplementTitle">Complementos salariales reparto</string>
|
<string name="salarySupplementTitle">Complementos salariales reparto</string>
|
||||||
<string name="complement">Tus complementos:</string>
|
<string name="complement">Tus complementos:</string>
|
||||||
<string name="supplementDelivery">Complementos reparto</string>
|
<string name="supplementDelivery">Complementos reparto</string>
|
||||||
|
<string name="moveExpedition">Mueve expedición/es a otra ruta</string>
|
||||||
|
<string name="boxScanned">Caja ya escaneada</string>
|
||||||
|
<string name="selectRoute">Selecciona ruta destino</string>
|
||||||
|
<string name="moveToRoute">Mover a nueva ruta</string>
|
||||||
|
<string name="scanExpeditionForMove">Escanea la/s caja/s que cambia/n de ruta</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -900,5 +900,10 @@
|
||||||
<string name="salarySupplementTitle">Complementos salariales reparto</string>
|
<string name="salarySupplementTitle">Complementos salariales reparto</string>
|
||||||
<string name="complement">Tus complementos:</string>
|
<string name="complement">Tus complementos:</string>
|
||||||
<string name="supplementDelivery">Complementos reparto</string>
|
<string name="supplementDelivery">Complementos reparto</string>
|
||||||
|
<string name="moveExpedition">Mueve expedición/es a otra ruta</string>
|
||||||
|
<string name="boxScanned">Caja ya escaneada</string>
|
||||||
|
<string name="selectRoute">Selecciona ruta destino</string>
|
||||||
|
<string name="moveToRoute">Mover a nueva ruta</string>
|
||||||
|
<string name="scanExpeditionForMove">Escanea la/s caja/s que cambia/n de ruta</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in New Issue