This commit is contained in:
Sergio De la torre 2023-07-05 13:11:50 +02:00
parent dccbb41ab1
commit ad4910948d
11 changed files with 503 additions and 208 deletions

View File

@ -1,5 +1,6 @@
package es.verdnatura.domain
import com.google.gson.JsonObject
import es.verdnatura.presentation.common.itemBarCodeSalix
import es.verdnatura.presentation.common.itemPackingTypeSalix
import es.verdnatura.presentation.common.packingSiteSalix
@ -213,13 +214,26 @@ interface SalixService {
):
Call<List<accessConfigSalix>>
@GET("vnusers/renewToken")
@POST("vnusers/renewToken")
fun renewToken(
):
Call<LoginSalixVO>
}
@PATCH("ItemShelvings/{id}")
fun itemShelvingUpdate(
@Path("id") id: Number,
@Body params: Any
):
Call<Any>
@POST("ItemShelvings/update")
fun itemShelvingsUpdate(
@Query("where") id: JsonObject,
@Body params: Any
):
Call<Any>
}
interface SalixServiceSend {

View File

@ -77,7 +77,6 @@ class InventoryParkingAdapter(
fun bind(item: ItemInventoryParking) {
binding.apply {
this.item = item
//multiText.text = "${item.stickers}x${item.packing}"
imgItem.loadUrl(item.urlImage)
imgItem.setOnClickListener {
onPasillerosItemClickListener.onPasillerosItemClickListener(
@ -117,7 +116,15 @@ class InventoryParkingAdapter(
moreImg.setOnClickListener {
// onMoreClickListener.onMoreClickListener(item)
}
namelayout.setOnClickListener {
itemShelving.setOnClickListener {
onPasillerosItemClickListener.onPasillerosItemClickListener(
PasillerosItemVO(
title = res.getString(R.string.titleUbicator)
), item.shelvingFk
)
}
itemfkText.setOnClickListener {
onPasillerosItemClickListener.onPasillerosItemClickListener(
PasillerosItemVO(
title = res.getString(R.string.itemSearch)

View File

@ -5,7 +5,7 @@ import android.content.Context
import android.graphics.drawable.Drawable
import android.media.MediaPlayer
import android.os.Build
import android.os.Bundle
import android.text.InputType
import android.view.View.GONE
import android.view.View.VISIBLE
import android.view.inputmethod.EditorInfo
@ -13,9 +13,11 @@ import android.widget.ImageView
import androidx.annotation.RequiresApi
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
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.*
@ -24,7 +26,8 @@ import es.verdnatura.presentation.view.feature.articulo.adapter.BarcodeAdapter
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
import es.verdnatura.presentation.view.feature.inventario.adapter.InventoryParkingAdapter
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventoryParking
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.inventario.model.ItemShelvingChecked
import es.verdnatura.presentation.view.feature.inventario.model.ItemShelvingVisible
import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO
@ -37,9 +40,7 @@ class InventaryParkingFragment(
private var adapter: InventoryParkingAdapter? = null
private lateinit var customDialogInput: CustomDialogInput
private lateinit var customDialogUbicador: CustomDialogUbicador
private lateinit var customDialogTwoButtons: CustomDialogTwoButtons
private lateinit var customDialogThreeButtons: CustomDialogThreeButtons
private lateinit var customDialogList: CustomDialogList
private var listItems: MutableList<ItemUbicadorVO> = mutableListOf()
private var listLocalItems: ArrayList<ItemUbicadorVO> = ArrayList()
@ -58,7 +59,9 @@ class InventaryParkingFragment(
private lateinit var myListInventory: MutableList<ItemInventoryParking>
private var listParkings: ArrayList<BarcodeVO> = ArrayList()
private var listWagonsAdapter: BarcodeAdapter? = null
private var positionShelvingChecking: Int = -1
private var positionItemChecking: Int = -1
private var scrollPosition = 0
companion object {
fun newInstance(title: String) =
@ -67,10 +70,16 @@ class InventaryParkingFragment(
override fun getLayoutId(): Int = R.layout.fragment_inventory_parking
override fun onPause() {
val layoutManager =
binding.inventoryParkingRecyclerview.layoutManager as LinearLayoutManager
scrollPosition = layoutManager.findFirstVisibleItemPosition()
super.onPause()
isBack = true
}
override fun onAttach(context: Context) {
if (context is OnPasillerosItemClickListener) pasillerosItemClickListener = context
super.onAttach(context)
@ -81,25 +90,29 @@ class InventaryParkingFragment(
customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext())
customDialogUbicador = CustomDialogUbicador(requireContext())
customDialogTwoButtons = CustomDialogTwoButtons(requireContext())
customDialogList = CustomDialogList(requireContext())
ma.hideBottomNavigation(GONE)
binding.mainToolbar.toolbarTitle.text = title
setEvents()
setViews()
setToolBar()
super.init()
}
override fun onCreate(savedInstanceState: Bundle?) {
mperror = MediaPlayer.create((activity as MainActivity), R.raw.error)
mpok = MediaPlayer.create((activity as MainActivity), R.raw.ok)
super.onCreate(savedInstanceState)
private fun setViews() {
binding.inventoryParkingRecyclerview.addOnScrollListener(object :
RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
scrollPosition =
(recyclerView.layoutManager as LinearLayoutManager).findFirstVisibleItemPosition()
super.onScrolled(recyclerView, dx, dy)
}
})
}
@RequiresApi(Build.VERSION_CODES.O)
private fun setToolBar() {
@ -125,9 +138,9 @@ class InventaryParkingFragment(
}
listIcons.add(iconParkingFrom)
listIcons.add(iconAdd)
listIcons.add(iconReload)
//listIcons.add(iconReset)
//listIcons.add(iconAdd)
//listIcons.add(iconReload)
listIcons.add(iconReset)
binding.mainToolbar.toolbarIcons.adapter =
@ -136,28 +149,21 @@ class InventaryParkingFragment(
when (item) {
iconAdd.drawable -> {
adapter!!.sortBy("sector")
// adapter!!.sortBy("sector")
}
iconReload.drawable -> {
adapter!!.sortBy("buyer")
// adapter!!.sortBy("buyer")
}
iconReset.drawable -> {
customDialog.setTitle(getString(R.string.checkItemShelvingDescrip))
.setDescription(getString(R.string.checkItemShelving))
.setOkButton(getString(R.string.cancel)) {
customDialog.dismiss()
}
.setKoButton(getString(R.string.ok)) {
customDialog.dismiss()
}
.show()
showResetShelving()
}
iconParkingFrom.drawable -> {
binding.textinputlayoutMatricula.visibility = VISIBLE
setParkingFromTo()
}
@ -169,29 +175,78 @@ class InventaryParkingFragment(
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
private fun showResetShelving() {
customDialogInput.setFocusText()
customDialogInput.setInputText(InputType.TYPE_CLASS_TEXT)
customDialogInput.setTitle(getString(R.string.checkItemShelvingDescrip))
.setDescription(getString(R.string.checkItemShelvingSelect))
.setOkButton(getString(R.string.cancel)) {
customDialogInput.dismiss()
}
.setKoButton(getString(R.string.ok)) {
checkSelvingsForUpdate(customDialogInput.getValue())
}
.show()
customDialogInput.getEditText().setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (customDialogInput.getValue().isNotEmpty()
) {
checkSelvingsForUpdate(customDialogInput.getValue())
}
return@setOnEditorActionListener true
}
false
}
}
private fun checkSelvingsForUpdate(shelvingInput: String) {
val filter = JsonObject()
val inqValues = JsonArray()
for (item in myListInventory) {
if (item.shelvingFk == shelvingInput) {
inqValues.add(item.id)
}
}
if (inqValues.size() == 0) {
ma.messageWithSound("", true, true, "", null)
} else {
filter.add("id", JsonObject().apply { add("inq", inqValues) })
binding.splashProgress.visibility = VISIBLE
viewModel.itemShelvingsUpdate(filter, ItemShelvingChecked(null))
}
ma.hideKeyboard(customDialogInput.getEditText())
customDialogInput.setValue("")
customDialogInput.dismiss()
binding.editMatricula.requestFocus()
}
private fun setParkingFromTo() {
customDialogList.setTitle("Indica parkings a revisar")
customDialogList.setDescription("Indica desde dónde hasta cual quieres revisar")
customDialogList.setTitle(getString(R.string.selectParkingsCheckin))
customDialogList.setDescription(getString(R.string.selectParkingsFrom))
.setOkButton(
getString(R.string.review)
) {
ma.hideKeyboard(customDialogList.getEditText())
if (listParkings.isNotEmpty() && listParkings.size == 2) {
binding.splashProgress.visibility = VISIBLE
viewModel.ItemListInventoryParking("MAD-01", "CAM-01")
if (listParkings.size == 1) {
viewModel.ItemListInventoryParking(
listParkings.first().code!!,
customDialogList.getValue()
)
ma.hideKeyboard(customDialogList.getEditText())
listParkings.clear()
customDialog.dismiss()
customDialogList.dismiss()
binding.editMatricula.requestFocus()
} else {
customDialog
.setDescription("Indica el parking hasta donde quieres revisar")
.setOkButton(getString(R.string.accept)) {
customDialog.dismiss()
}.show()
listParkings.add(0, BarcodeVO(code = customDialogList.getValue()))
}
@ -206,27 +261,28 @@ class InventaryParkingFragment(
customDialogList.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (!customDialogList.getValue().isNullOrEmpty()) {
if (!customDialogList.getValue().isEmpty()) {
try {
if (listParkings.size == 1) {
viewModel.ItemListInventoryParking(
listParkings!!.first()!!.code!!,
listParkings.first().code!!,
customDialogList.getValue()
)
ma.hideKeyboard(customDialogList.getEditText())
listParkings.clear()
customDialogList.dismiss()
binding.editMatricula.requestFocus()
} else {
listParkings.add(0, BarcodeVO(code = customDialogList.getValue()))
}
} catch (e: Exception) {
ma.messageWithSound(e.message.toString(), true, true, "", true)
}
listWagonsAdapter!!.notifyDataSetChanged()
listWagonsAdapter!!.notifyItemInserted(listParkings.size - 1)
}
customDialogList.setValue("")
ma.hideKeyboard(customDialogList.getEditText())
@ -261,45 +317,80 @@ class InventaryParkingFragment(
binding.editMatricula.requestFocus()
binding.editMatricula.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (!binding.editMatricula.text.toString().isNullOrEmpty()) {
/*Tarea 5336 */
if (binding.editMatricula.text.toString().length == 3 && !binding.editMatricula.text!![0].isDigit()) {
binding.mainToolbar.toolbarTitle.text =
binding.editMatricula.text.toString()
if (!binding.editMatricula.text.toString().isEmpty()) {
if (positionShelvingChecking == -1) {
positionShelvingChecking = myListInventory.indexOfFirst { item ->
item.shelvingFk == binding.editMatricula.text.toString()
}
if (positionShelvingChecking == -1) {
ma.messageWithSound(
getString(R.string.shelvingNotFound),
true,
true,
"",
true
)
} else {
binding.editMatricula.hint = getString(R.string.scanItemForChecking)
}
} else {
/*Tarea#5109*/
/*viewModel.getIdFromCode(
code = binding.editMatricula.text.toString()
)*/
try {
binding.splashProgress.visibility = VISIBLE
/* viewModel.getIdFromCode(
code = itemScanValue(
binding.editMatricula.text.toString(),
"buy",
"more"
).toString()
)*/
} catch (Ex: Exception) {
ma.messageWithSound(Ex.message.toString(), true, true)
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)
}
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
viewModel.itemShelvingUpdate(
myListInventory.get(positionItemChecking).id,
ItemShelvingChecked(true)
)*/
myListInventory[positionItemChecking].isChecked = 1
adapter!!.notifyDataSetChanged()
binding.editMatricula.hint = getString(R.string.scanShelving)
/* viewModel.getIdFromCode(
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)
}
binding.editMatricula.setText("")
ma.hideKeyboard(binding.editMatricula)
return@setOnEditorActionListener true
}
return@setOnEditorActionListener false
}
binding.parkingImg.setOnClickListener {
customDialogInput.setTitle(getString(R.string.parkingShelving)).setValue("")
.setOkButton(
@ -321,21 +412,22 @@ class InventaryParkingFragment(
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.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
customDialogInput.dismiss()
parking = customDialogInput.getValue()
binding.mainToolbar.toolbarTitle.text =
shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString(
R.string.label
) + etiquetas
return@setOnEditorActionListener true
return@setOnEditorActionListener true
}
false
}
false
}
}
@ -357,20 +449,21 @@ class InventaryParkingFragment(
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.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
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
}
false
}
}
@ -420,11 +513,14 @@ class InventaryParkingFragment(
private fun setTooltips() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
binding.editImg.tooltipText = getTooltip(R.drawable.ic_mode_edit_black_24dp)
binding.deleteImg.tooltipText = getTooltip(R.drawable.ic_delete_forever_black_24dp)
binding.deleteImg.tooltipText =
getTooltip(R.drawable.ic_delete_forever_black_24dp)
binding.editPrioridad.tooltipText =
getString(R.string.changePriority)
binding.parkingImg.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp)
binding.automaticImg.tooltipText = getTooltip(R.drawable.ic_flash_auto_black_24dp)
binding.parkingImg.tooltipText =
getTooltip(R.drawable.ic_local_parking_black_24dp)
binding.automaticImg.tooltipText =
getTooltip(R.drawable.ic_flash_auto_black_24dp)
}
@ -435,27 +531,46 @@ class InventaryParkingFragment(
with(viewModel) {
loadInventaryParkingList.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull {
binding.splashProgress.visibility = GONE
if (it.list[0].isError) {
ma.messageWithSound(it.list[0].errorMessage, it.list[0].isError, false)
/* loadInventaryParkingList.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull {
binding.splashProgress.visibility = GONE
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)
} else {
myListInventory = it.list as MutableList<ItemInventoryParking>
createListInventoryParking(myListInventory)
}
}
}*/
inventoryListParking.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = GONE
binding.splashProgress.visibility = GONE
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)
}
}
}
})
response.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = GONE
if (it.isError) {
binding.splashProgress.visibility = GONE
ma.messageWithSound(it.errorMessage, it.isError, true)
} else {
ma.messageWithSound("", it.isError, true, isToasted = false)
@ -466,14 +581,17 @@ class InventaryParkingFragment(
}
private fun createListInventoryParking(list: List<ItemInventoryParking>, sort: String? = null) {
private fun createListInventoryParking(
list: List<ItemInventoryParking>,
sort: String? = null
) {
adapter = InventoryParkingAdapter(
myListInventory,
onPasillerosItemClickListener = pasillerosItemClickListener!!,
onVisibleInventoryClickListener = object : OnVisibleInventoryClickListener {
override fun onVisibleInventoryClickListener(item: ItemInventoryParking) {
changeQuantity(item)
changeVisible(item)
}
},
@ -495,9 +613,9 @@ class InventaryParkingFragment(
}
private fun changeQuantity(item: ItemInventoryParking) {
private fun changeVisible(item: ItemInventoryParking) {
customDialogInput.setInputText()
customDialogInput.setInputText(InputType.TYPE_CLASS_NUMBER)
customDialogInput.setTitle(getString(R.string.quantity))
customDialogInput.setDescription(getString(R.string.quantityVisible))
.setValue("")
@ -505,9 +623,10 @@ class InventaryParkingFragment(
try {
if (customDialogInput.getValue().toInt() >= 0) {
binding.splashProgress.visibility = VISIBLE
//viewModel.ChangeVisible
item.visible - customDialogInput.getValue().toInt()
viewModel.itemShelvingUpdate(
item.id,
ItemShelvingVisible(customDialogInput.getValue().toInt())
)
} else {
@ -516,6 +635,7 @@ class InventaryParkingFragment(
} catch (err: Exception) {
(getString(R.string.errorQuantity).toast(requireContext()))
}
customDialogInput.setValue("")
customDialogInput.dismiss()
}.setKoButton(getString(R.string.cancel)) {
@ -530,7 +650,8 @@ class InventaryParkingFragment(
.setDescription(getString(R.string.selectAction))
.setOkButton(getString(R.string.transfer)) {
customDialogInput.setTitle(getString(R.string.shelvingNew))
.setDescription(getString(R.string.selectDestiny) + item.item).setValue("")
.setDescription(getString(R.string.selectDestiny) + item.item)
.setValue("")
.setOkButton(getString(R.string.transfer)) {
if (customDialogInput.getValue().isNotEmpty()) {
binding.splashProgress.visibility = VISIBLE

View File

@ -4,6 +4,7 @@ import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import com.google.gson.JsonObject
import es.verdnatura.domain.SilexCallback
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
@ -14,9 +15,14 @@ import es.verdnatura.presentation.view.feature.calidad.model.BuyerListVO
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
import es.verdnatura.presentation.view.feature.inventario.model.InventaryListVO
import es.verdnatura.presentation.view.feature.inventario.model.InventoryParkingList
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventoryParking
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
import es.verdnatura.presentation.view.feature.workermistake.model.*
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventoryParking
import es.verdnatura.presentation.view.feature.workermistake.model.DepartmentMistake
import es.verdnatura.presentation.view.feature.workermistake.model.MistakeWorkerType
import es.verdnatura.presentation.view.feature.workermistake.model.WorkerFromMistake
import es.verdnatura.presentation.view.feature.workermistake.model.departmentMistakeList
import es.verdnatura.presentation.view.feature.workermistake.model.workerFromMistakeList
import es.verdnatura.presentation.view.feature.workermistake.model.workerMistakeTypeList
import retrofit2.Response
class InventaryViewModel(val context: Context) : BaseViewModel(context) {
@ -59,9 +65,9 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
//sergio para obtener comprador
fun itemShelvingBuyerGet() {
silex.itemShelvingBuyerGet().enqueue(object :
silex.itemShelvingBuyerGet().enqueue(object :
SilexCallback<List<BuyerVO>>(context) {
override fun onError(t: Throwable) {
override fun onError(t: Throwable) {
val listError: ArrayList<BuyerVO> = ArrayList()
listError.add(
BuyerVO(
@ -72,7 +78,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
_buyersList.value = BuyerListVO(listError)
}
override fun onSuccess(response: Response<List<BuyerVO>>) {
override fun onSuccess(response: Response<List<BuyerVO>>) {
if (response.body() != null) {
_buyersList.value = response.body()?.let { BuyerListVO(it) }
} else {
@ -97,7 +103,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
val loadInventaryList = Transformations.map(_inventaryList) { Event(it) }
fun getInventory(buyerFk: Int, warehouseFk: Int) {
silex.itemShelvingRadarFilterBuyer(buyerFk, warehouseFk)
silex.itemShelvingRadarFilterBuyer(buyerFk, warehouseFk)
.enqueue(object :
SilexCallback<List<ItemInventaryVO>>(context) {
override fun onError(t: Throwable) {
@ -136,17 +142,14 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
})
}
fun itemShelvingUpdate(
itemShelvingFk: Long,
params: Any,
//sergio: se modifica por CAU a itemTrash
fun itemTrash(
itemFk: Int,
warehouseFk: Int,
newValue: Int,
isTrash: Boolean
) {
) {
silex.itemTrash(itemFk, warehouseFk, newValue, isTrash)
salix.itemShelvingUpdate(itemShelvingFk, params)
.enqueue(object : SilexCallback<Any>(context) {
override fun onError(t: Throwable) {
@ -157,53 +160,102 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
}
override fun onSuccess(response: Response<Any>) {
_response.value =
ResponseItemVO(isError = false, response = response.message())
_response.value =
ResponseItemVO(isError = false, response = response.message())
}
})
}
fun itemShelvingsUpdate(
where: JsonObject,
params: Any,
) {
salix.itemShelvingsUpdate(where, params)
.enqueue(object : SilexCallback<Any>(context) {
override fun onError(t: Throwable) {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
override fun onSuccess(response: Response<Any>) {
_response.value =
ResponseItemVO(isError = false, response = response.message())
}
})
}
fun itemTrash(
itemFk: Int,
warehouseFk: Int,
newValue: Int,
isTrash: Boolean
) {
silex.itemTrash(itemFk, warehouseFk, newValue, isTrash)
.enqueue(object : SilexCallback<Any>(context) {
override fun onError(t: Throwable) {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
override fun onSuccess(response: Response<Any>) {
_response.value =
ResponseItemVO(isError = false, response = response.message())
}
})
}
//En test encara,no provat en Salix
/* fun department_getHasMistakeSalix(token: String) {
/* fun department_getHasMistakeSalix(token: String) {
getWorkerMistakeUserCase.department_getHasMistakeSalix(token)
getWorkerMistakeUserCase.department_getHasMistakeSalix(token)
.enqueue(object : Callback<List<DepartmentMistake>> {
override fun onFailure(call: Call<List<DepartmentMistake>>, t: Throwable) {
val listError: ArrayList<DepartmentMistake> = ArrayList()
listError.add(
DepartmentMistake(
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
t.message!!
)
)
)
_mistakeDepartmentList.value = departmentMistakeList(listError)
}
.enqueue(object : Callback<List<DepartmentMistake>> {
override fun onFailure(call: Call<List<DepartmentMistake>>, t: Throwable) {
val listError: ArrayList<DepartmentMistake> = ArrayList()
listError.add(
DepartmentMistake(
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
t.message!!
)
)
)
_mistakeDepartmentList.value = departmentMistakeList(listError)
}
override fun onResponse(
call: Call<List<DepartmentMistake>>,
response: Response<List<DepartmentMistake>>
) {
if (response.body() != null) {
_mistakeDepartmentList.value =
response.body()?.let { departmentMistakeList(it) }
} else {
val listError: ArrayList<DepartmentMistake> = ArrayList()
listError.add(DepartmentMistake(0, ""))
_mistakeDepartmentList.value = departmentMistakeList(listError)
}
}
override fun onResponse(
call: Call<List<DepartmentMistake>>,
response: Response<List<DepartmentMistake>>
) {
if (response.body() != null) {
_mistakeDepartmentList.value =
response.body()?.let { departmentMistakeList(it) }
} else {
val listError: ArrayList<DepartmentMistake> = ArrayList()
listError.add(DepartmentMistake(0, ""))
_mistakeDepartmentList.value = departmentMistakeList(listError)
}
}
})
}*/
})
}*/
fun department_getHasMistake() {
silex.department_getHasMistake()
silex.department_getHasMistake()
.enqueue(object : SilexCallback<List<DepartmentMistake>>(context) {
override fun onError(t: Throwable) {
val listError: ArrayList<DepartmentMistake> = ArrayList()
@ -233,8 +285,8 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
})
}
fun worker_getFromHasMistake( departmentFk: Int) {
silex.worker_getFromHasMistake(departmentFk)
fun worker_getFromHasMistake(departmentFk: Int) {
silex.worker_getFromHasMistake(departmentFk)
.enqueue(object :
SilexCallback<List<WorkerFromMistake>>(context) {
override fun onError(t: Throwable) {
@ -275,7 +327,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
}
fun workerMistakeType_get() {
silex.workerMistakeType_get()
silex.workerMistakeType_get()
.enqueue(object : SilexCallback<List<MistakeWorkerType>>(context) {
override fun onError(t: Throwable) {
val listError: ArrayList<MistakeWorkerType> = ArrayList()
@ -323,7 +375,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
vUserFk: Int,
vTypeFk: String
) {
silex.workerMistake_Add(vUserFk, vTypeFk)
silex.workerMistake_Add(vUserFk, vTypeFk)
.enqueue(object :
SilexCallback<Any>(context) {
override fun onError(t: Throwable) {
@ -334,12 +386,12 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
}
override fun onSuccess(response: Response<Any>) {
// sergio:refactor:solo debería haber un mensaje no un response o errorMessage
_responseAddMistake.value =
ResponseItemVO(
isError = false,
response = response.message()
)
// sergio:refactor:solo debería haber un mensaje no un response o errorMessage
_responseAddMistake.value =
ResponseItemVO(
isError = false,
response = response.message()
)
}
})
@ -349,7 +401,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
vExpeditionFk: Int,
vTypeFk: String
) {
silex.expeditionMistake_add(vExpeditionFk, vTypeFk)
silex.expeditionMistake_add(vExpeditionFk, vTypeFk)
.enqueue(object :
SilexCallback<Any>(context) {
override fun onError(t: Throwable) {
@ -362,11 +414,11 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
override fun onSuccess(response: Response<Any>) {
// sergio:refactor:solo debería haber un mensaje no un response o errorMessage
_responseAddMistake.value =
ResponseItemVO(
isError = false,
response = response.message()
)
_responseAddMistake.value =
ResponseItemVO(
isError = false,
response = response.message()
)
}
})
}
@ -379,42 +431,103 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
var myList = InventoryParkingList(
listOf(
ItemInventoryParking(
31, vParkingFrom, vParkingTo, 19897, "Dendrobium Galaxy", 510, 37, "Jose Alarcan Gomex",
"http://verdnatura.es/vn-image-data/catalog/1600x900/dgalaxy", 0, 2
1,
31,
vParkingFrom,
vParkingTo,
19897,
"Dendrobium Galaxy",
510,
37,
"Jose Alarcan Gomex",
"http://verdnatura.es/vn-image-data/catalog/1600x900/dgalaxy",
0,
2
),
ItemInventoryParking(
31, "F-01-1", "OZR", 92400, "Cymbidium Avalanche", 14, 37, "Sergio de la Torre Nebot",
"http://verdnatura.es/vn-image-data/catalog/1600x900/92400", 1, 2
2,
31,
"F-01-1",
"OZR",
92400,
"Cymbidium Avalanche",
14,
37,
"Sergio de la Torre Nebot",
"http://verdnatura.es/vn-image-data/catalog/1600x900/92400",
1,
2
),
ItemInventoryParking(
31, "F-01-1", "OZR", 92400, "Cymbidium Avalanche", 2, 37, "Jose Alarcan Gomex",
"http://verdnatura.es/vn-image-data/catalog/1600x900/92400", 0, 2
3,
31,
"F-01-1",
"OZR",
92400,
"Cymbidium Avalanche",
2,
37,
"Jose Alarcan Gomex",
"http://verdnatura.es/vn-image-data/catalog/1600x900/92400",
null,
2
),
ItemInventoryParking(
32, "F-01-2", "PLY", 19897, "Dendrobium Galaxy", 520, 37, "Jose Alarcan Gomex",
"http://verdnatura.es/vn-image-data/catalog/1600x900/dgalaxy", 0, 2
4,
32,
"F-01-2",
"PLY",
19897,
"Dendrobium Galaxy",
520,
37,
"Jose Alarcan Gomex",
"http://verdnatura.es/vn-image-data/catalog/1600x900/dgalaxy",
0,
2
),
ItemInventoryParking(
33, "F-01-3", "ZLZ", 2912, "HEL Tropical Red", 2, 37, "Jose Alarcan Gomex",
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(
34, "F-01-4", "JXU", 25942, "HEL BQ Amor (x bouquet)", 0, 37, "Jose Alarcan Gomex",
"http://verdnatura.es/vn-image-data/catalog/1600x900/bqamor", 2, 0
6,
34,
"F-01-4",
"JXU",
25942,
"HEL BQ Amor (x bouquet)",
0,
37,
"Jose Alarcan Gomex",
"http://verdnatura.es/vn-image-data/catalog/1600x900/bqamor",
2,
0
),
ItemInventoryParking(
34, "F-01-4", "MUU", 25942, "HEL BQ Amor (x bouquet)", 5, 37, "Jose Alarcan Gomex",
"http://verdnatura.es/vn-image-data/catalog/1600x900/bqamor", 0, 0
7,
34,
"F-01-4",
"MUU",
25942,
"HEL BQ Amor (x bouquet)",
5,
37,
"Jose Alarcan Gomex",
"http://verdnatura.es/vn-image-data/catalog/1600x900/bqamor",
0,
0
),
ItemInventoryParking(
34, "F-01-4", "JXU", 50001, "Monstera I", 130, 37, "Jose Alarcan Gomex",
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(
34, "F-01-4", "JXU", 50004, "Monstera IV", 240, 37, "Jose Alarcan Gomex",
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
/*silex.itemShelving_inventory(vParkingFromFk, vParkingToFk)
@ -440,7 +553,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
}
fun expeditionMistakeType_get() {
silex.expeditionMistakeType_get()
silex.expeditionMistakeType_get()
.enqueue(object : SilexCallback<List<MistakeWorkerType>>(context) {
override fun onError(t: Throwable) {
val listError: ArrayList<MistakeWorkerType> = ArrayList()

View File

@ -17,9 +17,14 @@ class InventaryListVO(
var list: List<ItemInventaryVO> = listOf()
)
class ItemShelvingVisible(
val visible: Int
)
class ItemShelvingChecked(
val isChecked: Boolean?
)
data class ItemInventoryParking(
val id: Long,
val pickingOrder: Int,
val parking: String,
val shelvingFk: String,
@ -29,7 +34,7 @@ data class ItemInventoryParking(
val sectorFk: Int,
val buyer: String,
val urlImage: String,
val isChecked:Int?,
var isChecked:Int?,
val priority: Int,
var isError: Boolean = false,
var errorMessage: String = "",

View File

@ -6,6 +6,7 @@ import android.graphics.drawable.Drawable
import android.media.MediaPlayer
import android.os.Build
import android.os.Bundle
import android.text.InputType
import android.view.View
import android.view.View.GONE
import android.view.View.VISIBLE
@ -687,7 +688,7 @@ class UbicadorFragment(
private fun showAutoSelfConsumption(item: ItemUbicadorVO) {
customDialogInput.setInputText()
customDialogInput.setInputText(InputType.TYPE_CLASS_NUMBER)
customDialogInput.setTitle(getString(R.string.selfConsumption))
customDialogInput.setDescription(getString(R.string.quantityTake))
.setValue("")

View File

@ -28,6 +28,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:visibility="invisible"
android:textColorHint="@android:color/darker_gray">
<com.google.android.material.textfield.TextInputEditText
@ -41,6 +42,7 @@
android:maxLines="1"
android:gravity="center"
android:textColor="@color/verdnatura_white"
android:textColorHint="@android:color/darker_gray" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout

View File

@ -589,7 +589,7 @@
<string name="titlePhotosDescrip">Nature Photos</string>
<string name="checkItemShelving">¿Desea resetear la revisión del carro?</string>
<string name="item_checking">Al pulsar permite resetear la revisión</string>
<string name="checkItemShelvingDescrip">Revisión del carro</string>
<string name="checkItemShelvingDescrip">Borrar revisión del carro</string>
<string name="scanItemUpload">Escanea artículo a subir</string>
<string name="messageUploadItem">Tienes que escanear el artículo para poder subirlo</string>
<string name="messageUpload">Sube la imagen al servidor</string>
@ -603,5 +603,13 @@
<string name="titleInventoryParking">Inventario por parking</string>
<string name="titleInventoryParkingDescrip">Permite inventariar por parking</string>
<string name="quantityVisible">Indica la nueva cantidad visible</string>
<string name="checkItemShelvingSelect">Ecscanea o escribe la matrícula a resetear revisión</string>
<string name="selectParkingsCheckin">Indica parkings a revisar</string>
<string name="selectParkingsFrom">Indica desde dónde hasta cual quieres revisar</string>
<string name="selectParkingsTo">Indica el parking hasta donde quieres revisar</string>
<string name="shelvingNotFound">Matrícula del carro no encontrada</string>
<string name="scanItemForChecking">Escanea artículo a verificar</string>
<string name="itemNotFoundScanAgain">Artículo no encontrado. Escanea de nuevo el carro</string>
<string name="scanShelvingAgain">Escanea matrícula de nuevo</string>
</resources>

View File

@ -603,5 +603,13 @@
<string name="titleInventoryParking">Inventario por parking</string>
<string name="titleInventoryParkingDescrip">Permite inventariar por parking</string>
<string name="quantityVisible">Indica la nueva cantidad visible</string>
<string name="checkItemShelvingSelect">Ecscanea o escribe la matrícula a resetear revisión</string>
<string name="selectParkingsCheckin">Indica parkings a revisar</string>
<string name="selectParkingsFrom">Indica desde dónde hasta cual quieres revisar</string>
<string name="selectParkingsTo">Indica el parking hasta donde quieres revisar</string>
<string name="shelvingNotFound">Matrícula del carro no encontrada</string>
<string name="scanItemForChecking">Escanea artículo a verificar</string>
<string name="itemNotFoundScanAgain">Artículo no encontrado. Escanea de nuevo el carro</string>
<string name="scanShelvingAgain">Escanea matrícula de nuevo</string>
</resources>

View File

@ -603,5 +603,13 @@
<string name="titleInventoryParking">Inventario por parking</string>
<string name="titleInventoryParkingDescrip">Permite inventariar por parking</string>
<string name="quantityVisible">Indica la nueva cantidad visible</string>
<string name="checkItemShelvingSelect">Ecscanea o escribe la matrícula a resetear revisión</string>
<string name="selectParkingsCheckin">Indica parkings a revisar</string>
<string name="selectParkingsFrom">Indica desde dónde hasta cual quieres revisar</string>
<string name="selectParkingsTo">Indica el parking hasta donde quieres revisar</string>
<string name="shelvingNotFound">Matrícula del carro no encontrada</string>
<string name="scanItemForChecking">Escanea artículo a verificar</string>
<string name="itemNotFoundScanAgain">Artículo no encontrado. Escanea de nuevo el carro</string>
<string name="scanShelvingAgain">Escanea matrícula de nuevo</string>
</resources>

View File

@ -602,4 +602,12 @@
<string name="titleInventoryParking">Inventory by parking</string>
<string name="titleInventoryParkingDescrip">Inventory by parking, you can select ubications</string>
<string name="quantityVisible">Indica la nueva cantidad visible</string>
<string name="checkItemShelvingSelect">Ecscanea o escribe la matrícula a resetear revisión</string>
<string name="selectParkingsCheckin">Indica parkings a revisar</string>
<string name="selectParkingsFrom">Indica desde dónde hasta cual quieres revisar</string>
<string name="selectParkingsTo">Indica el parking hasta donde quieres revisar</string>
<string name="shelvingNotFound">Matrícula del carro no encontrada</string>
<string name="scanItemForChecking">Escanea artículo a verificar</string>
<string name="itemNotFoundScanAgain">Artículo no encontrado. Escanea de nuevo el carro</string>
<string name="scanShelvingAgain">Escanea matrícula de nuevo</string>
</resources>