屏蔽自采购清空

This commit is contained in:
zxj
2025-07-11 13:37:53 +08:00
parent a88321b7b6
commit 7459bd205a
3 changed files with 16 additions and 10 deletions
@@ -84,6 +84,9 @@ class SelfProcurementViewModel @Inject constructor(
_globalWarehouse.value = dictType
}
/**
* 开始称重
*/
fun startSensorScale() {
Timber.d("开始称重")
SensorScaleUtils.startScale(callback = { weight ->
@@ -111,18 +114,18 @@ class SelfProcurementViewModel @Inject constructor(
Timber.d("startSensorScale goodsUnitPrice = ${info.goodsUnitPrice}, goodsPrice = ${info.goodsPrice} ")
// 计算单价 金额不为空,数量也不为空, 不是数量输入 也不是单价输入
val finalPrice =
if (count == 0.0) {
if (finalCount == 0.0) {
0.0
} else if (_amountUserInput.value && !_priceUserInput.value) {
info.goodsPrice.div(count).toSafeDouble()
info.goodsPrice.div(finalCount).toSafeDouble()
} else 0.0
// 计算金额 单价不为空,不是数量输入 也不是金额输入
val finalAmount =
if (count == 0.0) {
if (finalCount == 0.0) {
0.0
} else if (_priceUserInput.value && !_amountUserInput.value) {
count.times(info.goodsUnitPrice).toSafeDouble()
finalCount.times(info.goodsUnitPrice).toSafeDouble()
} else 0.0
Timber.d("startSensorScale finalPrice = $finalPrice, finalAmount = $finalAmount ")
_selectedItem.value = info.copy(