refs #5891 inventoryParking
This commit is contained in:
parent
e4fc2cdc6e
commit
c014dbfd2d
|
@ -228,6 +228,10 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
R.drawable.expedition_find -> getString(R.string.showLogExpedition)
|
||||
R.drawable.ic_info_refresh -> getString(R.string.udpateRoutes)
|
||||
R.drawable.ic_info_delivery -> getString(R.string.info)
|
||||
R.drawable.ic_filter_inventory -> getString(R.string.filterNoReview)
|
||||
R.drawable.ic_remove_checks->getString(R.string.resetReviewItems)
|
||||
R.drawable.ic_eye_inventory -> getString(R.string.inventoryShowParking)
|
||||
|
||||
else -> {
|
||||
""
|
||||
}
|
||||
|
|
|
@ -40,7 +40,10 @@ class InventoryParkingAdapter(
|
|||
fun getListItems(): List<ItemInventoryParking> {
|
||||
return items
|
||||
}
|
||||
|
||||
fun setItems(newItems: List<ItemInventoryParking>) {
|
||||
items = newItems
|
||||
notifyDataSetChanged() // Notificar al adaptador que los datos han cambiado
|
||||
}
|
||||
fun sortBy(fieldSort: String) {
|
||||
when (fieldSort) {
|
||||
"sector" -> {
|
||||
|
|
|
@ -11,6 +11,7 @@ import android.view.View.VISIBLE
|
|||
import android.view.inputmethod.EditorInfo
|
||||
import android.widget.ImageView
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
|
@ -18,6 +19,7 @@ import com.google.gson.JsonArray
|
|||
import com.google.gson.JsonObject
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentInventoryParkingBinding
|
||||
import es.verdnatura.domain.notNull
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.*
|
||||
|
@ -62,6 +64,9 @@ class InventaryParkingFragment(
|
|||
private var positionShelvingChecking: Int = -1
|
||||
private var positionItemChecking: Int = -1
|
||||
private var scrollPosition = 0
|
||||
private var parkingFrom = ""
|
||||
private var parkingTo = ""
|
||||
private var filterActivated = false
|
||||
|
||||
companion object {
|
||||
fun newInstance(title: String) =
|
||||
|
@ -71,12 +76,17 @@ class InventaryParkingFragment(
|
|||
override fun getLayoutId(): Int = R.layout.fragment_inventory_parking
|
||||
override fun onPause() {
|
||||
|
||||
try {
|
||||
val layoutManager =
|
||||
binding.inventoryParkingRecyclerview.layoutManager as LinearLayoutManager
|
||||
scrollPosition = layoutManager.findFirstVisibleItemPosition()
|
||||
}catch (exception:Exception){
|
||||
|
||||
}
|
||||
|
||||
super.onPause()
|
||||
isBack = true
|
||||
super.onPause()
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -98,6 +108,9 @@ class InventaryParkingFragment(
|
|||
setEvents()
|
||||
setViews()
|
||||
setToolBar()
|
||||
if (!isBack) {
|
||||
setParkingFromTo()
|
||||
}
|
||||
super.init()
|
||||
}
|
||||
|
||||
|
@ -127,19 +140,22 @@ class InventaryParkingFragment(
|
|||
val iconReset = ImageView(context)
|
||||
iconReset.setImageResource(R.drawable.ic_remove_checks)
|
||||
|
||||
val iconFilter = ImageView(context)
|
||||
iconFilter.setImageResource(R.drawable.ic_filter_inventory)
|
||||
|
||||
val iconParkingFrom = ImageView(context)
|
||||
iconParkingFrom.setImageResource(R.drawable.ic_eye_ui)
|
||||
iconParkingFrom.setImageResource(R.drawable.ic_eye_inventory)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
iconParkingFrom.tooltipText = getTooltip(R.drawable.ic_eye_ui)
|
||||
iconParkingFrom.tooltipText = getTooltip(R.drawable.ic_eye_inventory)
|
||||
iconReload.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp)
|
||||
iconAdd.tooltipText = getString(R.string.addItemShelving)
|
||||
iconReset.tooltipText = getTooltip(R.drawable.ic_remove_checks)
|
||||
iconFilter.tooltipText = getTooltip(R.drawable.ic_filter_inventory)
|
||||
|
||||
}
|
||||
listIcons.add(iconParkingFrom)
|
||||
//listIcons.add(iconAdd)
|
||||
//listIcons.add(iconReload)
|
||||
listIcons.add(iconFilter)
|
||||
listIcons.add(iconReset)
|
||||
|
||||
|
||||
|
@ -148,22 +164,41 @@ class InventaryParkingFragment(
|
|||
override fun onOptionsItemSelected(item: Drawable) {
|
||||
|
||||
when (item) {
|
||||
iconAdd.drawable -> {
|
||||
// adapter!!.sortBy("sector")
|
||||
|
||||
iconFilter.drawable -> {
|
||||
try {
|
||||
filterActivated = !filterActivated
|
||||
adapter!!.setItems(
|
||||
if (filterActivated) {
|
||||
myListInventory.filter { it.isChecked == null || it.isChecked == 0 }
|
||||
} else {
|
||||
myListInventory
|
||||
}
|
||||
)
|
||||
iconFilter.drawable.setTint(
|
||||
ContextCompat.getColor(
|
||||
context!!,
|
||||
if (filterActivated) R.color.verdnatura_pumpkin_orange else R.color.verdnatura_white
|
||||
)
|
||||
)
|
||||
|
||||
} catch (ex: Exception) {
|
||||
}
|
||||
|
||||
iconReload.drawable -> {
|
||||
|
||||
// adapter!!.sortBy("buyer")
|
||||
}
|
||||
|
||||
iconReset.drawable -> {
|
||||
if (!myListInventory.isNullOrEmpty()) {
|
||||
binding.textinputlayoutMatricula.visibility = VISIBLE
|
||||
showResetShelving()
|
||||
} else {
|
||||
"La lista del inventario está vacía".toast(requireContext())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
iconParkingFrom.drawable -> {
|
||||
binding.textinputlayoutMatricula.visibility = VISIBLE
|
||||
|
||||
setParkingFromTo()
|
||||
}
|
||||
|
||||
|
@ -175,6 +210,10 @@ class InventaryParkingFragment(
|
|||
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||
}
|
||||
|
||||
private fun filterList() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
private fun showResetShelving() {
|
||||
customDialogInput.setFocusText()
|
||||
customDialogInput.setInputText(InputType.TYPE_CLASS_TEXT)
|
||||
|
@ -217,7 +256,10 @@ class InventaryParkingFragment(
|
|||
|
||||
filter.add("id", JsonObject().apply { add("inq", inqValues) })
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
viewModel.itemShelvingsUpdate(filter, ItemShelvingChecked(null))
|
||||
viewModel.itemShelvingsUpdate(
|
||||
filter,
|
||||
ItemShelvingChecked(null, mobileApplication.userId!!)
|
||||
)
|
||||
}
|
||||
ma.hideKeyboard(customDialogInput.getEditText())
|
||||
customDialogInput.setValue("")
|
||||
|
@ -227,30 +269,34 @@ class InventaryParkingFragment(
|
|||
}
|
||||
|
||||
private fun setParkingFromTo() {
|
||||
|
||||
binding.textinputlayoutMatricula.visibility = VISIBLE
|
||||
customDialogList.setTitle(getString(R.string.selectParkingsCheckin))
|
||||
customDialogList.setDescription(getString(R.string.selectParkingsFrom))
|
||||
|
||||
.setOkButton(
|
||||
/* .setOkButton(
|
||||
getString(R.string.review)
|
||||
) {
|
||||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
|
||||
if (listParkings.size == 1) {
|
||||
viewModel.ItemListInventoryParking(
|
||||
listParkings.first().code!!,
|
||||
customDialogList.getValue()
|
||||
if (listParkings.size == 2) {
|
||||
|
||||
callGetInventory(
|
||||
listParkings.first().code!!.uppercase(),
|
||||
customDialogList.getValue().uppercase()
|
||||
)
|
||||
|
||||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
listParkings.clear()
|
||||
customDialogList.dismiss()
|
||||
binding.editMatricula.requestFocus()
|
||||
} else {
|
||||
listParkings.add(0, BarcodeVO(code = customDialogList.getValue()))
|
||||
customDialogList.setValue("")
|
||||
customDialogList.setDescription(getString(R.string.selectParkingsTo))
|
||||
}
|
||||
|
||||
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
}*/.setKoButton(getString(R.string.cancel)) {
|
||||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
listParkings = ArrayList()
|
||||
customDialogList.dismiss()
|
||||
|
@ -265,15 +311,18 @@ class InventaryParkingFragment(
|
|||
try {
|
||||
|
||||
if (listParkings.size == 1) {
|
||||
viewModel.ItemListInventoryParking(
|
||||
listParkings.first().code!!,
|
||||
customDialogList.getValue()
|
||||
callGetInventory(
|
||||
listParkings.first().code!!.uppercase(),
|
||||
customDialogList.getValue().uppercase()
|
||||
)
|
||||
|
||||
|
||||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
listParkings.clear()
|
||||
customDialogList.dismiss()
|
||||
binding.editMatricula.requestFocus()
|
||||
} else {
|
||||
customDialogList.setDescription(getString(R.string.selectParkingsTo))
|
||||
listParkings.add(0, BarcodeVO(code = customDialogList.getValue()))
|
||||
}
|
||||
|
||||
|
@ -306,10 +355,22 @@ class InventaryParkingFragment(
|
|||
|
||||
}
|
||||
|
||||
private fun callGetInventory(parkingFromScan: String, parkingToScan: String) {
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
parkingFrom = parkingFromScan
|
||||
parkingTo = parkingToScan
|
||||
viewModel.getInventoryParking(
|
||||
parkingFromScan,
|
||||
parkingToScan
|
||||
)
|
||||
binding.mainToolbar.toolbarTitle.text = "$parkingFrom → $parkingTo"
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun setEvents() {
|
||||
binding.mainToolbar.backButton.setOnClickListener {
|
||||
isBack = true
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
|
||||
|
@ -320,9 +381,21 @@ class InventaryParkingFragment(
|
|||
|
||||
if (!binding.editMatricula.text.toString().isEmpty()) {
|
||||
|
||||
|
||||
if (positionShelvingChecking == -1) {
|
||||
|
||||
try {
|
||||
binding.editMatricula.setText(
|
||||
itemScanValue(
|
||||
binding.editMatricula.text.toString(),
|
||||
"buy",
|
||||
"more"
|
||||
).toString()
|
||||
)
|
||||
} catch (ex: Exception) {
|
||||
ex.message!!.toast(requireContext())
|
||||
|
||||
}
|
||||
|
||||
positionShelvingChecking = myListInventory.indexOfFirst { item ->
|
||||
item.shelvingFk == binding.editMatricula.text.toString()
|
||||
}
|
||||
|
@ -339,14 +412,96 @@ class InventaryParkingFragment(
|
|||
binding.editMatricula.hint = getString(R.string.scanItemForChecking)
|
||||
}
|
||||
} else {
|
||||
|
||||
try {
|
||||
positionItemChecking = myListInventory.indexOfFirst { item ->
|
||||
|
||||
viewModel.getIdFromCodeSalix(
|
||||
code = itemScanValue(
|
||||
binding.editMatricula.text.toString(),
|
||||
"buy",
|
||||
"more"
|
||||
).toString()
|
||||
)
|
||||
|
||||
|
||||
/* binding.editMatricula.setText(
|
||||
itemScanValue(
|
||||
binding.editMatricula.text.toString(),
|
||||
"buy",
|
||||
"more"
|
||||
).toString()
|
||||
)*/
|
||||
|
||||
|
||||
/* positionItemChecking = myListInventory.indexOfFirst { item ->
|
||||
item.itemFk == binding.editMatricula.text.toString()
|
||||
.toInt() && item.shelvingFk == myListInventory[positionShelvingChecking].shelvingFk && item.isChecked == null
|
||||
}
|
||||
}*/
|
||||
} catch (ex: Exception) {
|
||||
ma.messageWithSound("", true, true, "", null)
|
||||
ma.messageWithSound(ex.message!!, true, true, "", null)
|
||||
}
|
||||
|
||||
//fun checkItem al obterner el code de Salix
|
||||
|
||||
/* if (positionItemChecking == -1) {
|
||||
ma.messageWithSound(
|
||||
getString(R.string.itemNotFoundScanAgain),
|
||||
true,
|
||||
true,
|
||||
"",
|
||||
true
|
||||
)
|
||||
positionShelvingChecking = -1
|
||||
binding.editMatricula.hint = getString(R.string.scanShelvingAgain)
|
||||
} else {
|
||||
|
||||
try {
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
|
||||
//SE pone en el response
|
||||
viewModel.itemShelvingUpdate(
|
||||
myListInventory[positionItemChecking].id,
|
||||
ItemShelvingChecked(true, mobileApplication.userId!!)
|
||||
)
|
||||
myListInventory[positionItemChecking].isChecked = 1
|
||||
adapter!!.notifyDataSetChanged()
|
||||
binding.editMatricula.hint = getString(R.string.scanShelving)
|
||||
positionItemChecking = -1
|
||||
positionShelvingChecking = -1
|
||||
|
||||
/* viewModel.getIdFromCodeSalix(
|
||||
code = itemScanValue(
|
||||
binding.editMatricula.text.toString(),
|
||||
"buy",
|
||||
"more"
|
||||
).toString())*/
|
||||
|
||||
} catch (Ex: Exception) {
|
||||
ma.messageWithSound(Ex.message.toString(), true, true)
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||
binding.editMatricula.setText("")
|
||||
ma.hideKeyboard(binding.editMatricula)
|
||||
}
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
return@setOnEditorActionListener false
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private fun checkItem(itemCode: String) {
|
||||
|
||||
positionItemChecking = myListInventory.indexOfFirst { item ->
|
||||
item.itemFk == itemCode
|
||||
.toInt() && item.shelvingFk == myListInventory[positionShelvingChecking].shelvingFk && item.isChecked == null
|
||||
}
|
||||
|
||||
|
||||
if (positionItemChecking == -1) {
|
||||
ma.messageWithSound(
|
||||
getString(R.string.itemNotFoundScanAgain),
|
||||
|
@ -360,155 +515,26 @@ class InventaryParkingFragment(
|
|||
} else {
|
||||
|
||||
try {
|
||||
/* binding.splashProgress.visibility = VISIBLE
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
|
||||
//SE pone en el response
|
||||
viewModel.itemShelvingUpdate(
|
||||
myListInventory.get(positionItemChecking).id,
|
||||
ItemShelvingChecked(true)
|
||||
)*/
|
||||
myListInventory[positionItemChecking].id,
|
||||
ItemShelvingChecked(true, mobileApplication.userId!!)
|
||||
)
|
||||
myListInventory[positionItemChecking].isChecked = 1
|
||||
adapter!!.notifyDataSetChanged()
|
||||
binding.editMatricula.hint = getString(R.string.scanShelving)
|
||||
positionItemChecking = -1
|
||||
positionShelvingChecking = -1
|
||||
|
||||
/* viewModel.getIdFromCode(
|
||||
code = itemScanValue(
|
||||
binding.editMatricula.text.toString(),
|
||||
"buy",
|
||||
"more"
|
||||
).toString()
|
||||
)*/
|
||||
} catch (Ex: Exception) {
|
||||
ma.messageWithSound(Ex.message.toString(), true, true)
|
||||
}
|
||||
|
||||
} catch (ex: Exception) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
binding.editMatricula.setText("")
|
||||
ma.hideKeyboard(binding.editMatricula)
|
||||
}
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
return@setOnEditorActionListener false
|
||||
}
|
||||
|
||||
binding.parkingImg.setOnClickListener {
|
||||
customDialogInput.setTitle(getString(R.string.parkingShelving)).setValue("")
|
||||
.setOkButton(
|
||||
getString(
|
||||
R.string.parking
|
||||
)
|
||||
) {
|
||||
|
||||
parking = customDialogInput.getValue()
|
||||
binding.mainToolbar.toolbarTitle.text =
|
||||
shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString(
|
||||
R.string.label
|
||||
) + etiquetas
|
||||
customDialogInput.dismiss()
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
customDialogInput.dismiss()
|
||||
}.show()
|
||||
|
||||
customDialogInput.getEditText().requestFocus()
|
||||
ma.hideKeyboard(customDialogInput.getEditText())
|
||||
|
||||
customDialogInput.getEditText()
|
||||
.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
|
||||
customDialogInput.dismiss()
|
||||
parking = customDialogInput.getValue()
|
||||
binding.mainToolbar.toolbarTitle.text =
|
||||
shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString(
|
||||
R.string.label
|
||||
) + etiquetas
|
||||
|
||||
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
binding.editImg.setOnClickListener {
|
||||
customDialogInput.setTitle(getString(R.string.changeShelving)).setValue("")
|
||||
.setOkButton(getString(R.string.save)) {
|
||||
|
||||
shelvingFk = customDialogInput.getValue()
|
||||
binding.mainToolbar.toolbarTitle.text =
|
||||
shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString(
|
||||
R.string.label
|
||||
) + etiquetas
|
||||
if (mpok != null) mpok!!.start()
|
||||
customDialogInput.dismiss()
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
customDialogInput.dismiss()
|
||||
}.show()
|
||||
|
||||
customDialogInput.getEditText().requestFocus()
|
||||
ma.hideKeyboard(customDialogInput.getEditText())
|
||||
|
||||
customDialogInput.getEditText()
|
||||
.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
|
||||
shelvingFk = customDialogInput.getValue()
|
||||
binding.mainToolbar.toolbarTitle.text =
|
||||
shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString(
|
||||
R.string.label
|
||||
) + etiquetas
|
||||
if (mpok != null) mpok!!.start()
|
||||
customDialogInput.dismiss()
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
binding.deleteImg.setOnClickListener {
|
||||
customDialog.setTitle(getString(R.string.empty))
|
||||
.setDescription(getString(R.string.operationNoReturn))
|
||||
.setOkButton(getString(R.string.empty)) {
|
||||
|
||||
listItems.forEach {
|
||||
it.stickers = "0"
|
||||
it.visible = "0"
|
||||
}
|
||||
if (adapter != null) {
|
||||
adapter!!.notifyDataSetChanged()
|
||||
}
|
||||
customDialog.dismiss()
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun checkUbications(itemScanned: Int) {
|
||||
itemScannedScreen = itemScanned
|
||||
val listInt: ArrayList<Int> = ArrayList()
|
||||
|
||||
if (listItems.filter { it.item == itemScanned }.isEmpty()) {
|
||||
listInt.add(itemScanned)
|
||||
} else {
|
||||
listItems.sortedBy { it.isChecked }.forEachIndexed { index, item ->
|
||||
if (item.item == itemScanned) {
|
||||
item.checked = true
|
||||
listInt.add(item.item)
|
||||
ma.messageWithSound("", false, true, "", false)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
adapter!!.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
private fun setTooltips() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
|
@ -550,7 +576,34 @@ class InventaryParkingFragment(
|
|||
}*/
|
||||
inventoryListParking.observe(viewLifecycleOwner, Observer {
|
||||
binding.splashProgress.visibility = GONE
|
||||
|
||||
if (it.list.isNotEmpty()) {
|
||||
if (it.list[0].isError) {
|
||||
ma.messageWithSound(
|
||||
it.list[0].errorMessage,
|
||||
it.list[0].isError,
|
||||
false
|
||||
)
|
||||
|
||||
} else {
|
||||
myListInventory = it.list as MutableList<ItemInventoryParking>
|
||||
createListInventoryParking(myListInventory)
|
||||
customDialogInput.dismiss()
|
||||
binding.textinputlayoutMatricula.visibility = VISIBLE
|
||||
binding.editMatricula.requestFocus()
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
/* loadInventaryParkingList.observe(viewLifecycleOwner) { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
binding.splashProgress.visibility = GONE
|
||||
try {
|
||||
|
||||
|
||||
if (it.list.isNotEmpty()) {
|
||||
if (it.list[0].isError) {
|
||||
ma.messageWithSound(
|
||||
it.list[0].errorMessage,
|
||||
|
@ -563,9 +616,37 @@ class InventaryParkingFragment(
|
|||
createListInventoryParking(myListInventory)
|
||||
|
||||
}
|
||||
})
|
||||
}}catch (
|
||||
ex:Exception
|
||||
){
|
||||
ex.message!!.toast(requireContext())
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
loadReponseCode.observe(viewLifecycleOwner) { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
binding.splashProgress.visibility = GONE
|
||||
if (it.isError) {
|
||||
ma.messageWithSound(it.errorMessage, it.isError, true)
|
||||
|
||||
} else {
|
||||
checkItem(it.response)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* responseCode.observe(viewLifecycleOwner, Observer {
|
||||
binding.splashProgress.visibility = GONE
|
||||
if (it.isError) {
|
||||
ma.messageWithSound(it.errorMessage, it.isError, true)
|
||||
|
||||
} else {
|
||||
checkItem(it.response)
|
||||
|
||||
}
|
||||
})*/
|
||||
response.observe(viewLifecycleOwner, Observer {
|
||||
binding.splashProgress.visibility = GONE
|
||||
if (it.isError) {
|
||||
|
@ -573,6 +654,11 @@ class InventaryParkingFragment(
|
|||
|
||||
} else {
|
||||
ma.messageWithSound("", it.isError, true, isToasted = false)
|
||||
callGetInventory(
|
||||
parkingFrom,
|
||||
parkingTo
|
||||
)
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
|
@ -587,7 +673,11 @@ class InventaryParkingFragment(
|
|||
) {
|
||||
|
||||
adapter = InventoryParkingAdapter(
|
||||
myListInventory,
|
||||
if (filterActivated) {
|
||||
myListInventory.filter { it.isChecked == null || it.isChecked == 0 }
|
||||
} else {
|
||||
myListInventory
|
||||
},
|
||||
onPasillerosItemClickListener = pasillerosItemClickListener!!,
|
||||
onVisibleInventoryClickListener = object : OnVisibleInventoryClickListener {
|
||||
override fun onVisibleInventoryClickListener(item: ItemInventoryParking) {
|
||||
|
|
|
@ -63,6 +63,13 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
|
||||
val loadInventaryParkingList = Transformations.map(_inventoryListParking) { Event(it) }
|
||||
|
||||
|
||||
private val _responseCode by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseCode: LiveData<ResponseItemVO>
|
||||
get() = _responseCode
|
||||
|
||||
val loadReponseCode = Transformations.map(_responseCode) { Event(it) }
|
||||
|
||||
//sergio para obtener comprador
|
||||
fun itemShelvingBuyerGet() {
|
||||
silex.itemShelvingBuyerGet().enqueue(object :
|
||||
|
@ -166,6 +173,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
|
||||
})
|
||||
}
|
||||
|
||||
fun itemShelvingsUpdate(
|
||||
where: JsonObject,
|
||||
params: Any,
|
||||
|
@ -190,6 +198,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
|
||||
})
|
||||
}
|
||||
|
||||
fun itemTrash(
|
||||
itemFk: Int,
|
||||
warehouseFk: Int,
|
||||
|
@ -423,7 +432,54 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun ItemListInventoryParking(
|
||||
fun getInventoryParking(
|
||||
vParkingFrom: String,
|
||||
vParkingTo: String
|
||||
) {
|
||||
|
||||
salix.getInventoryParking(vParkingFrom, vParkingTo)
|
||||
.enqueue(object :
|
||||
SilexCallback<List<ItemInventoryParking>>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<ItemInventoryParking> = ArrayList()
|
||||
listError.add(
|
||||
ItemInventoryParking(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
t.message!!
|
||||
),
|
||||
)
|
||||
)
|
||||
_inventoryListParking.value = InventoryParkingList(listError)
|
||||
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<List<ItemInventoryParking>>) {
|
||||
|
||||
if (response.body() != null) {
|
||||
_inventoryListParking.value =
|
||||
response.body()?.let { InventoryParkingList(it) }
|
||||
|
||||
}else{
|
||||
val listError: ArrayList<ItemInventoryParking> = ArrayList()
|
||||
listError.add(
|
||||
ItemInventoryParking(
|
||||
isError = false,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
),
|
||||
)
|
||||
)
|
||||
_inventoryListParking.value = InventoryParkingList(listError)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun ItemListInventoryParking_(
|
||||
vParkingFrom: String,
|
||||
vParkingTo: String
|
||||
) {
|
||||
|
@ -487,8 +543,18 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
2
|
||||
),
|
||||
ItemInventoryParking(
|
||||
5, 33, "F-01-3", "ZLZ", 2912, "HEL Tropical Red", 2, 37, "Jose Alarcan Gomex",
|
||||
"http://verdnatura.es/vn-image-data/catalog/1600x900/002912", 0, 0
|
||||
5,
|
||||
33,
|
||||
"F-01-3",
|
||||
"ZLZ",
|
||||
2912,
|
||||
"HEL Tropical Red",
|
||||
2,
|
||||
37,
|
||||
"Jose Alarcan Gomex",
|
||||
"http://verdnatura.es/vn-image-data/catalog/1600x900/002912",
|
||||
0,
|
||||
0
|
||||
),
|
||||
ItemInventoryParking(
|
||||
6,
|
||||
|
@ -519,16 +585,36 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
0
|
||||
),
|
||||
ItemInventoryParking(
|
||||
8, 34, "F-01-4", "JXU", 50001, "Monstera I", 130, 37, "Jose Alarcan Gomex",
|
||||
"http://verdnatura.es/vn-image-data/catalog/1600x900/50001", 0, 2
|
||||
8,
|
||||
34,
|
||||
"F-01-4",
|
||||
"JXU",
|
||||
50001,
|
||||
"Monstera I",
|
||||
130,
|
||||
37,
|
||||
"Jose Alarcan Gomex",
|
||||
"http://verdnatura.es/vn-image-data/catalog/1600x900/50001",
|
||||
0,
|
||||
2
|
||||
),
|
||||
ItemInventoryParking(
|
||||
9, 34, "F-01-4", "JXU", 50004, "Monstera IV", 240, 37, "Jose Alarcan Gomex",
|
||||
"http://verdnatura.es/vn-image-data/catalog/1600x900/50003", 0, 2
|
||||
9,
|
||||
34,
|
||||
"F-01-4",
|
||||
"JXU",
|
||||
50004,
|
||||
"Monstera IV",
|
||||
240,
|
||||
37,
|
||||
"Jose Alarcan Gomex",
|
||||
"http://verdnatura.es/vn-image-data/catalog/1600x900/50003",
|
||||
0,
|
||||
2
|
||||
)
|
||||
)
|
||||
)
|
||||
_inventoryListParking.value = myList
|
||||
// _inventoryListParking.value = myList
|
||||
|
||||
/*silex.itemShelving_inventory(vParkingFromFk, vParkingToFk)
|
||||
.enqueue(object :
|
||||
|
@ -595,4 +681,26 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
|
||||
})
|
||||
}
|
||||
|
||||
fun getIdFromCodeSalix(code: String) {
|
||||
salix.barcodes_toitem(code)
|
||||
.enqueue(object : SilexCallback<String>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responseCode.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<String>) {
|
||||
_responseCode.value =
|
||||
ResponseItemVO(
|
||||
isError = false,
|
||||
response = if (response.body() == null) "" else {
|
||||
response.body()!!
|
||||
}
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,27 +18,31 @@ class InventaryListVO(
|
|||
)
|
||||
|
||||
class ItemShelvingVisible(
|
||||
val visible: Int
|
||||
var visible: Int
|
||||
)
|
||||
|
||||
class ItemShelvingChecked(
|
||||
val isChecked: Boolean?
|
||||
var isChecked: Boolean?,
|
||||
var userFk : Int
|
||||
)
|
||||
|
||||
data class ItemInventoryParking(
|
||||
val id: Long,
|
||||
val pickingOrder: Int,
|
||||
val parking: String,
|
||||
val shelvingFk: String,
|
||||
val itemFk: Int,
|
||||
val longName: String,
|
||||
val visible: Int,
|
||||
val sectorFk: Int,
|
||||
val buyer: String,
|
||||
val urlImage: String,
|
||||
var isChecked:Int?,
|
||||
val priority: Int,
|
||||
var id: Long = 0,
|
||||
var pickingOrder: Int = 0,
|
||||
var parking: String = "",
|
||||
var shelvingFk: String = "",
|
||||
var itemFk: Int = 0,
|
||||
var longName: String = "",
|
||||
var visible: Int = 0,
|
||||
var sectorFk: Int = 0,
|
||||
var buyer: String = "",
|
||||
var urlImage: String = "",
|
||||
var isChecked: Int? = null,
|
||||
var priority: Int = 0,
|
||||
var isError: Boolean = false,
|
||||
var errorMessage: String = "",
|
||||
)
|
||||
|
||||
class InventoryParkingList(
|
||||
var list: List<ItemInventoryParking> = listOf()
|
||||
)
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<vector android:height="24dp"
|
||||
android:viewportHeight="50"
|
||||
android:viewportWidth="50"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FFF" android:pathData="M25,18.2c-3.8,0 -6.8,3.1 -6.8,6.8s3.1,6.8 6.8,6.8s6.8,-3.1 6.8,-6.8S28.8,18.2 25,18.2M25,36.4c-6.3,0 -11.4,-5.1 -11.4,-11.4S18.7,13.6 25,13.6S36.4,18.7 36.4,25S31.3,36.4 25,36.4M25,8C13.6,8 3.9,15 0,25c3.9,10 13.6,17 25,17S46.1,35 50,25C46.1,15 36.4,8 25,8z"/>
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<!-- drawable/filter_outline.xml -->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:tint="#FFF"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path android:fillColor="#FFFFFF" android:pathData="M15,19.88C15.04,20.18 14.94,20.5 14.71,20.71C14.32,21.1 13.69,21.1 13.3,20.71L9.29,16.7C9.06,16.47 8.96,16.16 9,15.87V10.75L4.21,4.62C3.87,4.19 3.95,3.56 4.38,3.22C4.57,3.08 4.78,3 5,3V3H19V3C19.22,3 19.43,3.08 19.62,3.22C20.05,3.56 20.13,4.19 19.79,4.62L15,10.75V19.88M7.04,5L11,10.06V15.58L13,17.58V10.05L16.96,5H7.04Z" />
|
||||
</vector>
|
|
@ -26,7 +26,7 @@
|
|||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/pasilleros_margin_main_menu"
|
||||
android:paddingTop="@dimen/inventory_item"
|
||||
android:paddingRight="@dimen/pasilleros_margin_main_menu"
|
||||
android:paddingRight="@dimen/inventory_item"
|
||||
android:paddingBottom="@dimen/inventory_item">
|
||||
|
||||
<LinearLayout
|
||||
|
@ -122,6 +122,7 @@
|
|||
android:maxLines="1"
|
||||
android:text="@{item.buyer}"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:visibility="gone"
|
||||
android:textSize="@dimen/h8" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
@ -134,7 +135,7 @@
|
|||
android:id="@+id/layer_visible"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="8"
|
||||
android:layout_weight="6"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
|
|
Loading…
Reference in New Issue