feat: refactorResponse Delivery, Inventary,historical refs #7827
This commit is contained in:
parent
bcecf2ed6c
commit
6dc39d6611
|
@ -69,7 +69,6 @@ class ControlVehiculoViewModel(val context: Context) : BaseViewModel(context) {
|
|||
.enqueue(object : SalixCallback<List<DeviceId>>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<List<DeviceId>>) {
|
||||
if (response.body() != null) {
|
||||
|
||||
_responseMachine.value =
|
||||
ResponseItemMachineControl(
|
||||
|
@ -80,7 +79,6 @@ class ControlVehiculoViewModel(val context: Context) : BaseViewModel(context) {
|
|||
},
|
||||
type = "getnameDevice"
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class SummaryFragment(
|
|||
var route: Int = 0,
|
||||
) : BaseFragment<FragmentExpeditionSummaryBinding, DeliveryViewModel>(
|
||||
DeliveryViewModel::class
|
||||
) , AdapterCallback {
|
||||
), AdapterCallback {
|
||||
|
||||
private var adapter: ExpeditionSummaryAdapter? = null
|
||||
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
||||
|
@ -47,9 +47,10 @@ class SummaryFragment(
|
|||
private var isScanning = false
|
||||
private var positionSelected = -1
|
||||
|
||||
override fun getPosition():Int {
|
||||
override fun getPosition(): Int {
|
||||
return positionSelected
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun newInstance(title: String, state: String, route: Int) =
|
||||
SummaryFragment(title, state, route)
|
||||
|
@ -62,13 +63,12 @@ class SummaryFragment(
|
|||
setEvents()
|
||||
setToolBar()
|
||||
binding.scanInput.requestFocus()
|
||||
callBack(viewModel.routeGetExpeditionSummary(route))
|
||||
viewModel.routeGetExpeditionSummary(route)
|
||||
routeSelected = route
|
||||
setViews()
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun onResume() {
|
||||
if (binding.mainToolbar.toolbarTitle.text != getString(R.string.titleDeliverySummary)) {
|
||||
binding.scanInput.isEnabled = true
|
||||
|
@ -79,10 +79,6 @@ class SummaryFragment(
|
|||
|
||||
}
|
||||
|
||||
private fun callBack(routeGetexpeditionsummary: Unit) {
|
||||
return routeGetexpeditionsummary
|
||||
}
|
||||
|
||||
private fun setViews() {
|
||||
binding.expeditionSummaryRecyclerview.addOnScrollListener(object :
|
||||
RecyclerView.OnScrollListener() {
|
||||
|
@ -168,10 +164,8 @@ class SummaryFragment(
|
|||
if (list.filter { it.addressFk == address }
|
||||
.filter { it.code == state }.size == list.filter { it.addressFk == address }.size) {
|
||||
counterCalls = 1
|
||||
callBack(
|
||||
viewModel.expeditionStateAddSalix(
|
||||
hashMapOf("expeditions" to listExpedition.filter { it.stateCode == state })
|
||||
)
|
||||
viewModel.expeditionStateAddSalix(
|
||||
hashMapOf("expeditions" to listExpedition.filter { it.stateCode == state })
|
||||
)
|
||||
|
||||
isScanning = false
|
||||
|
@ -212,7 +206,9 @@ class SummaryFragment(
|
|||
event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER
|
||||
try {
|
||||
markExpedition(
|
||||
binding.scanInput.text.toString().toInt(), state, if (isScanned) 1 else 0
|
||||
binding.scanInput.text.toString().toInt(),
|
||||
state,
|
||||
if (isScanned) 1 else 0
|
||||
)
|
||||
|
||||
} catch (ex: Exception) {
|
||||
|
@ -228,7 +224,7 @@ class SummaryFragment(
|
|||
|
||||
}
|
||||
|
||||
private fun markExpedition(expedNumber: Int, state: String, isScanned : Int) {
|
||||
private fun markExpedition(expedNumber: Int, state: String, isScanned: Int) {
|
||||
var found = false
|
||||
if (myList.filter { it.addressFk == addressFkSelected }.filter { it.id == expedNumber }
|
||||
.any { it.code == state }) {
|
||||
|
@ -285,7 +281,7 @@ class SummaryFragment(
|
|||
if (!it.isError) {
|
||||
counterResponse += 1
|
||||
if (counterResponse == counterCalls) {
|
||||
callBack(viewModel.routeGetExpeditionSummary(routeSelected))
|
||||
viewModel.routeGetExpeditionSummary(routeSelected)
|
||||
counterResponse = 0
|
||||
counterCalls = 0
|
||||
checkNextAddress()
|
||||
|
@ -339,7 +335,7 @@ class SummaryFragment(
|
|||
|
||||
if (addressFkSelected != item.addressFk && !isScanning) {
|
||||
|
||||
callBack(viewModel.getExpeditionFromRoute(routeSelected))
|
||||
viewModel.getExpeditionFromRoute(routeSelected)
|
||||
|
||||
}
|
||||
if (addressFkSelected != item.addressFk && isScanning) {
|
||||
|
@ -348,7 +344,7 @@ class SummaryFragment(
|
|||
}
|
||||
addressFkSelected = item.addressFk
|
||||
isScanning = false
|
||||
callBack(viewModel.getExpeditionFromRoute(routeSelected))
|
||||
viewModel.getExpeditionFromRoute(routeSelected)
|
||||
adapter!!.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
|
@ -361,7 +357,7 @@ class SummaryFragment(
|
|||
binding.expeditionSummaryRecyclerview.adapter = adapter
|
||||
binding.expeditionSummaryRecyclerview.layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
adapter!!.notifyDataSetChanged()
|
||||
adapter!!.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
private fun createList(list: MutableList<ExpeditionInfoLoadUnload>) {
|
||||
|
|
|
@ -68,24 +68,23 @@ class TicketsFragment : BaseFragment<FragmentTicketsBinding, DeliveryViewModel>(
|
|||
private var firstVisibleItemPosition = -1
|
||||
|
||||
companion object {
|
||||
//Tarea 6810 revisar fallos app
|
||||
//Tarea 6810 revisar fallos app
|
||||
private const val ARG_TITLE = "title"
|
||||
private const val ARG_ROUTE = "route"
|
||||
private const val REQUEST_CALL_PERMISSION = 1
|
||||
|
||||
fun newInstance(title: String, entryPoint: String) =
|
||||
TicketsFragment().apply {
|
||||
arguments = Bundle().apply {
|
||||
putString(ARG_TITLE, title)
|
||||
putString(ARG_ROUTE, entryPoint)
|
||||
}
|
||||
fun newInstance(title: String, entryPoint: String) = TicketsFragment().apply {
|
||||
arguments = Bundle().apply {
|
||||
putString(ARG_TITLE, title)
|
||||
putString(ARG_ROUTE, entryPoint)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* fun newInstance(title: String, entryPoint: String) =
|
||||
TicketsFragment(title, Gson().fromJson(entryPoint, RouteInfo::class.java))*/
|
||||
/* fun newInstance(title: String, entryPoint: String) =
|
||||
TicketsFragment(title, Gson().fromJson(entryPoint, RouteInfo::class.java))*/
|
||||
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
arguments?.let {
|
||||
|
@ -93,6 +92,7 @@ class TicketsFragment : BaseFragment<FragmentTicketsBinding, DeliveryViewModel>(
|
|||
route = Gson().fromJson(it.getString(ARG_ROUTE), RouteInfo::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int = R.layout.fragment_tickets
|
||||
|
||||
override fun init() {
|
||||
|
@ -102,6 +102,7 @@ class TicketsFragment : BaseFragment<FragmentTicketsBinding, DeliveryViewModel>(
|
|||
binding.mainToolbar.toolbarTitle.text = route.name
|
||||
viewModel.getTickets(route.id)
|
||||
db = database(requireContext().applicationContext)
|
||||
println("tickets in ")
|
||||
|
||||
}
|
||||
|
||||
|
@ -418,7 +419,6 @@ class TicketsFragment : BaseFragment<FragmentTicketsBinding, DeliveryViewModel>(
|
|||
R.string.titleUnLoadTruck
|
||||
)
|
||||
), entryPoint, myListClientTicket.filter { it.id == item.id })
|
||||
|
||||
}
|
||||
|
||||
"map" -> {
|
||||
|
@ -510,7 +510,6 @@ class TicketsFragment : BaseFragment<FragmentTicketsBinding, DeliveryViewModel>(
|
|||
customDialogInput.getRecyclerView().layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
customDialogInput.setOkButton(getString(R.string.save)) {
|
||||
//tarea 6921
|
||||
if (itemClient.observationDropOff == null) {
|
||||
viewModel.addFropOff(
|
||||
ticketFK = itemClient.id,
|
||||
|
@ -522,7 +521,7 @@ class TicketsFragment : BaseFragment<FragmentTicketsBinding, DeliveryViewModel>(
|
|||
itemClient.id, description = customDialogInput.getValue()
|
||||
)
|
||||
}
|
||||
// viewModel.addNotes(itemClient.tickets, customDialogInput.getValue())
|
||||
|
||||
customDialogInput.dismiss()
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
customDialogInput.cancel()
|
||||
|
@ -530,9 +529,6 @@ class TicketsFragment : BaseFragment<FragmentTicketsBinding, DeliveryViewModel>(
|
|||
}
|
||||
customDialogInput.show()
|
||||
|
||||
/* firstVisibleItemPosition =
|
||||
(binding.ticketsRecyclerview.layoutManager as LinearLayoutManager).findFirstCompletelyVisibleItemPosition()*/
|
||||
|
||||
}
|
||||
|
||||
fun showNotes(clientClicked: ClientTicketSalix) {
|
||||
|
|
|
@ -13,10 +13,6 @@ class FreeLanceDeliveryInfoList(
|
|||
var list: List<DeliveryInfo> = listOf()
|
||||
)
|
||||
|
||||
class CompanyInfoList(
|
||||
var list: List<DeliveryInfo> = listOf()
|
||||
)
|
||||
|
||||
class DeliveryInfo(
|
||||
var name: String? = null,
|
||||
var street: String? = null,
|
||||
|
|
|
@ -63,8 +63,8 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
val responseStateAdd: LiveData<ResponseItemVO>
|
||||
get() = _responseStateAdd
|
||||
|
||||
private val _responseUpdateRoute by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseUpdateRoute: LiveData<ResponseItemVO>
|
||||
private val _responseUpdateRoute by lazy { MutableLiveData<Boolean>() }
|
||||
val responseUpdateRoute: LiveData<Boolean>
|
||||
get() = _responseUpdateRoute
|
||||
|
||||
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
|
@ -308,16 +308,11 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
salix.routeUpdate(route.id, route).enqueue(object : SalixCallback<Any>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_responseUpdateRoute.value = ResponseItemVO()
|
||||
_responseUpdateRoute.value = true
|
||||
super.onSuccess(response)
|
||||
|
||||
}
|
||||
|
||||
override fun onError(t: Throwable) {
|
||||
_responseUpdateRoute.value = ResponseItemVO()
|
||||
super.onError(t)
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ class ShelvingLogFragment(
|
|||
customDialog.dismiss()
|
||||
}.show()
|
||||
} else {
|
||||
openViewer(it.list[0].id!!, "shelving")
|
||||
openWebViewer(it.list[0].id!!, "shelving")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,14 +109,14 @@ class ShelvingLogFragment(
|
|||
loadResponseParking.observe(viewLifecycleOwner) { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
setToolBar(getString(R.string.parking) + ":" + itemScan)
|
||||
openViewer(it, "parking")
|
||||
openWebViewer(it, "parking")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun openViewer(param: Int, web: String) {
|
||||
private fun openWebViewer(param: Int, web: String) {
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title = getString(R.string.titleWebViewer),
|
||||
|
|
|
@ -121,7 +121,6 @@ class InventaryParkingFragment(
|
|||
if (!onBackPressedHandled()) {
|
||||
isEnabled = false
|
||||
requireActivity().onBackPressedDispatcher
|
||||
} else {
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -729,13 +728,12 @@ class InventaryParkingFragment(
|
|||
|
||||
override fun onBackPressedHandled(): Boolean {
|
||||
|
||||
|
||||
if (shelvingSaved.isBlank()) {
|
||||
return if (shelvingSaved.isBlank()) {
|
||||
ma.onMyBackPressed()
|
||||
return false
|
||||
false
|
||||
} else {
|
||||
resetChecking()
|
||||
return true
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
|
@ -37,8 +37,8 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
val inventaryList: LiveData<InventaryListVO>
|
||||
get() = _inventaryList
|
||||
|
||||
private val _response by lazy { MutableLiveData<Any>() }
|
||||
val response: LiveData<Any>
|
||||
private val _response by lazy { MutableLiveData<Boolean>() }
|
||||
val response: LiveData<Boolean>
|
||||
get() = _response
|
||||
|
||||
private val _responseReset by lazy { MutableLiveData<String>() }
|
||||
|
@ -139,7 +139,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
salix.setVisibleDiscard(ItemDiscardSalixShortage(itemFk, warehouseFk, newValue, null))
|
||||
.enqueue(object : SalixCallback<Any>(context) {
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_response.value = ResponseItemVO(isError = false, response = response.message())
|
||||
_response.value = true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ import es.verdnatura.presentation.common.OnStopMapClickListener
|
|||
import es.verdnatura.presentation.common.OnTruckClickListener
|
||||
import es.verdnatura.presentation.common.TAG
|
||||
import es.verdnatura.presentation.common.addFragment
|
||||
import es.verdnatura.presentation.view.commom.WebFragment
|
||||
import es.verdnatura.presentation.view.component.CustomDialogMainActivity
|
||||
import es.verdnatura.presentation.view.feature.ajustes.fragment.AjustesFragment
|
||||
import es.verdnatura.presentation.view.feature.articulo.fragment.ItemCardFragment
|
||||
|
@ -69,7 +70,6 @@ import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFra
|
|||
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPreCheckerNew
|
||||
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionShowTicketFragment
|
||||
import es.verdnatura.presentation.view.feature.controlador.fragment.ControladorFragment
|
||||
import es.verdnatura.presentation.view.commom.WebFragment
|
||||
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoFragment
|
||||
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoUsuarioFragment
|
||||
import es.verdnatura.presentation.view.feature.delivery.fragments.InfoFragment
|
||||
|
@ -839,7 +839,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
LoadUnloadFragment.newInstance(
|
||||
item.title, "DELIVERED", entryPoint,
|
||||
param as? ArrayList<ClientTicketSalix>
|
||||
), getString(R.string.titleUnLoadTruck), delete = true
|
||||
), getString(R.string.titleUnLoadTruck)
|
||||
)
|
||||
|
||||
}
|
||||
|
@ -1087,23 +1087,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
|
||||
}
|
||||
|
||||
fun openFragmentUnload(delete: Boolean) {
|
||||
//delete_Fragments()
|
||||
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
if (delete) {
|
||||
delete_Fragments()
|
||||
}
|
||||
addFragment(
|
||||
SacadorFragment.newInstance("PREPARED"),
|
||||
R.id.main_frame_layout,
|
||||
SacadorFragment.TAG,
|
||||
true
|
||||
|
||||
)
|
||||
//addFragmentOnTop(SacadorFragment.newInstance())
|
||||
|
||||
}
|
||||
|
||||
fun openFragmentExpeditionState() {
|
||||
addFragmentOnTop(ExpeditionStateFragment.newInstance(getString(R.string.titleExpeditionState)))
|
||||
|
||||
|
|
Loading…
Reference in New Issue