From 84a337bae4b6cf3ee7cdc04951265d6cd27c4262 Mon Sep 17 00:00:00 2001 From: zxj <275873859@qq.com> Date: Tue, 15 Jul 2025 16:32:30 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E9=87=87=E5=85=A5=E5=BA=93=E5=90=8C?= =?UTF-8?q?=E4=B8=80=E7=89=A9=E5=93=81=E5=8F=AF=E4=BB=A5=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=A4=9A=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sw/inbound/model/response/GoodsInfo.kt | 20 +++++++++++++++++++ .../ui/weight/ReceiptUnadjustedListView.kt | 6 +++--- .../ui/weight/SelfProcurementListItem.kt | 6 +++++- .../viewmodel/SelfProcurementViewModel.kt | 12 +++-------- 4 files changed, 31 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/sw/inbound/model/response/GoodsInfo.kt b/app/src/main/java/com/sw/inbound/model/response/GoodsInfo.kt index 7c393ee..3e86a06 100644 --- a/app/src/main/java/com/sw/inbound/model/response/GoodsInfo.kt +++ b/app/src/main/java/com/sw/inbound/model/response/GoodsInfo.kt @@ -111,6 +111,12 @@ data class GoodsInfo( return recUnitPriceTaxIn?.toFormattedString() ?: "" } + val recUnitPriceTaxInListStr: String + get() { + if (recUnitPriceTaxIn == 0f) return "-" + return recUnitPriceTaxIn?.toFormattedString() ?: "-" + } + val receiveCountStr: String get() { return when (receiveCount) { @@ -118,6 +124,13 @@ data class GoodsInfo( else -> receiveCount?.toSafeString(unitName) ?: "" } } + val receiveCountListStr: String + get() { + return when (receiveCount) { + 0f -> "-" + else -> receiveCount?.toSafeString(unitName) ?: "-" + } + } val recPriceExItemStr: String get() { @@ -126,6 +139,13 @@ data class GoodsInfo( else -> recPriceExItem?.toFormattedString() ?: "" } } + val recPriceExItemListStr: String + get() { + return when (recPriceExItem) { + 0f -> "-" + else -> recPriceExItem?.toFormattedString() ?: "-" + } + } val unitNameStr: String get() { diff --git a/app/src/main/java/com/sw/inbound/ui/weight/ReceiptUnadjustedListView.kt b/app/src/main/java/com/sw/inbound/ui/weight/ReceiptUnadjustedListView.kt index 60cb9ce..5f13791 100644 --- a/app/src/main/java/com/sw/inbound/ui/weight/ReceiptUnadjustedListView.kt +++ b/app/src/main/java/com/sw/inbound/ui/weight/ReceiptUnadjustedListView.kt @@ -106,19 +106,19 @@ fun ReceiptUnadjustedListView( Spacer(modifier = Modifier.width(10.dp)) CustomSingleRightText( modifier = Modifier.width(120.dp), - text = it.recUnitPriceTaxInStr, + text = it.recUnitPriceTaxInListStr, style = AppTypography.blackTextStyle ) Spacer(modifier = Modifier.width(20.dp)) CustomSingleRightText( modifier = Modifier.width(140.dp), - text = "${it.receiveCountStr}${it.unitNameStr}", + text = "${it.receiveCountListStr}${it.unitNameStr}", style = AppTypography.blackTextStyle ) Spacer(modifier = Modifier.width(20.dp)) CustomSingleRightText( modifier = Modifier.width(120.dp), - text = it.recPriceExItemStr, + text = it.recPriceExItemListStr, style = AppTypography.blackTextStyle ) if (showClose) { diff --git a/app/src/main/java/com/sw/inbound/ui/weight/SelfProcurementListItem.kt b/app/src/main/java/com/sw/inbound/ui/weight/SelfProcurementListItem.kt index 21bde7d..1df65eb 100644 --- a/app/src/main/java/com/sw/inbound/ui/weight/SelfProcurementListItem.kt +++ b/app/src/main/java/com/sw/inbound/ui/weight/SelfProcurementListItem.kt @@ -82,7 +82,11 @@ fun SelfProcurementListItem( // Spacer(modifier = Modifier.height(31.dp)) // 左侧列表 LazyColumn() { - items(items = productList, key = { it.goodsId }) { it -> + items( + items = productList, + // 取消key,列表中可以插入同一物品 +// key = { it.goodsId } + ) { it -> val checkedBg = if (it.goodsId == checkedItem?.goodsId) Gray_DCDCF0 else Color.Transparent diff --git a/app/src/main/java/com/sw/inbound/viewmodel/SelfProcurementViewModel.kt b/app/src/main/java/com/sw/inbound/viewmodel/SelfProcurementViewModel.kt index 915d646..351dd13 100644 --- a/app/src/main/java/com/sw/inbound/viewmodel/SelfProcurementViewModel.kt +++ b/app/src/main/java/com/sw/inbound/viewmodel/SelfProcurementViewModel.kt @@ -213,17 +213,8 @@ class SelfProcurementViewModel @Inject constructor( // 添加订单 fun addPurchaseItem(purchaseOrder: PurchaseWarehouseParam) { - if (_purchaseList.value.any { it.goodsId == purchaseOrder.goodsId }) { - ToastUtils.showToast("添加失败,当前物品已添加") - return - } _purchaseList.update { currentList -> - // 当已经添加过则忽略 - if (currentList.any { it.goodsId == purchaseOrder.goodsId }) { - currentList - } else { currentList + purchaseOrder - } } updateSelectedItem(null) } @@ -355,6 +346,9 @@ class SelfProcurementViewModel @Inject constructor( } } + /** + * 物品提交入库 + */ fun addToWarehouse() { if (_purchaseList.value.isEmpty()) { ToastUtils.showToast("采购列表为空")