feat boxPickingCheck refs #7751

This commit is contained in:
Sergio De la torre 2024-07-19 16:18:25 +02:00
parent e2d2fd8d33
commit ed87bcb914
8 changed files with 97 additions and 27 deletions

View File

@ -1,6 +1,7 @@
package es.verdnatura.domain package es.verdnatura.domain
import com.google.gson.JsonObject import com.google.gson.JsonObject
import es.verdnatura.presentation.common.ExpeditionPrintOut
import es.verdnatura.presentation.common.ItemBarCodeSalix import es.verdnatura.presentation.common.ItemBarCodeSalix
import es.verdnatura.presentation.common.SaleTrackingSalix import es.verdnatura.presentation.common.SaleTrackingSalix
import es.verdnatura.presentation.common.TicketState import es.verdnatura.presentation.common.TicketState
@ -130,6 +131,11 @@ interface SalixService {
@Query("filter") filter: String @Query("filter") filter: String
): Call<List<AddressLoses>> ): Call<List<AddressLoses>>
@GET("AddressWastes")
fun getAddressSalixNew(
@Query("filter") filter: String
): Call<List<AddressLoses>>
@GET("Buyers") @GET("Buyers")
fun getBuyers( fun getBuyers(
@Query("filter") filter: String @Query("filter") filter: String
@ -219,8 +225,6 @@ interface SalixService {
@Query("routeFk") params: Int, @Query("routeFk") params: Int,
): Call<List<ExpeditionInfoSummary>> ): Call<List<ExpeditionInfoSummary>>
@POST("Applications/addNoteFromDelivery/execute-proc") @POST("Applications/addNoteFromDelivery/execute-proc")
fun addNote( fun addNote(
@Query("params") params: Any? = null, @Query("params") params: Any? = null,
@ -245,8 +249,8 @@ interface SalixService {
@POST("TicketObservations/addDropOff") @POST("TicketObservations/addDropOff")
fun addFropOff( fun addFropOff(
@Query("ticketFk") ticketFk: Long , @Query("ticketFk") ticketFk: Long,
@Query("note") note: String , @Query("note") note: String,
): Call<Any> ): Call<Any>
@POST("Applications/item_getBalance/execute-proc") @POST("Applications/item_getBalance/execute-proc")
@ -346,8 +350,18 @@ interface SalixService {
@GET("Expedition_printOuts/findOne") @GET("Expedition_printOuts/findOne")
fun isBoxPickingInPrintOut( fun isBoxPickingInPrintOut(
@Query("filter") filter: String, @Query("filter") filter: String,
): ):
Call<Any> Call<Any>
//Tarea 7751
// Call<ExpeditionPrintOut>
@PATCH("Expedition_printOuts/{id}")
fun update(
@Path("id") id: Number,
@Body expeditionPrintOut: ExpeditionPrintOut
):
Call<Any>
@GET("TicketCollections/hasUncheckedTicket") @GET("TicketCollections/hasUncheckedTicket")
fun hasUncheckedTicket( fun hasUncheckedTicket(
@Query("ticketFk") ticketFk: Number, @Query("ticketFk") ticketFk: Number,
@ -495,7 +509,6 @@ interface SalixService {
@Query("schema") schema: String = "vn" @Query("schema") schema: String = "vn"
): Call<Any> ): Call<Any>
@POST("Applications/saleTracking_updateIsChecked/execute-proc") @POST("Applications/saleTracking_updateIsChecked/execute-proc")
fun saleTrackingUpdateIsChecked( fun saleTrackingUpdateIsChecked(
@Query("params") params: Any? = null, @Query("params") params: Any? = null,
@ -682,11 +695,11 @@ interface SalixService {
@Query("params") params: Any, @Query("params") params: Any,
): Call<Any> ): Call<Any>
@POST("Applications/itemShelvingLog_get/execute-proc") /* @POST("Applications/itemShelvingLog_get/execute-proc")
fun itemShelvingLogGet( fun itemShelvingLogGet(
@Query("schema") schema: String = "vn", @Query("schema") schema: String = "vn",
@Query("params") params: Any, @Query("params") params: Any,
): Call<List<ItemShelvingLog>> ): Call<List<ItemShelvingLog>>*/
//Tarea 7168 //Tarea 7168
@GET("ItemShelvingLogs") @GET("ItemShelvingLogs")
@ -731,7 +744,6 @@ interface SalixService {
): ):
Call<List<ItemDetails>> Call<List<ItemDetails>>
@POST("Applications/expedition_getState/execute-proc") @POST("Applications/expedition_getState/execute-proc")
fun expedition_getState( fun expedition_getState(
@Query("schema") schema: String = "vn", @Query("schema") schema: String = "vn",
@ -836,7 +848,6 @@ interface SalixService {
@Query("filter") filter: String = """{"fields": {"id": true,"name": true},"where": {"hasToMistake": true}}""" @Query("filter") filter: String = """{"fields": {"id": true,"name": true},"where": {"hasToMistake": true}}"""
): Call<List<DepartmentMistake>> ): Call<List<DepartmentMistake>>
@DELETE("ExpeditionPallets/{id}") @DELETE("ExpeditionPallets/{id}")
fun expeditionPalletDel( fun expeditionPalletDel(
@Path("id") id: Number @Path("id") id: Number
@ -1093,8 +1104,6 @@ interface SalixService {
@Body params: Any @Body params: Any
): Call<Any> ): Call<Any>
@GET("ItemShelvingSales/{id}/exists") @GET("ItemShelvingSales/{id}/exists")
fun itemShelvingSaleExists( fun itemShelvingSaleExists(
@Path("id") id: Number, @Path("id") id: Number,
@ -1111,10 +1120,10 @@ interface SalixService {
@Body params: Any, @Body params: Any,
): Call<Any> ): Call<Any>
@POST("ItemShelvingSales/itemShelvingSale_addBySale") /* @POST("ItemShelvingSales/itemShelvingSale_addBySale")
fun itemShelvingSale_addBySale( fun itemShelvingSale_addBySale(
@Body params: Any, @Body params: Any,
): Call<Any> ): Call<Any>*/
@POST("ItemShelvings/getInventory") @POST("ItemShelvings/getInventory")
fun getInventoryParking( fun getInventoryParking(

View File

@ -80,4 +80,9 @@ data class TicketState(
val id: Int = 0, val id: Int = 0,
val username: String = "" val username: String = ""
) )
} }
data class ExpeditionPrintOut(
val expeditionFk:Long,
val itemFk:Int,
val isChecked: Boolean
)

View File

@ -75,7 +75,7 @@ class BoxPickingFragment(var title: String) :
}.setValue("").show() }.setValue("").show()
customDialogInput.setFocusText()
customDialogInput.getEditText().setOnEditorActionListener { _, actionId, _ -> customDialogInput.getEditText().setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
@ -112,6 +112,36 @@ class BoxPickingFragment(var title: String) :
binding.scanInput.requestFocus() binding.scanInput.requestFocus()
} }
//Tarea 7751
/* isBoxPickingInPrintOut.observe(viewLifecycleOwner) {
if (it.isChecked){
ma.messageWithSound(
message = "La expedición ya ha sido revisada. Pregunta encargado por si se ha preparado dos veces.",
isError = true,
isPlayed = true,
isToasted = false
)
}else{
viewModel.updateExpeditionPrint(it.expeditionFk, expeditionPrintOut = ExpeditionPrintOut(it.expeditionFk,it.itemFk, true))
}
binding.scanInput.requestFocus()
}
responseCode.observe(viewLifecycleOwner) {
ma.messageWithSound(
message = getString(R.string.errorInput),
isError = true,
isPlayed = true,
isToasted = null
)
binding.scanInput.requestFocus()
}*/
} }
} }

View File

@ -6,6 +6,7 @@ import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.SalixCallback import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.common.ExpeditionPrintOut
import retrofit2.Response import retrofit2.Response
class BoxPickingViewModel(val context: Context) : BaseViewModel(context) { class BoxPickingViewModel(val context: Context) : BaseViewModel(context) {
@ -14,26 +15,41 @@ class BoxPickingViewModel(val context: Context) : BaseViewModel(context) {
private val _isBoxPickingInPrintOut by lazy { MutableLiveData<Boolean>() } private val _isBoxPickingInPrintOut by lazy { MutableLiveData<Boolean>() }
val isBoxPickingInPrintOut: LiveData<Boolean> = _isBoxPickingInPrintOut val isBoxPickingInPrintOut: LiveData<Boolean> = _isBoxPickingInPrintOut
private val _responseCode by lazy { MutableLiveData<String>() } //Tarea 7751
val responseCode: LiveData<String> = _responseCode /*private val _isBoxPickingInPrintOut by lazy { MutableLiveData<ExpeditionPrintOut>() }
val isBoxPickingInPrintOut: LiveData<ExpeditionPrintOut> = _isBoxPickingInPrintOut*/
private val _responseCode by lazy { MutableLiveData<Boolean>() }
val responseCode: LiveData<Boolean> = _responseCode
fun isBoxPickingOk( fun isBoxPickingOk(
expeditionFk: Long, itemFk: Long expeditionFk: Long, itemFk: Long
) { ) {
salix.isBoxPickingInPrintOut( salix.isBoxPickingInPrintOut(
filter = """{"where":{"expeditionFk":$expeditionFk,"itemFk":$itemFk}}""" filter = """{"where":{"expeditionFk":$expeditionFk,"itemFk":$itemFk}}"""
).enqueue(object : SalixCallback<Any>(context) { ).enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) { override fun onSuccess(response: Response<Any>) {
_isBoxPickingInPrintOut.value = true _isBoxPickingInPrintOut.value = true
} }
override fun onError(t: Throwable) { override fun onError(t: Throwable) {
_isBoxPickingInPrintOut.value = false _isBoxPickingInPrintOut.value = false
} }
}) })
//Tarea 7751
//isChecked
/* ).enqueue(object : SalixCallback<ExpeditionPrintOut>(context) {
override fun onSuccess(response: Response<ExpeditionPrintOut>) {
_isBoxPickingInPrintOut.value = response.body()
}
override fun onError(t: Throwable) {
_isBoxPickingInPrintOut.value = ExpeditionPrintOut(0,0,false)
}
})*/
} }
fun isBoxPickingInPrintOut(expeditionFk: Long, barcode: String) { fun isBoxPickingInPrintOut(expeditionFk: Long, barcode: String) {
@ -48,11 +64,17 @@ class BoxPickingViewModel(val context: Context) : BaseViewModel(context) {
expeditionFk = expeditionFk expeditionFk = expeditionFk
) )
} else { } else {
_isBoxPickingInPrintOut.value = false _responseCode.value = false
} }
} }
}) })
} }
fun updateExpeditionPrint(expeditionFk: Long, expeditionPrintOut: ExpeditionPrintOut) {
salix.update(expeditionFk, expeditionPrintOut)
.enqueue(object : SalixCallback<Any>(context) {
})
}
} }

