refs #5890 feat:itemShelving

This commit is contained in:
Sergio De la torre 2024-02-07 11:57:43 +01:00
parent 24d1ccdd9b
commit b759d8a3dd
5 changed files with 57 additions and 49 deletions

View File

@ -30,7 +30,7 @@ class SaleAdapterNew(
private val onMistakeClickListener: OnMistakeClickListener,
private val onPackingClick: OnPackingClickSaleListener,
private var onTicketClick: OnTicketClickSaleListener? = null,
private var SaleAdapter: SaleAdapterNew? = null,
private var saleAdapter: SaleAdapterNew? = null,
private var type: String? = null,
) : RecyclerView.Adapter<SaleAdapterNew.AjustesItemHolder>() {
@ -46,9 +46,7 @@ class SaleAdapterNew(
return AjustesItemHolder(
SaleRowFragmentBinding.inflate(
LayoutInflater.from(parent.context),
parent,
false
LayoutInflater.from(parent.context), parent, false
)
)
}
@ -65,8 +63,7 @@ class SaleAdapterNew(
) : RecyclerView.ViewHolder(binding.root) {
fun bind(sale: Sale) {
binding.apply {
if (sale.reservedQuantity == null)
sale.reservedQuantity = 0
if (sale.reservedQuantity == null) sale.reservedQuantity = 0
val childLayoutManager =
LinearLayoutManager(context!!, RecyclerView.HORIZONTAL, false)
@ -88,7 +85,8 @@ class SaleAdapterNew(
packingTopicker.setOnClickListener {
//onQuantityClick.onQuantityClick(sale)
// Solo se cambia la cantidad al cogerla no al pulsar !!
// onQuantityClick.onQuantityClick(sale)
}
@ -128,17 +126,20 @@ class SaleAdapterNew(
}
//ERROR
if (sale.originalQuantity != sale.saleQuantity && sale.originalQuantity != null) {
println("Sacador sale item ${sale.itemFk} sale ${sale.saleFk} cantidad ${sale.saleQuantity} original ${sale.originalQuantity}")
if (sale.originalQuantity != sale.saleQuantity && sale.originalQuantity != null && !sale.isParent) {
layoutError.visibility = View.VISIBLE
txtError.text =
binding.root.context.getString(R.string.originalQuantity) + sale.originalQuantity!!
}else{
layoutError.visibility = View.GONE
}
if (sale.isAdded == 1) {
layoutError.visibility = View.VISIBLE
txtError.text = binding.root.context.getString(R.string.newItem)
}
paintTicketcolor(sale.rgb, itemTicketColor, sale.isPicked)
@ -148,8 +149,6 @@ class SaleAdapterNew(
}
if (isExpanded) {
itemArticlePlacements.visibility = View.VISIBLE
ivArrow.setImageResource(R.drawable.ic_arrow_down)
@ -163,8 +162,7 @@ class SaleAdapterNew(
View.GONE
}
if (sale.isParent) {
/* itemArticleItemFk.visibility = View.INVISIBLE
if (sale.isParent) {/* itemArticleItemFk.visibility = View.INVISIBLE
itemPackingText.visibility = View.INVISIBLE
itemPackingItemFk.visibility = View.INVISIBLE
itemArticleCel1.visibility = View.INVISIBLE
@ -174,11 +172,14 @@ class SaleAdapterNew(
txtdeNew.visibility = View.INVISIBLE
itemArticleQuantityPicked.visibility = View.INVISIBLE
itemArticleQuantityLine3.visibility = View.VISIBLE*/
packingTopicker.visibility = View.INVISIBLE
quantityReserved.visibility = View.INVISIBLE
itemArticleItemFkNew.visibility = View.INVISIBLE
imageErrorMessage.visibility = View.INVISIBLE
ivArrow.visibility = View.VISIBLE
} else {
/*itemArticleItemFk.visibility = View.VISIBLE
} else {/*itemArticleItemFk.visibility = View.VISIBLE
itemPackingText.visibility = View.VISIBLE
itemPackingItemFk.visibility = View.VISIBLE
itemArticleCel1.visibility = View.VISIBLE
@ -236,7 +237,8 @@ class SaleAdapterNew(
previous.visibility = View.INVISIBLE
} else {
previous.visibility = View.VISIBLE
previous.text = "${previous.text} ${sale.saleGroupFk}"
// previous.text =""
previous.text = "PREV:"+ sale.saleGroupFk
}
var result: Int
@ -303,15 +305,13 @@ class SaleAdapterNew(
if (sale.isPicked == 1) {
contentLayout.setBackgroundColor(
getColor(
context!!,
R.color.verdnatura_pumpkin_orange
context!!, R.color.verdnatura_pumpkin_orange
)
)
} else {
contentLayout.setBackgroundColor(
getColor(
context!!,
R.color.verdnatura_black
context!!, R.color.verdnatura_black
)
)

View File

@ -24,7 +24,6 @@ import androidx.recyclerview.widget.RecyclerView
import com.google.gson.Gson
import es.verdnatura.R
import es.verdnatura.databinding.FragmentCollectionNewBinding
import es.verdnatura.domain.ConstAndValues
import es.verdnatura.domain.ConstAndValues.BASEURLSALIX
import es.verdnatura.domain.ConstAndValues.CONTROLADOR
import es.verdnatura.domain.ConstAndValues.PRINTERNAME
@ -563,6 +562,9 @@ class CollectionFragmentPickerNew(
sales = salesList.sortedWith(compareBy<Sale> { it.pickingOrder }.thenBy { it.itemFk })
for (s in sales) {
println("Sacador sale: ${s.saleFk} saleGRoup: ${s.saleGroupFk} item : ${s.itemFk}")
}
//quitar comentarios FALTA AGRUPAR LAS PREVIAS
myGroupList =
groupSaleGroup(salesList).sortedWith(compareBy<Sale> { it.pickingOrder }.thenBy { it.itemFk })
@ -642,9 +644,11 @@ class CollectionFragmentPickerNew(
var entryPoint = Gson().toJson(
mutableMapOf(
"entryPoint" to sale.ticketFk,
"web" to "${ mobileApplication.dataStoreApp.readDataStoreKey<String>(
BASEURLSALIX
)}/#!/ticket/${sale.ticketFk}/sale"
"web" to "${
mobileApplication.dataStoreApp.readDataStoreKey<String>(
BASEURLSALIX
)
}/#!/ticket/${sale.ticketFk}/sale"
)
)
ma.onPasillerosItemClickListener(
@ -674,7 +678,6 @@ class CollectionFragmentPickerNew(
RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
storedBackPosition = lm.findFirstVisibleItemPosition()
super.onScrolled(recyclerView, dx, dy)
}
})
@ -923,6 +926,7 @@ class CollectionFragmentPickerNew(
if (quantityToReserve == totalReserved) {
originalItemScan = customDialogList.getValueTwo().toLong()
println("Sacador a checkItemScan")
if (checkItemScan(customDialogList.getValueTwo())) {
onQuantityOfShelvingSelected(
@ -954,9 +958,10 @@ class CollectionFragmentPickerNew(
}
private fun checkItemScan(valueToCheck: String): Boolean {
println("Sacador valor a checkear ${valueToCheck}")
if (storedPosition >= 0 && sales.size > storedPosition) {
val saleToCheck = sales[storedPosition]
val saleToCheck = myGroupList[storedPosition]
println("Sacador valor de la sale a checkear ${saleToCheck}")
if (saleToCheck.itemFk.toString() == valueToCheck) return true
else {
saleToCheck.Barcodes.forEach { barcode ->
@ -1269,25 +1274,27 @@ class CollectionFragmentPickerNew(
/*crea padre*/
if (value.size > 1) {
var mySale = value[0]
Sale(
pickingOrder = value[0].pickingOrder,
workerFk = value[0].workerFk,
originalQuantity = value[0].originalQuantity,
saleQuantity = 0,
saleFk = value[0].saleFk,
saleGroupFk = value[0].saleGroupFk,
semaphore = value[0].semaphore,
ticketFk = value[0].ticketFk,
itemFk = value[0].saleGroupFk!!,
isAdded = value[0].isAdded,
hasMistake = value[0].hasMistake,
origin = value[0].origin,
size = value[0].size,
itemShelvingSaleFk = value[0].itemShelvingSaleFk,
longName = value[0].longName
)
var mySale = //= value[0]
Sale(
level = value[0].level,
isPicked = value[0].isPicked,
parkingCode = "Líneas : ${value.size}",
pickingOrder = value[0].pickingOrder,
workerFk = value[0].workerFk,
originalQuantity = value[0].originalQuantity,
saleQuantity = 0,
saleFk = value[0].saleFk,
saleGroupFk = value[0].saleGroupFk,
semaphore = value[0].semaphore,
ticketFk = value[0].ticketFk,
itemFk = value[0].saleGroupFk!!,
isAdded = value[0].isAdded,
hasMistake = value[0].hasMistake,
origin = value[0].origin,
size = value[0].size,
itemShelvingSaleFk = value[0].itemShelvingSaleFk,
longName = value[0].parkingCode ?: ""
)
//prime elemento//hay que hacer una copia si no queda la referencia
mySale.totalSales = value.size //total líneas

View File

@ -262,7 +262,6 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
salix.getRoutes().enqueue(object : SalixCallback<MutableList<RouteInfo>>(context) {
override fun onSuccess(response: Response<MutableList<RouteInfo>>) {
println()
_routeList.value = response.body()?.let { RouteList(it) }
}

View File

@ -155,6 +155,7 @@ class SacadorViewModel(val context: Context) : BaseViewModel(context) {
}
fun collection_assignNew() {
// salix.collectionAssign()
silex.collection_assign().enqueue(
object :
SalixCallback<Int>(context) {

View File

@ -51,6 +51,7 @@
android:orientation="horizontal">
<TextView
android:id="@+id/levelTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/layout_margin_min"
@ -94,8 +95,8 @@
android:id="@+id/previous"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="PREVIA"
android:layout_marginStart="20dp"
android:text=""
android:layout_marginStart="4dp"
android:textColor="@color/verdnatura_black"
android:textSize="@dimen/h8"
android:textStyle="bold"