Version 9.2.1 añadido error encajado y modificado marcaje

This commit is contained in:
Sergio De la torre 2022-10-07 06:50:44 +02:00
parent ef32ed1461
commit 6f7abca1b1
13 changed files with 349 additions and 8 deletions

View File

@ -103,6 +103,7 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_mode_edit_black_24dp.xml" value="0.15052083333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_more_vert_black_24dp.xml" value="0.26" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_move_to_inbox_black_24dp.xml" value="0.15052083333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_packing_mistake.xml" value="0.1315" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_pallet_scan_expedition.xml" value="0.1005" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_pallet_ui.xml" value="0.212" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_parking_ui.xml" value="0.212" />
@ -198,7 +199,7 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_paletizador_menu.xml" value="0.13829787234042554" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_parking.xml" value="0.16666666666666666" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_pasillero.xml" value="0.21" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_pre_sacador.xml" value="0.3333333333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_pre_sacador.xml" value="0.29809358752166376" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_qr.xml" value="0.19882246376811594" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_reubication_collection.xml" value="0.22083333333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_sacador.xml" value="0.12952898550724637" />
@ -213,10 +214,11 @@
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_vehiclecontrol_user.xml" value="0.23052536231884058" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_web.xml" value="0.2463768115942029" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/fragment_workermistake.xml" value="0.2265625" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/ic_packing_mistake.xml" value="0.1" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_ajustes_row.xml" value="0.16666666666666666" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_article_row.xml" value="0.3333333333333333" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_article_row_fragment.xml" value="0.4466666666666667" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_article_row_presacador.xml" value="0.4466666666666667" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_article_row_presacador.xml" value="0.4" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_article_row_reubication_fragment.xml" value="0.36614583333333334" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_barcode_row.xml" value="0.15579710144927536" />
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout/item_buyer_row.xml" value="0.1793478260869565" />

View File

@ -41,11 +41,32 @@ class GetWokerMistakeUSerCase(context: Context) : RestClient(context) {
params
)
}
fun expeditionMistake_Add(
usuario: String,
password: String,
vExpeditionFk: String,
vTypeFk: String
): Call<Unit> {
val params: ArrayList<String> = ArrayList()
params.add(vExpeditionFk)
params.add(vTypeFk)
return restClient!!.expeditionMistake_Add(
"json",
"1",
usuario,
password,
"application/json",
params
)
}
fun workerMistakeType_get(usuario: String, password: String): Call<List<MistakeWorkerType>> {
return restClient!!.workerMistakeType_get("json", "1", usuario, password, "application/json")
}
fun expeditionMistakeType_get(usuario: String, password: String): Call<List<MistakeWorkerType>> {
return restClient!!.expeditionMistakeType_get("json", "1", usuario, password, "application/json")
}
fun department_getHasMistake(usuario: String, password: String): Call<List<DepartmentMistake>> {
return restClient!!.department_getHasMistake("json", "1", usuario, password, "application/json")
}

View File