View File

@ -837,5 +837,6 @@
<string name="txtName">%1$s %2$s</string> <string name="txtName">%1$s %2$s</string>
<string name="selectPrinterEmergency">La impresora seleccionada es solo para emergencias.¿Estás seguro?</string> <string name="selectPrinterEmergency">La impresora seleccionada es solo para emergencias.¿Estás seguro?</string>
<string name="notesClaim">Notas de reclamaciones</string> <string name="notesClaim">Notas de reclamaciones</string>
<string name="titlePreControlTest">Pre Control TEST</string>
</resources> </resources>

View File

@ -837,5 +837,6 @@
<string name="txtName">%1$s %2$s</string> <string name="txtName">%1$s %2$s</string>
<string name="selectPrinterEmergency">La impresora seleccionada es solo para emergencias.¿Estás seguro?</string> <string name="selectPrinterEmergency">La impresora seleccionada es solo para emergencias.¿Estás seguro?</string>
<string name="notesClaim">Notas de reclamaciones</string> <string name="notesClaim">Notas de reclamaciones</string>
<string name="titlePreControlTest">Pre Control TEST</string>
</resources> </resources>

View File

@ -837,5 +837,6 @@
<string name="txtName">%1$s %2$s</string> <string name="txtName">%1$s %2$s</string>
<string name="selectPrinterEmergency">La impresora seleccionada es solo para emergencias.¿Estás seguro?</string> <string name="selectPrinterEmergency">La impresora seleccionada es solo para emergencias.¿Estás seguro?</string>
<string name="notesClaim">Notas de reclamaciones</string> <string name="notesClaim">Notas de reclamaciones</string>
<string name="titlePreControlTest">Pre Control TEST</string>
</resources> </resources>

View File

@ -839,5 +839,6 @@
<string name="txtName">%1$s %2$s</string> <string name="txtName">%1$s %2$s</string>
<string name="selectPrinterEmergency">La impresora seleccionada es solo para emergencias.¿Estás seguro?</string> <string name="selectPrinterEmergency">La impresora seleccionada es solo para emergencias.¿Estás seguro?</string>
<string name="notesClaim">Notas de reclamaciones</string> <string name="notesClaim">Notas de reclamaciones</string>
<string name="titlePreControlTest">Pre Control TEST</string>
</resources> </resources>