体重使用稳定值,移除金额校验
This commit is contained in:
@@ -113,16 +113,24 @@ class SelfProcurementViewModel @Inject constructor(
|
||||
val finalPrice =
|
||||
if (count == 0.0) {
|
||||
0.0
|
||||
} else if (info.goodsPrice != 0.0 && !_countUserInput.value && !_priceUserInput.value) {
|
||||
info.goodsPrice.div(count).toSafeDouble()
|
||||
} else if (!_countUserInput.value && !_priceUserInput.value) {
|
||||
if (info.goodsPriceTemp.isNotEmpty()) {
|
||||
info.goodsPrice.div(count).toSafeDouble()
|
||||
} else {
|
||||
0.0
|
||||
}
|
||||
} else info.goodsUnitPrice
|
||||
|
||||
// 计算金额 单价不为空,不是数量输入 也不是金额输入
|
||||
val finalAmount =
|
||||
if (count == 0.0) {
|
||||
0.0
|
||||
} else if (info.goodsUnitPrice != 0.0 && !_countUserInput.value && !_amountUserInput.value) {
|
||||
count.times(info.goodsUnitPrice).toSafeDouble()
|
||||
} else if (!_countUserInput.value && !_amountUserInput.value) {
|
||||
if (info.goodsUnitPriceTemp.isNotEmpty()) {
|
||||
count.times(info.goodsUnitPrice).toSafeDouble()
|
||||
} else {
|
||||
0.0
|
||||
}
|
||||
} else info.goodsPrice
|
||||
Timber.d("startSensorScale finalPrice = $finalPrice, finalAmount = $finalAmount ")
|
||||
_selectedItem.value = info.copy(
|
||||
@@ -154,7 +162,8 @@ class SelfProcurementViewModel @Inject constructor(
|
||||
if (purchaseOrder != null) {
|
||||
purchaseOrder.goodsCount.takeIf { it != 0.0 }?.let { receivedNum ->
|
||||
// 计算金额 单价不为空,并且金额没有手动输入
|
||||
if (purchaseOrder.goodsUnitPrice != 0.0 && !_amountUserInput.value) {
|
||||
// if (purchaseOrder.goodsUnitPrice == 0.0 && !_amountUserInput.value) {
|
||||
if (!_amountUserInput.value) {
|
||||
Timber.d("updateSelectedItem 计算金额")
|
||||
val result =
|
||||
receivedNum.times(purchaseOrder.goodsUnitPrice)
|
||||
@@ -162,7 +171,8 @@ class SelfProcurementViewModel @Inject constructor(
|
||||
purchaseOrder.goodsPriceTemp = result.toFormattedString()
|
||||
}
|
||||
// 计算单价 金额不为空,并且单价没有手动输入
|
||||
if (purchaseOrder.goodsPrice != 0.0 && !_priceUserInput.value) {
|
||||
// if (purchaseOrder.goodsPrice == 0.0 && !_priceUserInput.value) {
|
||||
if (!_priceUserInput.value) {
|
||||
Timber.d("updateSelectedItem 计算单价")
|
||||
val result =
|
||||
purchaseOrder.goodsPrice.div(receivedNum)
|
||||
|
||||
Reference in New Issue
Block a user