@ -710,6 +710,17 @@ interface VerdnaturaService {
):
Call<Unit>
@POST("almacennew/expeditionMistake_Add")//REVISADA
fun expeditionMistake_Add(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String,
@Body params: List<String>
):
Call<Unit>
@POST("almacennew/mistakeType")//REVISADA
fun mistakeType(
@Header("aplicacion") aplicacion: String,
@ -731,6 +742,16 @@ interface VerdnaturaService {
):
Call<List<MistakeWorkerType>>
@POST("almacennew/expeditionMistakeType_get")//REVISADA
fun expeditionMistakeType_get(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@Header("user") user: String,
@Header("pass") pass: String,
@Header("Content-Type") content_type: String
):
Call<List<MistakeWorkerType>>
@POST("almacennew/department_getHasMistake")//REVISADA
fun department_getHasMistake(
@Header("aplicacion") aplicacion: String,

View File

@ -661,11 +661,18 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
)
saveWorkForm(
WorkForms(
"Sergio",
"TestLocalhost",
"http://10.1.4.42:9000",
urlSalix = "https://test-salix.verdnatura.es/api/"
)
)
saveWorkForm(
WorkForms(
"TestHome",
"http://192.168.1.132:9000",
urlSalix = "https://test-salix.verdnatura.es/api/"
)
)
saveWorkForm(
WorkForms(

View File

@ -16,6 +16,7 @@ import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
import android.widget.ImageView
import android.widget.Toast
import androidx.core.net.toUri
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
@ -1427,6 +1428,7 @@ class CollectionFragment(
saleTracking_mark(position, newType)
//saleTrackingReplace(position,newType)
} else {
saleAdapter!!.notifyDataSetChanged()
saleTrackingReplace(position, newType)
setListPosition(position, false)
}
@ -2811,7 +2813,6 @@ class CollectionFragment(
FALTA -> {
// speak("Orden no registrada")
}
//else -> speak("Orden no registrada")
}
}

View File

@ -374,6 +374,8 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
})
}
fun workerMistake_Add(
usuario: String,
password: String,
@ -417,6 +419,92 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
}
})
}
fun expeditionMistake_Add(
usuario: String,
password: String,
vExpeditionFk: String,
vTypeFk: String
) {
getWorkerMistakeUserCase.expeditionMistake_Add(usuario, password, vExpeditionFk, vTypeFk)
.enqueue(object :
Callback<Unit> {
override fun onFailure(call: Call<Unit>, t: Throwable) {
_responseAddMistake.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
}
override fun onResponse(
call: Call<Unit>,
response: Response<Unit>
) {
if (!response.isSuccessful) {
_responseAddMistake.value = ResponseItemVO(
isError = true,
errorMessage =
getMessageFromAllResponse(
nameofFunction(this),
response.message()
), codeError = response.code())
} else {
// sergio:refactor:solo debería haber un mensaje no un response o errorMessage
_responseAddMistake.value =
ResponseItemVO(
isError = false,
response = response.message()
)
}
}
})
}
fun expeditionMistakeType_get(usuario: String, password: String) {
getWorkerMistakeUserCase.expeditionMistakeType_get(usuario, password)
.enqueue(object : Callback<List<MistakeWorkerType>> {
override fun onFailure(call: Call<List<MistakeWorkerType>>, t: Throwable) {
val listError: ArrayList<MistakeWorkerType> = ArrayList()
listError.add(
MistakeWorkerType(
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
t.message!!
),
id = "0",
description = ""
)
)
_mistakeWorkerList.value = workerMistakeTypeList(listError)
}
override fun onResponse(
call: Call<List<MistakeWorkerType>>,
response: Response<List<MistakeWorkerType>>
) {
if (response.body() != null) {
_mistakeWorkerList.value =
response.body()?.let { workerMistakeTypeList(it) }
} else {
val listError: ArrayList<MistakeWorkerType> = ArrayList()
listError.add(
MistakeWorkerType(
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()
),
id = "0",
description = ""
)
)
_mistakeWorkerList.value = workerMistakeTypeList(listError)
}
}
})
}
}

View File

