自采入库同一物品可以添加多次
This commit is contained in:
@@ -111,6 +111,12 @@ data class GoodsInfo(
|
|||||||
return recUnitPriceTaxIn?.toFormattedString() ?: ""
|
return recUnitPriceTaxIn?.toFormattedString() ?: ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val recUnitPriceTaxInListStr: String
|
||||||
|
get() {
|
||||||
|
if (recUnitPriceTaxIn == 0f) return "-"
|
||||||
|
return recUnitPriceTaxIn?.toFormattedString() ?: "-"
|
||||||
|
}
|
||||||
|
|
||||||
val receiveCountStr: String
|
val receiveCountStr: String
|
||||||
get() {
|
get() {
|
||||||
return when (receiveCount) {
|
return when (receiveCount) {
|
||||||
@@ -118,6 +124,13 @@ data class GoodsInfo(
|
|||||||
else -> receiveCount?.toSafeString(unitName) ?: ""
|
else -> receiveCount?.toSafeString(unitName) ?: ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val receiveCountListStr: String
|
||||||
|
get() {
|
||||||
|
return when (receiveCount) {
|
||||||
|
0f -> "-"
|
||||||
|
else -> receiveCount?.toSafeString(unitName) ?: "-"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val recPriceExItemStr: String
|
val recPriceExItemStr: String
|
||||||
get() {
|
get() {
|
||||||
@@ -126,6 +139,13 @@ data class GoodsInfo(
|
|||||||
else -> recPriceExItem?.toFormattedString() ?: ""
|
else -> recPriceExItem?.toFormattedString() ?: ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val recPriceExItemListStr: String
|
||||||
|
get() {
|
||||||
|
return when (recPriceExItem) {
|
||||||
|
0f -> "-"
|
||||||
|
else -> recPriceExItem?.toFormattedString() ?: "-"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val unitNameStr: String
|
val unitNameStr: String
|
||||||
get() {
|
get() {
|
||||||
|
|||||||
@@ -106,19 +106,19 @@ fun ReceiptUnadjustedListView(
|
|||||||
Spacer(modifier = Modifier.width(10.dp))
|
Spacer(modifier = Modifier.width(10.dp))
|
||||||
CustomSingleRightText(
|
CustomSingleRightText(
|
||||||
modifier = Modifier.width(120.dp),
|
modifier = Modifier.width(120.dp),
|
||||||
text = it.recUnitPriceTaxInStr,
|
text = it.recUnitPriceTaxInListStr,
|
||||||
style = AppTypography.blackTextStyle
|
style = AppTypography.blackTextStyle
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.width(20.dp))
|
Spacer(modifier = Modifier.width(20.dp))
|
||||||
CustomSingleRightText(
|
CustomSingleRightText(
|
||||||
modifier = Modifier.width(140.dp),
|
modifier = Modifier.width(140.dp),
|
||||||
text = "${it.receiveCountStr}${it.unitNameStr}",
|
text = "${it.receiveCountListStr}${it.unitNameStr}",
|
||||||
style = AppTypography.blackTextStyle
|
style = AppTypography.blackTextStyle
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.width(20.dp))
|
Spacer(modifier = Modifier.width(20.dp))
|
||||||
CustomSingleRightText(
|
CustomSingleRightText(
|
||||||
modifier = Modifier.width(120.dp),
|
modifier = Modifier.width(120.dp),
|
||||||
text = it.recPriceExItemStr,
|
text = it.recPriceExItemListStr,
|
||||||
style = AppTypography.blackTextStyle
|
style = AppTypography.blackTextStyle
|
||||||
)
|
)
|
||||||
if (showClose) {
|
if (showClose) {
|
||||||
|
|||||||
@@ -82,7 +82,11 @@ fun SelfProcurementListItem(
|
|||||||
// Spacer(modifier = Modifier.height(31.dp))
|
// Spacer(modifier = Modifier.height(31.dp))
|
||||||
// 左侧列表
|
// 左侧列表
|
||||||
LazyColumn() {
|
LazyColumn() {
|
||||||
items(items = productList, key = { it.goodsId }) { it ->
|
items(
|
||||||
|
items = productList,
|
||||||
|
// 取消key,列表中可以插入同一物品
|
||||||
|
// key = { it.goodsId }
|
||||||
|
) { it ->
|
||||||
|
|
||||||
val checkedBg =
|
val checkedBg =
|
||||||
if (it.goodsId == checkedItem?.goodsId) Gray_DCDCF0 else Color.Transparent
|
if (it.goodsId == checkedItem?.goodsId) Gray_DCDCF0 else Color.Transparent
|
||||||
|
|||||||
@@ -213,17 +213,8 @@ class SelfProcurementViewModel @Inject constructor(
|
|||||||
|
|
||||||
// 添加订单
|
// 添加订单
|
||||||
fun addPurchaseItem(purchaseOrder: PurchaseWarehouseParam) {
|
fun addPurchaseItem(purchaseOrder: PurchaseWarehouseParam) {
|
||||||
if (_purchaseList.value.any { it.goodsId == purchaseOrder.goodsId }) {
|
|
||||||
ToastUtils.showToast("添加失败,当前物品已添加")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
_purchaseList.update { currentList ->
|
_purchaseList.update { currentList ->
|
||||||
// 当已经添加过则忽略
|
|
||||||
if (currentList.any { it.goodsId == purchaseOrder.goodsId }) {
|
|
||||||
currentList
|
|
||||||
} else {
|
|
||||||
currentList + purchaseOrder
|
currentList + purchaseOrder
|
||||||
}
|
|
||||||
}
|
}
|
||||||
updateSelectedItem(null)
|
updateSelectedItem(null)
|
||||||
}
|
}
|
||||||
@@ -355,6 +346,9 @@ class SelfProcurementViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物品提交入库
|
||||||
|
*/
|
||||||
fun addToWarehouse() {
|
fun addToWarehouse() {
|
||||||
if (_purchaseList.value.isEmpty()) {
|
if (_purchaseList.value.isEmpty()) {
|
||||||
ToastUtils.showToast("采购列表为空")
|
ToastUtils.showToast("采购列表为空")
|
||||||
|
|||||||
Reference in New Issue
Block a user