采购单入库商品默认显示采购单信息;采集数据显示优化
This commit is contained in:
@@ -28,6 +28,7 @@ import com.sw.inbound.databinding.LayoutEmptySearchBinding
|
||||
import com.sw.inbound.dialog.CollectSearchDialog
|
||||
import com.sw.inbound.dialog.CustomDialog
|
||||
import com.sw.inbound.dialog.Loading
|
||||
import com.sw.inbound.dialog.WarnDialog
|
||||
import com.sw.inbound.model.response.SearchGoodsInfo
|
||||
import com.sw.inbound.objbox.Food
|
||||
import com.sw.inbound.objbox.FoodCollectionBean
|
||||
@@ -182,8 +183,7 @@ class FoodCollectionActivity : ComponentActivity() {
|
||||
}
|
||||
// vectorThread()
|
||||
// uploadAllImage()
|
||||
|
||||
upload()
|
||||
showUploadDialog()
|
||||
}
|
||||
binding.btnTakePhoto.clickWithDebounce(800) {
|
||||
takePhoto()
|
||||
@@ -224,6 +224,20 @@ class FoodCollectionActivity : ComponentActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun showUploadDialog() {
|
||||
val goodsName = searchGoodsList[clickIndex].goodsName
|
||||
WarnDialog(
|
||||
context = this,
|
||||
content = "选择错误会影响识别结果,请确认当前采集物品是:${goodsName}?",
|
||||
cancelBlock = {
|
||||
|
||||
},
|
||||
confirmBlock = {
|
||||
upload()
|
||||
}
|
||||
) .show()
|
||||
}
|
||||
|
||||
private var pageNo = 1
|
||||
private var clickIndex = -1
|
||||
|
||||
|
||||
@@ -38,19 +38,13 @@ import com.sw.inbound.model.request.UploadInfo
|
||||
import com.sw.inbound.model.response.DictType
|
||||
import com.sw.inbound.model.response.GoodsInfo
|
||||
import com.sw.inbound.model.response.SearchGoodsInfo
|
||||
import com.sw.inbound.objbox.Food
|
||||
import com.sw.inbound.objbox.FoodModule
|
||||
import com.sw.inbound.objbox.FoodModule.IdNameScore
|
||||
import com.sw.inbound.objbox.FoodModule.bitmap2FloatArray
|
||||
import com.sw.inbound.objbox.Food_
|
||||
import com.sw.inbound.objbox.ObjectBox
|
||||
import com.sw.inbound.sdk.SensorScaleUtils
|
||||
import com.sw.inbound.utils.AssetsTool
|
||||
import com.sw.inbound.utils.BitmapCropper
|
||||
import com.sw.inbound.utils.BitmapSaver
|
||||
import com.sw.inbound.utils.CameraUtils
|
||||
import com.sw.inbound.utils.DateTimeUtils
|
||||
import com.sw.inbound.utils.FileUtils
|
||||
import com.sw.inbound.utils.ImageUtil
|
||||
import com.sw.inbound.utils.LogSaveUtil
|
||||
import com.sw.inbound.utils.PreciseDelayHandler
|
||||
@@ -63,7 +57,6 @@ import com.sw.inbound.utils.ext.toast
|
||||
import com.sw.inbound.viewmodel.ReceiptViewModel
|
||||
import com.sw.inbound.viewmodel.UserViewModel
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.objectbox.query.Query
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import okhttp3.RequestBody
|
||||
@@ -483,7 +476,7 @@ abstract class GoodsListActivity : ComponentActivity() {
|
||||
context = this,
|
||||
list = goodsList.toMutableList(),
|
||||
goodsFile = file,
|
||||
goodsName = name,
|
||||
goodsName = name
|
||||
) {
|
||||
GoodsSearchDialog(this).show()
|
||||
}.apply {
|
||||
|
||||
@@ -85,6 +85,8 @@ class ReceiptActivity : GoodsListActivity() {
|
||||
list.forEach { goodsInfo ->
|
||||
goodsInfo.recUnitPriceTaxInBak = goodsInfo.recUnitPriceTaxIn
|
||||
goodsInfo.recUnitPriceTaxIn = 0.0
|
||||
goodsInfo.recPriceExItemBak = goodsInfo.recPriceExItem
|
||||
goodsInfo.receiveCountBak = goodsInfo.receiveCount
|
||||
goodsInfo.unitNameBak = goodsInfo.unitName
|
||||
goodsInfo.receivedNumBak = goodsInfo.receivedNum
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ class CollectSearchDialog(
|
||||
it.setEnableLoadMore(false)
|
||||
it.setOnRefreshListener {
|
||||
pageNo = 1
|
||||
this@CollectSearchDialog.clickIndex = -1
|
||||
val searchName = binding.etInputGoods.text.toString().trim()
|
||||
getCollectGoods(searchName)
|
||||
}
|
||||
@@ -121,17 +122,13 @@ class CollectSearchDialog(
|
||||
private val searchAdapter by lazy {
|
||||
CollectSearchAdapter(list).apply {
|
||||
isStateViewEnable = true
|
||||
//setOnItemClickListener { _, _, position ->
|
||||
// this@CollectSearchDialog.clickIndex = position
|
||||
// if (list[position].isSelected) {
|
||||
// return@setOnItemClickListener
|
||||
// }
|
||||
// list.forEach { item ->
|
||||
// item.isSelected = false
|
||||
// }
|
||||
// list[position].isSelected = true
|
||||
// notifyDataSetChanged()
|
||||
//}
|
||||
setOnItemClickListener { _, _, position ->
|
||||
activity?.lifecycleScope?.launch {
|
||||
val goodsName = list[position].goodsName?:""
|
||||
val count = ObjectBox.count(goodsName)
|
||||
activity?.toast("已采集数据${count}条")
|
||||
}
|
||||
}
|
||||
addOnItemChildClickListener(R.id.ivDelete) { _, _, position ->
|
||||
this@CollectSearchDialog.clickIndex = position
|
||||
list.forEach { item ->
|
||||
@@ -139,7 +136,9 @@ class CollectSearchDialog(
|
||||
}
|
||||
list[position].isSelected = true
|
||||
notifyDataSetChanged()
|
||||
showDeleteDialog(position)
|
||||
showDeleteDialog(position) {
|
||||
this@CollectSearchDialog.clickIndex = -1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -147,7 +146,12 @@ class CollectSearchDialog(
|
||||
private fun showDeleteDialog(position: Int, deleteAction: () -> Unit = {}) {
|
||||
WarnDialog(
|
||||
context = context,
|
||||
content = "请确认是否删除物品:${list[position].goodsName}?",
|
||||
content = "请确认是否删除物品:${list[position].goodsName?.split("WP")?.get(0)}?",
|
||||
cancelBlock = {
|
||||
this@CollectSearchDialog.clickIndex = -1
|
||||
list[position].isSelected = false
|
||||
searchAdapter.notifyItemChanged(position)
|
||||
},
|
||||
confirmBlock = {
|
||||
// Thread {
|
||||
// }.start()
|
||||
|
||||
@@ -8,11 +8,9 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.sw.inbound.activity.GoodsListActivity
|
||||
import com.sw.inbound.adapter.RecognizeAdapter
|
||||
import com.sw.inbound.databinding.DialogGoodsRecognizeBinding
|
||||
import com.sw.inbound.databinding.LayoutEmptyRecognizeBinding
|
||||
import com.sw.inbound.model.response.SearchGoodsInfo
|
||||
import com.sw.inbound.utils.ext.clickWithDebounce
|
||||
import com.sw.inbound.utils.ext.gone
|
||||
import com.sw.inbound.utils.ext.toast
|
||||
import com.sw.inbound.utils.ext.visible
|
||||
import java.io.File
|
||||
|
||||
|
||||
@@ -114,28 +114,7 @@ class GoodsStoreDialog(
|
||||
) { dictType ->
|
||||
try {
|
||||
v.hideKeyboard()
|
||||
binding.tvProcurementUnit.run {
|
||||
text = dictType.value
|
||||
tag = dictType.id
|
||||
}
|
||||
val unit = dictType.value
|
||||
binding.tvCountUnit.text = unit
|
||||
binding.etProcurementCount.let {
|
||||
//it.isEnabled = true
|
||||
it.inputType = if (unit == "千克" || unit == "公斤" || unit == "斤") {
|
||||
InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_FLAG_DECIMAL
|
||||
} else {
|
||||
InputType.TYPE_CLASS_NUMBER
|
||||
}
|
||||
}
|
||||
val first = goods.unitVoList!!.first { it.businessUnitId == dictType.id }
|
||||
val stringBuilder =
|
||||
StringBuilder().append("1").append(dictType.value).append("=")
|
||||
.append(first.purchaseValue!!.toInt().toString())
|
||||
.append(goods.kcUnitName).append(",").append("1")
|
||||
.append(goods.kcUnitName).append("=").append(first.consumeValue)
|
||||
.append("克")
|
||||
binding.tvUnitCalculate.text = stringBuilder.toString()
|
||||
loadDropdownMenu(dictType)
|
||||
//val count = getUnitCount(dictType.id!!)
|
||||
//if (count.isBlank() || "0" == count) {
|
||||
// //context.toast("入库数量不能为0")
|
||||
@@ -206,9 +185,60 @@ class GoodsStoreDialog(
|
||||
if (it.isNullOrBlank()) invisible() else visible()
|
||||
}
|
||||
}
|
||||
setPurchaseOrderInfo()
|
||||
addWeightListener()
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载下拉菜单
|
||||
*/
|
||||
private fun loadDropdownMenu(dictType: DictType) {
|
||||
binding.tvProcurementUnit.run {
|
||||
text = dictType.value
|
||||
tag = dictType.id
|
||||
}
|
||||
val unit = dictType.value
|
||||
binding.tvCountUnit.text = unit
|
||||
binding.etProcurementCount.let {
|
||||
//it.isEnabled = true
|
||||
it.inputType = if (unit == "千克" || unit == "公斤" || unit == "斤") {
|
||||
InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_FLAG_DECIMAL
|
||||
} else {
|
||||
InputType.TYPE_CLASS_NUMBER
|
||||
}
|
||||
}
|
||||
val first = goods.unitVoList!!.first { it.businessUnitId == dictType.id }
|
||||
val stringBuilder =
|
||||
StringBuilder().append("1").append(dictType.value).append("=")
|
||||
.append(first.purchaseValue!!.toInt().toString())
|
||||
.append(goods.kcUnitName).append(",").append("1")
|
||||
.append(goods.kcUnitName).append("=").append(first.consumeValue)
|
||||
.append("克")
|
||||
binding.tvUnitCalculate.text = stringBuilder.toString()
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置采购单信息
|
||||
*/
|
||||
private fun setPurchaseOrderInfo() {
|
||||
isLoadPurchaseOrderInfo = false
|
||||
val item = activity?.goodsList?.firstOrNull { it.goodId == goods.id }
|
||||
if (item == null || dropdownList.isEmpty()) return
|
||||
val unit = item.unitNameBak
|
||||
val price = item.recPriceExItemBak
|
||||
val amount = item.recUnitPriceTaxInBak
|
||||
val count = item.receiveCountBak
|
||||
|
||||
val dictType = dropdownList.firstOrNull { it.value == unit }
|
||||
if (dictType == null) return
|
||||
loadDropdownMenu(dictType)
|
||||
|
||||
count?.let { binding.etProcurementCount.setText("$count") }
|
||||
price?.let { binding.tvProcurementPrice.text = "$price" }
|
||||
amount?.let { binding.etProcurementAmount.setText("$amount") }
|
||||
isLoadPurchaseOrderInfo = true
|
||||
}
|
||||
private var isLoadPurchaseOrderInfo = true
|
||||
private fun addWeightListener() {
|
||||
activity?.readWeightInfo { weight ->
|
||||
if (abs(this.realWeight - weight) < 10 && binding.etProcurementCount.text.isNotBlank()) {
|
||||
@@ -217,7 +247,7 @@ class GoodsStoreDialog(
|
||||
}
|
||||
this.realWeight = weight
|
||||
binding.tvTotalWeight.text = getSpannable(weight)
|
||||
if (binding.etProcurementCount.isFocused) {
|
||||
if (isLoadPurchaseOrderInfo || binding.etProcurementCount.isFocused) {
|
||||
return@readWeightInfo
|
||||
}
|
||||
val unitTag = binding.tvProcurementUnit.tag
|
||||
|
||||
@@ -54,13 +54,15 @@ data class GoodsInfo(
|
||||
* 采购数量
|
||||
*/
|
||||
var receiveCount: Double? = null,
|
||||
var receiveCountBak: Double? = null,
|
||||
|
||||
/**
|
||||
* 金额
|
||||
*/
|
||||
var recPriceExItem: Double? = null,
|
||||
var recPriceExItemBak: Double? = null,
|
||||
// 金额 界面显示
|
||||
var recPriceExItemTemp: String = "",
|
||||
// var recPriceExItemTemp: String = "",
|
||||
/**
|
||||
* 仓库id
|
||||
*/
|
||||
@@ -144,16 +146,16 @@ data class GoodsInfo(
|
||||
return receivedNum?.toSafeString(unitName) ?: "0"
|
||||
}
|
||||
|
||||
val dualCountStr: String
|
||||
get() {
|
||||
return if (receivedNum != null && receivedNum != 0.toDouble() && receiveCount != null && receiveCount != 0.toDouble()) {
|
||||
"${receivedNum.toSafeString(unitName)}/${receiveCount.toSafeString(unitName)}"
|
||||
} else if (receivedNum != null && receivedNum != 0.toDouble()) {
|
||||
"${receivedNum.toSafeString(unitName)}/-"
|
||||
} else {
|
||||
receiveCountListStr
|
||||
}
|
||||
}
|
||||
// val dualCountStr: String
|
||||
// get() {
|
||||
// return if (receivedNum != null && receivedNum != 0.toDouble() && receiveCount != null && receiveCount != 0.toDouble()) {
|
||||
// "${receivedNum.toSafeString(unitName)}/${receiveCount.toSafeString(unitName)}"
|
||||
// } else if (receivedNum != null && receivedNum != 0.toDouble()) {
|
||||
// "${receivedNum.toSafeString(unitName)}/-"
|
||||
// } else {
|
||||
// receiveCountListStr
|
||||
// }
|
||||
// }
|
||||
|
||||
val recUnitPriceTaxInStr: String
|
||||
get() {
|
||||
@@ -167,11 +169,11 @@ data class GoodsInfo(
|
||||
return recUnitPriceTaxIn?.toFormattedString() ?: "-"
|
||||
}
|
||||
|
||||
val newRecUnitPriceTaxInListStr: String
|
||||
get() {
|
||||
if (newRecUnitPriceTaxIn == 0.toDouble()) return "-"
|
||||
return newRecUnitPriceTaxIn?.toFormattedString() ?: "-"
|
||||
}
|
||||
// val newRecUnitPriceTaxInListStr: String
|
||||
// get() {
|
||||
// if (newRecUnitPriceTaxIn == 0.toDouble()) return "-"
|
||||
// return newRecUnitPriceTaxIn?.toFormattedString() ?: "-"
|
||||
// }
|
||||
|
||||
val receiveCountStr: String
|
||||
get() {
|
||||
@@ -180,13 +182,13 @@ data class GoodsInfo(
|
||||
else -> receiveCount?.toSafeString(unitName) ?: ""
|
||||
}
|
||||
}
|
||||
val receiveCountListStr: String
|
||||
get() {
|
||||
return when (receiveCount) {
|
||||
0.toDouble() -> "-"
|
||||
else -> receiveCount?.toSafeString(unitName) ?: "-"
|
||||
}
|
||||
}
|
||||
// val receiveCountListStr: String
|
||||
// get() {
|
||||
// return when (receiveCount) {
|
||||
// 0.toDouble() -> "-"
|
||||
// else -> receiveCount?.toSafeString(unitName) ?: "-"
|
||||
// }
|
||||
// }
|
||||
|
||||
val recPriceExItemStr: String
|
||||
get() {
|
||||
@@ -195,13 +197,13 @@ data class GoodsInfo(
|
||||
else -> recPriceExItem?.toFormattedString() ?: ""
|
||||
}
|
||||
}
|
||||
val recPriceExItemListStr: String
|
||||
get() {
|
||||
return when (recPriceExItem) {
|
||||
0.toDouble() -> "-"
|
||||
else -> recPriceExItem?.toFormattedString() ?: "-"
|
||||
}
|
||||
}
|
||||
// val recPriceExItemListStr: String
|
||||
// get() {
|
||||
// return when (recPriceExItem) {
|
||||
// 0.toDouble() -> "-"
|
||||
// else -> recPriceExItem?.toFormattedString() ?: "-"
|
||||
// }
|
||||
// }
|
||||
|
||||
val unitNameStr: String
|
||||
get() {
|
||||
@@ -220,14 +222,14 @@ data class GoodsInfo(
|
||||
return goodsWeight?.toFormattedString() ?: ""
|
||||
}
|
||||
|
||||
val goodsWeightUnitStr: String
|
||||
get() {
|
||||
return if (goodsWeight == null || goodsWeight!!.toInt() < 1) {
|
||||
"克"
|
||||
} else {
|
||||
"千克"
|
||||
}
|
||||
}
|
||||
// val goodsWeightUnitStr: String
|
||||
// get() {
|
||||
// return if (goodsWeight == null || goodsWeight!!.toInt() < 1) {
|
||||
// "克"
|
||||
// } else {
|
||||
// "千克"
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
var purchaseUnitIdStr: String
|
||||
@@ -238,30 +240,30 @@ data class GoodsInfo(
|
||||
return GlobalData.unitTypeList.find { it.id == purchaseUnitId.toString() }?.value ?: ""
|
||||
}
|
||||
|
||||
val warehouseNameStr: String
|
||||
get() {
|
||||
if (warehouseName == null) {
|
||||
return ""
|
||||
}
|
||||
return warehouseName!!
|
||||
}
|
||||
// val warehouseNameStr: String
|
||||
// get() {
|
||||
// if (warehouseName == null) {
|
||||
// return ""
|
||||
// }
|
||||
// return warehouseName!!
|
||||
// }
|
||||
|
||||
fun hasNullField(): String? {
|
||||
if (warehouseId.isNullOrBlank()) {
|
||||
return "请选择仓库"
|
||||
}
|
||||
if (receivedNum == null || receivedNum == 0.toDouble()) {
|
||||
return "请输入收货数量或进行称重"
|
||||
}
|
||||
if (newRecUnitPriceTaxIn == null || newRecUnitPriceTaxIn == 0.toDouble()) {
|
||||
return "请输入收货单价"
|
||||
}
|
||||
if (recPriceExItem == null || recPriceExItem == 0.toDouble()) {
|
||||
return "请输入收货金额"
|
||||
}
|
||||
if (goodsWeight == null || goodsWeight!!.toFloat() <= 0) {
|
||||
return "请放入要称重的物品"
|
||||
}
|
||||
return null
|
||||
}
|
||||
// fun hasNullField(): String? {
|
||||
// if (warehouseId.isNullOrBlank()) {
|
||||
// return "请选择仓库"
|
||||
// }
|
||||
// if (receivedNum == null || receivedNum == 0.toDouble()) {
|
||||
// return "请输入收货数量或进行称重"
|
||||
// }
|
||||
// if (newRecUnitPriceTaxIn == null || newRecUnitPriceTaxIn == 0.toDouble()) {
|
||||
// return "请输入收货单价"
|
||||
// }
|
||||
// if (recPriceExItem == null || recPriceExItem == 0.toDouble()) {
|
||||
// return "请输入收货金额"
|
||||
// }
|
||||
// if (goodsWeight == null || goodsWeight!!.toFloat() <= 0) {
|
||||
// return "请放入要称重的物品"
|
||||
// }
|
||||
// return null
|
||||
// }
|
||||
}
|
||||
@@ -183,6 +183,10 @@ object ObjectBox {
|
||||
box?.put(entities)
|
||||
}
|
||||
|
||||
suspend fun count(name: String) = safeDbOp {
|
||||
getBox<Food>()?.all?.count() { it.name == name }
|
||||
} ?: 0
|
||||
|
||||
suspend fun filter(name: String?) = safeDbOp {
|
||||
val list = getBox<Food>()?.all?.distinctBy { it.name }
|
||||
if (name.isNullOrBlank().not()) {
|
||||
|
||||
@@ -1,157 +1,157 @@
|
||||
package com.sw.inbound.ui.weight
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.itemsIndexed
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.colorResource
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.sw.inbound.R
|
||||
import com.sw.inbound.ext.bold
|
||||
import com.sw.inbound.model.response.GoodsInfo
|
||||
import com.sw.inbound.ui.theme.AppTypography
|
||||
import com.sw.inbound.ui.theme.Gray_DCDCF0
|
||||
|
||||
/**
|
||||
* 收货-未调整列表
|
||||
*/
|
||||
@Composable
|
||||
fun ReceiptUnadjustedListView(
|
||||
modifier: Modifier = Modifier,
|
||||
productList: List<GoodsInfo>,
|
||||
checkedItem: GoodsInfo? = null,
|
||||
onItemCheckedClick: (Int, GoodsInfo) -> Unit = { _, _ -> },
|
||||
showClose: Boolean = false,
|
||||
onCloseClick: (GoodsInfo) -> Unit = {},
|
||||
) {
|
||||
var selectIndex by remember { mutableIntStateOf(-1) }
|
||||
|
||||
Column(
|
||||
modifier = modifier
|
||||
// .padding(horizontal = 30.dp)
|
||||
) {
|
||||
// 左侧列表标题
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 60.dp)
|
||||
.height(84.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
CustomSingleRightText(
|
||||
modifier = Modifier.weight(1f),
|
||||
text = "名称",
|
||||
style = AppTypography.gray96a0aaTextStyle.bold(),
|
||||
textAlign = TextAlign.Start
|
||||
)
|
||||
Spacer(modifier = Modifier.width(10.dp))
|
||||
CustomSingleRightText(
|
||||
modifier = Modifier.width(120.dp),
|
||||
text = "单价(元)",
|
||||
style = AppTypography.gray96a0aaTextStyle.bold()
|
||||
)
|
||||
Spacer(modifier = Modifier.width(20.dp))
|
||||
CustomSingleRightText(
|
||||
modifier = Modifier.width(200.dp),
|
||||
text = "数量",
|
||||
style = AppTypography.gray96a0aaTextStyle.bold()
|
||||
)
|
||||
Spacer(modifier = Modifier.width(20.dp))
|
||||
CustomSingleRightText(
|
||||
modifier = Modifier.width(120.dp),
|
||||
text = "金额(元)",
|
||||
style = AppTypography.gray96a0aaTextStyle.bold()
|
||||
)
|
||||
if (showClose) {
|
||||
Spacer(modifier = Modifier.width(78.dp))
|
||||
}
|
||||
}
|
||||
// Spacer(modifier = Modifier.height(31.dp))
|
||||
HorizontalDivider(thickness = 1.dp, color = colorResource(R.color.divider))
|
||||
// Spacer(modifier = Modifier.height(31.dp))
|
||||
// 左侧列表
|
||||
LazyColumn() {
|
||||
itemsIndexed(
|
||||
items = productList,
|
||||
// key = { index, it -> it.id ?: index }) { index, it ->
|
||||
key = { index, it -> index }) { index, it ->
|
||||
|
||||
val checkedBg =
|
||||
if (/*selectIndex == index ||*/ checkedItem?.id == it.id) Gray_DCDCF0 else Color.Transparent
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.background(color = checkedBg)
|
||||
.height(80.dp)
|
||||
.padding(horizontal = 60.dp)
|
||||
.clickable {
|
||||
selectIndex = index
|
||||
onItemCheckedClick(index, it)
|
||||
}, verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
CustomSingleRightText(
|
||||
modifier = Modifier.weight(1f),
|
||||
text = it.goodNameStr,
|
||||
textAlign = TextAlign.Start
|
||||
)
|
||||
Spacer(modifier = Modifier.width(10.dp))
|
||||
CustomSingleRightText(
|
||||
modifier = Modifier.width(120.dp),
|
||||
text = it.recUnitPriceTaxInListStr,
|
||||
style = AppTypography.blackTextStyle
|
||||
)
|
||||
Spacer(modifier = Modifier.width(20.dp))
|
||||
CustomSingleRightText(
|
||||
modifier = Modifier.width(200.dp),
|
||||
text = "${it.dualCountStr}${it.unitNameStr}",
|
||||
style = AppTypography.blackTextStyle
|
||||
)
|
||||
Spacer(modifier = Modifier.width(20.dp))
|
||||
CustomSingleRightText(
|
||||
modifier = Modifier.width(120.dp),
|
||||
text = it.recPriceExItemListStr,
|
||||
style = AppTypography.blackTextStyle
|
||||
)
|
||||
if (showClose) {
|
||||
Spacer(modifier = Modifier.width(30.dp))
|
||||
Image(
|
||||
modifier = Modifier
|
||||
.size(48.dp)
|
||||
.clickable {
|
||||
onCloseClick(it)
|
||||
},
|
||||
painter = painterResource(R.mipmap.ic_delete),
|
||||
contentDescription = "删除"
|
||||
)
|
||||
}
|
||||
}
|
||||
// Spacer(modifier = Modifier.height(33.dp))
|
||||
// if (productList.indexOf(it) != productList.lastIndex)
|
||||
HorizontalDivider(
|
||||
thickness = 1.dp,
|
||||
color = colorResource(R.color.divider)
|
||||
)
|
||||
// Spacer(modifier = Modifier.height(33.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//package com.sw.inbound.ui.weight
|
||||
//
|
||||
//import androidx.compose.foundation.Image
|
||||
//import androidx.compose.foundation.background
|
||||
//import androidx.compose.foundation.clickable
|
||||
//import androidx.compose.foundation.layout.Column
|
||||
//import androidx.compose.foundation.layout.Row
|
||||
//import androidx.compose.foundation.layout.Spacer
|
||||
//import androidx.compose.foundation.layout.fillMaxWidth
|
||||
//import androidx.compose.foundation.layout.height
|
||||
//import androidx.compose.foundation.layout.padding
|
||||
//import androidx.compose.foundation.layout.size
|
||||
//import androidx.compose.foundation.layout.width
|
||||
//import androidx.compose.foundation.lazy.LazyColumn
|
||||
//import androidx.compose.foundation.lazy.itemsIndexed
|
||||
//import androidx.compose.material3.HorizontalDivider
|
||||
//import androidx.compose.runtime.Composable
|
||||
//import androidx.compose.runtime.getValue
|
||||
//import androidx.compose.runtime.mutableIntStateOf
|
||||
//import androidx.compose.runtime.remember
|
||||
//import androidx.compose.runtime.setValue
|
||||
//import androidx.compose.ui.Alignment
|
||||
//import androidx.compose.ui.Modifier
|
||||
//import androidx.compose.ui.graphics.Color
|
||||
//import androidx.compose.ui.res.colorResource
|
||||
//import androidx.compose.ui.res.painterResource
|
||||
//import androidx.compose.ui.text.style.TextAlign
|
||||
//import androidx.compose.ui.unit.dp
|
||||
//import com.sw.inbound.R
|
||||
//import com.sw.inbound.ext.bold
|
||||
//import com.sw.inbound.model.response.GoodsInfo
|
||||
//import com.sw.inbound.ui.theme.AppTypography
|
||||
//import com.sw.inbound.ui.theme.Gray_DCDCF0
|
||||
//
|
||||
///**
|
||||
// * 收货-未调整列表
|
||||
// */
|
||||
//@Composable
|
||||
//fun ReceiptUnadjustedListView(
|
||||
// modifier: Modifier = Modifier,
|
||||
// productList: List<GoodsInfo>,
|
||||
// checkedItem: GoodsInfo? = null,
|
||||
// onItemCheckedClick: (Int, GoodsInfo) -> Unit = { _, _ -> },
|
||||
// showClose: Boolean = false,
|
||||
// onCloseClick: (GoodsInfo) -> Unit = {},
|
||||
//) {
|
||||
// var selectIndex by remember { mutableIntStateOf(-1) }
|
||||
//
|
||||
// Column(
|
||||
// modifier = modifier
|
||||
//// .padding(horizontal = 30.dp)
|
||||
// ) {
|
||||
// // 左侧列表标题
|
||||
// Row(
|
||||
// modifier = Modifier
|
||||
// .fillMaxWidth()
|
||||
// .padding(horizontal = 60.dp)
|
||||
// .height(84.dp),
|
||||
// verticalAlignment = Alignment.CenterVertically
|
||||
// ) {
|
||||
// CustomSingleRightText(
|
||||
// modifier = Modifier.weight(1f),
|
||||
// text = "名称",
|
||||
// style = AppTypography.gray96a0aaTextStyle.bold(),
|
||||
// textAlign = TextAlign.Start
|
||||
// )
|
||||
// Spacer(modifier = Modifier.width(10.dp))
|
||||
// CustomSingleRightText(
|
||||
// modifier = Modifier.width(120.dp),
|
||||
// text = "单价(元)",
|
||||
// style = AppTypography.gray96a0aaTextStyle.bold()
|
||||
// )
|
||||
// Spacer(modifier = Modifier.width(20.dp))
|
||||
// CustomSingleRightText(
|
||||
// modifier = Modifier.width(200.dp),
|
||||
// text = "数量",
|
||||
// style = AppTypography.gray96a0aaTextStyle.bold()
|
||||
// )
|
||||
// Spacer(modifier = Modifier.width(20.dp))
|
||||
// CustomSingleRightText(
|
||||
// modifier = Modifier.width(120.dp),
|
||||
// text = "金额(元)",
|
||||
// style = AppTypography.gray96a0aaTextStyle.bold()
|
||||
// )
|
||||
// if (showClose) {
|
||||
// Spacer(modifier = Modifier.width(78.dp))
|
||||
// }
|
||||
// }
|
||||
//// Spacer(modifier = Modifier.height(31.dp))
|
||||
// HorizontalDivider(thickness = 1.dp, color = colorResource(R.color.divider))
|
||||
//// Spacer(modifier = Modifier.height(31.dp))
|
||||
// // 左侧列表
|
||||
// LazyColumn() {
|
||||
// itemsIndexed(
|
||||
// items = productList,
|
||||
//// key = { index, it -> it.id ?: index }) { index, it ->
|
||||
// key = { index, it -> index }) { index, it ->
|
||||
//
|
||||
// val checkedBg =
|
||||
// if (/*selectIndex == index ||*/ checkedItem?.id == it.id) Gray_DCDCF0 else Color.Transparent
|
||||
// Row(
|
||||
// modifier = Modifier
|
||||
// .background(color = checkedBg)
|
||||
// .height(80.dp)
|
||||
// .padding(horizontal = 60.dp)
|
||||
// .clickable {
|
||||
// selectIndex = index
|
||||
// onItemCheckedClick(index, it)
|
||||
// }, verticalAlignment = Alignment.CenterVertically
|
||||
// ) {
|
||||
// CustomSingleRightText(
|
||||
// modifier = Modifier.weight(1f),
|
||||
// text = it.goodNameStr,
|
||||
// textAlign = TextAlign.Start
|
||||
// )
|
||||
// Spacer(modifier = Modifier.width(10.dp))
|
||||
// CustomSingleRightText(
|
||||
// modifier = Modifier.width(120.dp),
|
||||
// text = it.recUnitPriceTaxInListStr,
|
||||
// style = AppTypography.blackTextStyle
|
||||
// )
|
||||
// Spacer(modifier = Modifier.width(20.dp))
|
||||
// CustomSingleRightText(
|
||||
// modifier = Modifier.width(200.dp),
|
||||
// text = "${it.dualCountStr}${it.unitNameStr}",
|
||||
// style = AppTypography.blackTextStyle
|
||||
// )
|
||||
// Spacer(modifier = Modifier.width(20.dp))
|
||||
// CustomSingleRightText(
|
||||
// modifier = Modifier.width(120.dp),
|
||||
// text = it.recPriceExItemListStr,
|
||||
// style = AppTypography.blackTextStyle
|
||||
// )
|
||||
// if (showClose) {
|
||||
// Spacer(modifier = Modifier.width(30.dp))
|
||||
// Image(
|
||||
// modifier = Modifier
|
||||
// .size(48.dp)
|
||||
// .clickable {
|
||||
// onCloseClick(it)
|
||||
// },
|
||||
// painter = painterResource(R.mipmap.ic_delete),
|
||||
// contentDescription = "删除"
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
//// Spacer(modifier = Modifier.height(33.dp))
|
||||
//// if (productList.indexOf(it) != productList.lastIndex)
|
||||
// HorizontalDivider(
|
||||
// thickness = 1.dp,
|
||||
// color = colorResource(R.color.divider)
|
||||
// )
|
||||
//// Spacer(modifier = Modifier.height(33.dp))
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
Reference in New Issue
Block a user