@ -420,13 +420,13 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
customDialog.dismiss()
}.show()
}
viewModel.operator_getNumberOfWagons(getData(USER), getData(PASSWORD))
viewModel.device_checkLogin(
binding.edittextUsername.text.toString(),
binding.edittextPassword.text.toString(),
getData(ANDROID_ID)
)
viewModel.operator_getNumberOfWagons(getData(USER), getData(PASSWORD))
}
operatorGetNumberOfWagons.observe(viewLifecycleOwner) {

View File

@ -66,6 +66,7 @@ import es.verdnatura.presentation.view.feature.smarttag.sacador.fragment.Associa
import es.verdnatura.presentation.view.feature.ubicador.fragment.AutomaticAddItemFragment
import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorFragment
import es.verdnatura.presentation.view.feature.workermistake.adapter.WorkermistakeFragment
import es.verdnatura.presentation.view.feature.workermistake.fragment.PackingMistakeFragment
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
@ -495,6 +496,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
getString(R.string.titleWorkerMistake) -> {
addFragmentOnTop(WorkermistakeFragment.newInstance(item.title))
}
getString(R.string.titlePackingMistake) -> {
addFragmentOnTop(PackingMistakeFragment.newInstance(item.title))
}
getString(R.string.titlePrePicker) -> {
addFragmentOnTop(InitPreSacadorFragment.newInstance(getString(R.string.getPreviousCollection)))

View File

@ -155,6 +155,18 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
)
)
)
//Tarea 4585
/* _pasillerositem.add(
PasillerosItemVO(
7,
R.drawable.ic_packing_mistake,
contextApp.getString(R.string.titlePackingMistake),
R.string.titlePackingMistake,
contextApp.getString(
R.string.titlePackingMistakeDescrip
)
)
)*/
_pasillerositem.add(
PasillerosItemVO(

View File

@ -0,0 +1,173 @@
package es.verdnatura.presentation.view.feature.workermistake.fragment
import android.content.Context
import android.os.Bundle
import android.util.Log.d
import android.view.View
import android.view.View.GONE
import android.view.View.VISIBLE
import android.view.inputmethod.EditorInfo
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentGeneralBlackBinding
import es.verdnatura.domain.ConstAndValues
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.GeneralAdapter
import es.verdnatura.presentation.common.GeneralItem
import es.verdnatura.presentation.common.OnCollectionSelectedListener
import es.verdnatura.presentation.common.OnGeneralItemRowClickListener
import es.verdnatura.presentation.view.component.CustomDialogList
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryViewModel
import es.verdnatura.presentation.view.feature.workermistake.model.MistakeWorkerType
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
class PackingMistakeFragment(var menuOrigin: String) :
BaseFragment<FragmentGeneralBlackBinding, InventaryViewModel>(
InventaryViewModel::class
) {
private var goBack: Boolean = false
private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
override fun getLayoutId(): Int = R.layout.fragment_general_black
private var type = ""
private var expeditionScan: String = ""
private var listMistakes: ArrayList<GeneralItem> = ArrayList()
private var listMistakesAdapter: GeneralAdapter? = null
private lateinit var customDialogList: CustomDialogList
companion object {
fun newInstance(menuOrigin: String) = PackingMistakeFragment(menuOrigin = menuOrigin)
}
override fun onAttach(context: Context) {
super.onAttach(context)
if (context is OnCollectionSelectedListener) onCollectionSelectedListener = context
}
override fun init() {
binding.scanInput.visibility = View.VISIBLE
binding.scanInput.hint = getString(R.string.scanLabelExpedition)
binding.mainToolbar.toolbarTitle.text = getString(R.string.titlePackingMistake)
binding.splashProgress.visibility = View.GONE
customDialogList = CustomDialogList(requireContext())
setEvents()
super.init()
}
override fun onPause() {
goBack = true
super.onPause()
}
override fun onCreate(savedInstanceState: Bundle?) {
type = ConstAndValues.VERTICKET
super.onCreate(savedInstanceState)
}
private fun setEvents() {
binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed()
}
binding.scanInput.requestFocus()
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
goBack = false
if (!binding.scanInput.text.isNullOrEmpty()) {
binding.splashProgress.visibility = View.VISIBLE
expeditionScan = binding.scanInput.text.toString()
viewModel.expeditionMistakeType_get(
usuario = getData(USER),
password = getData(PASSWORD),
)
}
binding.scanInput.setText("")
ma.hideKeyboard(binding.scanInput)
return@setOnEditorActionListener true
}
false
}
}
override fun observeViewModel() {
with(viewModel) {
mistakeWorkerList.observe(viewLifecycleOwner) {
binding.splashProgress.visibility = GONE
showMistakeList(it.list)
}
responseAddMistake.observe(viewLifecycleOwner) {
binding.splashProgress.visibility = GONE
ma.messageWithSound(
if (it.isError) {
if (it.codeError == 403) {
getString(R.string.userNotPermission)
} else {
it.errorMessage
}
} else {
getString(R.string.errorCauseRegistered)
}, it.isError, true, isToasted = true
)
}
}
}
private fun showMistakeList(list: List<MistakeWorkerType>) {
binding.splashProgress.visibility = View.GONE
listMistakes = ArrayList()
list.forEach {
listMistakes.add(GeneralItem(code = it.code, text = it.description))
}
customDialogList.setTitle(getString(R.string.errorCause) + expeditionScan)
.setKoButton(
getString(
R.string.cancel
)
) {
customDialogList.dismiss()
}.hideDialog().show()
listMistakesAdapter =
GeneralAdapter(listMistakes, object : OnGeneralItemRowClickListener {
override fun OnGeneralItemRowClickListener(item: GeneralItem) {
list.forEach {
if (it.description == item.text) {
binding.splashProgress.visibility = VISIBLE
d("VERDNATURA::", "el code es " + item.code + it.description)
viewModel.expeditionMistake_Add(
usuario = getData(USER),
password = getData(PASSWORD),
vExpeditionFk = expeditionScan,
vTypeFk = item.code.toString()
)
customDialogList.dismiss()
}
}
}
})
customDialogList.getRecyclerView().adapter = listMistakesAdapter
customDialogList.getRecyclerView().layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
}
}

