修复了用户输入状态未重置问题

This commit is contained in:
zxj
2025-07-09 16:18:44 +08:00
parent 6cf7b4fb9b
commit 6cd5069aac
5 changed files with 11 additions and 5 deletions
@@ -135,7 +135,7 @@ data class GoodsAddParam(
if (purchaseValue == null || purchaseValue == 0f) { if (purchaseValue == null || purchaseValue == 0f) {
return "请输入采购单位对应的库存数量" return "请输入采购单位对应的库存数量"
} }
if (purchasePrice == null || purchasePrice == BigDecimal(0)) { if (purchasePrice == null || purchasePrice!!.toFloat() <= 0) {
return "请输入单价" return "请输入单价"
} }
return null return null
@@ -163,6 +163,9 @@ data class PurchaseWarehouseParam(
if (goodsPrice == null || goodsPrice == 0.0) { if (goodsPrice == null || goodsPrice == 0.0) {
return "请输入采购金额" return "请输入采购金额"
} }
if (goodsWeight == null || goodsWeight!!.toFloat() <= 0) {
return "请放入要称重的物品"
}
return null return null
} }
} }
@@ -189,12 +189,9 @@ data class GoodsInfo(
if (recPriceExItem == null || recPriceExItem == 0f) { if (recPriceExItem == null || recPriceExItem == 0f) {
return "请输入收货金额" return "请输入收货金额"
} }
if (goodsWeight == null || goodsWeight == BigDecimal(0)) { if (goodsWeight == null || goodsWeight!!.toFloat() <= 0) {
return "请放入要称重的物品" return "请放入要称重的物品"
} }
return null return null
// return goodName == null || warehouseId == null ||
// purchaseUnitId == null || recUnitPriceTaxIn == null
// || receiveCount == null || recPriceExItem == null
} }
} }
@@ -195,6 +195,9 @@ class ReceiptViewModel @Inject constructor(
weight * 1000 / consumeValue / purchaseValue weight * 1000 / consumeValue / purchaseValue
val finalCount = count.toSafeFloat(currentItem.unitName) val finalCount = count.toSafeFloat(currentItem.unitName)
Timber.d("startSensorScale weight = $weight, count = $count, finalCount = $finalCount, consumeValue = $consumeValue, purchaseValue = $purchaseValue") Timber.d("startSensorScale weight = $weight, count = $count, finalCount = $finalCount, consumeValue = $consumeValue, purchaseValue = $purchaseValue")
if (info.receivedNumTemp.isEmpty()) {
_countUserInput.value = false
}
_selectedItem.value = info.copy( _selectedItem.value = info.copy(
goodsWeight = weight.toSafeBigDecimal(), goodsWeight = weight.toSafeBigDecimal(),
receivedNumTemp = if (_countUserInput.value) info.receivedNumTemp else count.toSafeString( receivedNumTemp = if (_countUserInput.value) info.receivedNumTemp else count.toSafeString(
@@ -89,6 +89,9 @@ class SelfProcurementViewModel @Inject constructor(
weight * 1000 / consumeValue / purchaseValue weight * 1000 / consumeValue / purchaseValue
val finalCount = count.toSafeDouble(currentItem.unitName) val finalCount = count.toSafeDouble(currentItem.unitName)
Timber.d("startSensorScale weight = $weight, count = $count, finalCount = $finalCount, consumeValue = $consumeValue, purchaseValue = $purchaseValue") Timber.d("startSensorScale weight = $weight, count = $count, finalCount = $finalCount, consumeValue = $consumeValue, purchaseValue = $purchaseValue")
if (info.goodsCountTemp.isEmpty()) {
_countUserInput.value = false
}
_selectedItem.value = info.copy( _selectedItem.value = info.copy(
goodsWeight = weight.toSafeBigDecimal(), goodsWeight = weight.toSafeBigDecimal(),
goodsCountTemp = if (_countUserInput.value) info.goodsCountTemp else count.toSafeString( goodsCountTemp = if (_countUserInput.value) info.goodsCountTemp else count.toSafeString(