屏蔽自采购清空
This commit is contained in:
@@ -121,7 +121,7 @@ fun SelfProcurementScreen(
|
||||
BottomActionBar(onLeftButtonClick = {
|
||||
Timber.d("点击后退 onDispose time = ${System.currentTimeMillis()}")
|
||||
controller.popBackStack()
|
||||
}, showRight1Button = true, right1ButtonText = "清空物品", onRight1ButtonClick = {
|
||||
}, showRight1Button = false, right1ButtonText = "清空物品", onRight1ButtonClick = {
|
||||
viewModel.clearPurchaseOrders()
|
||||
ToastUtils.showToast("物品清空成功")
|
||||
}, right2ButtonText = "提交入库", onRight2ButtonClick = {
|
||||
@@ -232,6 +232,9 @@ fun ContentRightView(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 中间组件-菜品识别
|
||||
*/
|
||||
@Composable
|
||||
fun ProductIdentification(viewModel: SelfProcurementViewModel) {
|
||||
val searchResultList by viewModel.searchListItems.collectAsState()
|
||||
|
||||
@@ -258,24 +258,24 @@ class ReceiptViewModel @Inject constructor(
|
||||
Timber.d("startSensorScale weight = $weight, count = $count, finalCount = $finalCount, consumeValue = $consumeValue, purchaseValue = $purchaseValue")
|
||||
// 计算单价
|
||||
val finalPrice = when {
|
||||
count == 0.0 -> {
|
||||
finalCount == 0f -> {
|
||||
0f
|
||||
}
|
||||
|
||||
_amountUserInput.value && !_priceUserInput.value -> {
|
||||
info.recPriceExItem!!.div(count).toSafeFloat()
|
||||
info.recPriceExItem!!.div(finalCount).toSafeFloat()
|
||||
}
|
||||
|
||||
else -> 0f
|
||||
}
|
||||
// 计算金额
|
||||
val finalAmount = when {
|
||||
count == 0.0 -> {
|
||||
finalCount == 0f -> {
|
||||
0f
|
||||
}
|
||||
|
||||
_priceUserInput.value && !_amountUserInput.value -> {
|
||||
count.times(info.recUnitPriceTaxIn!!).toSafeFloat()
|
||||
finalCount.times(info.recUnitPriceTaxIn!!).toSafeFloat()
|
||||
}
|
||||
|
||||
else -> 0f
|
||||
@@ -284,7 +284,7 @@ class ReceiptViewModel @Inject constructor(
|
||||
_selectedItem.value = info.copy(
|
||||
goodsWeight = weight.toSafeBigDecimal(),
|
||||
// 收货数量
|
||||
receivedNumTemp = count.toFormattedString(),
|
||||
receivedNumTemp = finalCount.toFormattedString(),
|
||||
receivedNum = finalCount,
|
||||
// 单价
|
||||
recUnitPriceTaxIn = if (_priceUserInput.value) info.recUnitPriceTaxIn else finalPrice,
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user