62 lines
2.0 KiB
Kotlin
62 lines
2.0 KiB
Kotlin
package com.sw.inbound.activity
|
|
|
|
import android.util.Log
|
|
import androidx.recyclerview.widget.LinearLayoutManager
|
|
import com.sw.inbound.R
|
|
import com.sw.inbound.adapter.SelfProcurementAdapter
|
|
import com.sw.inbound.dialog.WarnDialog
|
|
import com.sw.inbound.model.request.PurchaseWarehouseParam
|
|
import com.sw.inbound.model.response.DictType
|
|
import com.sw.inbound.utils.ext.toJsonString
|
|
import com.sw.inbound.utils.ext.toast
|
|
import timber.log.Timber
|
|
import kotlin.getValue
|
|
|
|
class SelfProcurementActivity : GoodsListActivity() {
|
|
|
|
private val adapter by lazy {
|
|
SelfProcurementAdapter(goodsList).apply {
|
|
setOnItemClickListener { adapter, view, position ->
|
|
goodsList[position].let {
|
|
it.isSelected = it.isSelected.not()
|
|
}
|
|
notifyItemChanged(position)
|
|
}
|
|
addOnItemChildClickListener(R.id.ivState) { adapter, view, position ->
|
|
///删除行数据弹窗
|
|
showWarnDialog(content = "请确认是否删除该条入库数据,删除后将无法恢复?") {
|
|
removeAt(position)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private fun showWarnDialog(content:String, callback:()-> Unit) {
|
|
WarnDialog(context = this, content = content, confirmBlock = callback).show()
|
|
}
|
|
|
|
override fun initRecyclerView() {
|
|
binding.rvGoodsList.let {
|
|
it.layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
|
|
it.adapter = adapter
|
|
}
|
|
}
|
|
|
|
override fun initView() {
|
|
binding.tvPurchaseNo.text = "自采入库"
|
|
binding.btnConfirmReceipt.setOnClickListener {
|
|
selfProcurementSubmit()
|
|
}
|
|
}
|
|
|
|
override fun getWarehouseList(): List<DictType> {
|
|
return goodsList.filter {
|
|
it.warehouseId.isNullOrBlank().not() && it.warehouseName.isNullOrBlank().not()
|
|
}
|
|
.distinctBy { it.warehouseId }
|
|
.map {
|
|
DictType(id = it.warehouseId!!, value = it.warehouseName!!)
|
|
}
|
|
}
|
|
|
|
} |