View File

@ -0,0 +1,8 @@
<!-- drawable/alert_box.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#F7931E" android:pathData="M5,3H19A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3M13,13V7H11V13H13M13,17V15H11V17H13Z" />
</vector>

View File

@ -230,7 +230,7 @@
<string name="scanItem">Escanea un item</string>
<string name="itemNotFound">No hemos podido encontrar el artículo. Revisa el sector.</string>
<string name="errorOperation">Error al realizar la operación</string>
<string name="scanLabelExpedition">Escanea etiqueta de la expedición.</string>
<string name="scanLabelExpedition">Escanea expedición.</string>
<string name="buffer">Buffer:</string>
<string name="packingSave">Packing guardado</string>
<string name="previousCollected">Previa recogida</string>
@ -489,5 +489,7 @@
<string name="deleteWorkFormConfirmation">¿Desea borrar definitivamente la forma de trabajo?</string>
<string name="icViewCollection">Ver colección o último ticket</string>
<string name="noAssigned">No asignado</string>
<string name="titlePackingMistake">Fallo encajado</string>
<string name="titlePackingMistakeDescrip">Permite añadir error al encajado de una expedición</string>
</resources>

View File

@ -158,7 +158,8 @@
<string name="titleBufferload">Load buffer</string>
<string name="titleBufferStrapping">Buffer strapping</string>
<string name="Split">Split</string>
<string name="titleWorkerMistake">Worker mistaker</string>
<string name="titleWorkerMistake">Worker mistake</string>
<string name="titlePackingMistake">Packing mistake</string>
<string name="buscarDepartamento">Find department</string>
<string name="titleClaimUbication">Claim Ubication</string>
<string name="claims">Claims</string>
@ -428,6 +429,7 @@
<string name="titleReubicatorDescrip">Allows you to relocate the items from a wagoon</string>
<string name="titleInventoryDescrip">Visualize that it is missing or misplaced</string>
<string name="titleWorkerMistakeDescrip">Allows to add faults to a worker</string>
<string name="titlePackingMistakeDescrip">Allows to add faults to a expedition packing</string>
<string name="titleShelvingHistDescrip">Allows to know modifications of items in a wagoon</string>
<string name="titleLogShelvingDescrip">Allows to know the movements in a wagoon</string>
<string name="titleHistVehicleDescrip">Visualize who and when has taken a vehicle</string>