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

View File

@ -80,4 +80,9 @@ data class TicketState(
val id: Int = 0,
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()
customDialogInput.setFocusText()
customDialogInput.getEditText().setOnEditorActionListener { _, actionId, _ ->
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()
}
//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.userCases.GetItemFromBarcodeUseCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.common.ExpeditionPrintOut
import retrofit2.Response
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>() }
val isBoxPickingInPrintOut: LiveData<Boolean> = _isBoxPickingInPrintOut
private val _responseCode by lazy { MutableLiveData<String>() }
val responseCode: LiveData<String> = _responseCode
//Tarea 7751
/*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(
expeditionFk: Long, itemFk: Long
) {
salix.isBoxPickingInPrintOut(
filter = """{"where":{"expeditionFk":$expeditionFk,"itemFk":$itemFk}}"""
).enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) {
_isBoxPickingInPrintOut.value = true
}
override fun onError(t: Throwable) {
_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) {
@ -48,11 +64,17 @@ class BoxPickingViewModel(val context: Context) : BaseViewModel(context) {
expeditionFk = expeditionFk
)
} 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="selectPrinterEmergency">La impresora seleccionada es solo para emergencias.¿Estás seguro?</string>
<string name="notesClaim">Notas de reclamaciones</string>
<string name="titlePreControlTest">Pre Control TEST</string>
</resources>

View File

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

View File

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

View File

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