修复了部分问题
This commit is contained in:
@@ -15,7 +15,8 @@
|
|||||||
返回值
|
返回值
|
||||||
supplierId 供应商id Integer
|
supplierId 供应商id Integer
|
||||||
supplierName 供应商 String
|
supplierName 供应商 String
|
||||||
receiveCode 收货单号 String
|
receiveCode 收货单号 String 【废弃,界面显示purCode】
|
||||||
|
purCode 采购单号 String
|
||||||
goodCount 物品项 Integer
|
goodCount 物品项 Integer
|
||||||
receiveDate 收货日期 Date
|
receiveDate 收货日期 Date
|
||||||
purchaseDate 采购日期 Date
|
purchaseDate 采购日期 Date
|
||||||
@@ -130,6 +131,7 @@ https://vip.shuziweidao.com/shuwei-zhct/fileUpload/fileUpload
|
|||||||
goodsPurId Integer
|
goodsPurId Integer
|
||||||
warehouseId 仓库id Integer
|
warehouseId 仓库id Integer
|
||||||
recUnitPriceTaxIn 收货单价 Float
|
recUnitPriceTaxIn 收货单价 Float
|
||||||
|
newRecUnitPriceTaxIn 采购单价 Float
|
||||||
receiveCount 收货数量 Float
|
receiveCount 收货数量 Float
|
||||||
recPriceInItem 收货金额 Float
|
recPriceInItem 收货金额 Float
|
||||||
receivedNum 实际收货数量 Float
|
receivedNum 实际收货数量 Float
|
||||||
|
|||||||
@@ -33,6 +33,12 @@ data class GoodsInfo(
|
|||||||
// 单价 界面显示
|
// 单价 界面显示
|
||||||
var recUnitPriceTaxInTemp: String = "",
|
var recUnitPriceTaxInTemp: String = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新单价 部分收货需要
|
||||||
|
*/
|
||||||
|
var newRecUnitPriceTaxIn: Float? = null,
|
||||||
|
|
||||||
|
var newRecUnitPriceTaxInTemp: String = "",
|
||||||
/**
|
/**
|
||||||
* 单位名称
|
* 单位名称
|
||||||
*/
|
*/
|
||||||
@@ -109,7 +115,18 @@ data class GoodsInfo(
|
|||||||
get() {
|
get() {
|
||||||
if (receivedNum == null)
|
if (receivedNum == null)
|
||||||
return "-"
|
return "-"
|
||||||
return receivedNum?.toFormattedString() ?: "-"
|
return receivedNum?.toSafeString(unitName) ?: "-"
|
||||||
|
}
|
||||||
|
|
||||||
|
val dualCountStr: String
|
||||||
|
get() {
|
||||||
|
return if (receivedNum != null && receivedNum != 0f && receiveCount != null && receiveCount != 0f) {
|
||||||
|
"${receivedNum.toSafeString(unitName)}/${receiveCount.toSafeString(unitName)}"
|
||||||
|
} else if (receivedNum != null && receivedNum != 0f) {
|
||||||
|
"${receivedNum.toSafeString(unitName)}/-"
|
||||||
|
} else {
|
||||||
|
receiveCountListStr
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val recUnitPriceTaxInStr: String
|
val recUnitPriceTaxInStr: String
|
||||||
@@ -124,6 +141,12 @@ data class GoodsInfo(
|
|||||||
return recUnitPriceTaxIn?.toFormattedString() ?: "-"
|
return recUnitPriceTaxIn?.toFormattedString() ?: "-"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val newRecUnitPriceTaxInListStr: String
|
||||||
|
get() {
|
||||||
|
if (newRecUnitPriceTaxIn == 0f) return "-"
|
||||||
|
return newRecUnitPriceTaxIn?.toFormattedString() ?: "-"
|
||||||
|
}
|
||||||
|
|
||||||
val receiveCountStr: String
|
val receiveCountStr: String
|
||||||
get() {
|
get() {
|
||||||
return when (receiveCount) {
|
return when (receiveCount) {
|
||||||
@@ -204,7 +227,7 @@ data class GoodsInfo(
|
|||||||
if (receivedNum == null || receivedNum == 0f) {
|
if (receivedNum == null || receivedNum == 0f) {
|
||||||
return "请输入收货数量或进行称重"
|
return "请输入收货数量或进行称重"
|
||||||
}
|
}
|
||||||
if (recUnitPriceTaxIn == null || recUnitPriceTaxIn == 0f) {
|
if (newRecUnitPriceTaxIn == null || newRecUnitPriceTaxIn == 0f) {
|
||||||
return "请输入收货单价"
|
return "请输入收货单价"
|
||||||
}
|
}
|
||||||
if (recPriceExItem == null || recPriceExItem == 0f) {
|
if (recPriceExItem == null || recPriceExItem == 0f) {
|
||||||
|
|||||||
@@ -309,7 +309,7 @@ fun AdjustedView(viewModel: ReceiptViewModel) {
|
|||||||
) {
|
) {
|
||||||
itemsIndexed(
|
itemsIndexed(
|
||||||
items = purchaseAdjustList,
|
items = purchaseAdjustList,
|
||||||
key = { index, it -> it.goodId!! + index }) { index, it ->
|
key = { index, it -> it.id ?: index }) { index, it ->
|
||||||
|
|
||||||
AdjustedViewItem(it, viewModel)
|
AdjustedViewItem(it, viewModel)
|
||||||
}
|
}
|
||||||
@@ -358,7 +358,7 @@ private fun AdjustedViewItem(purchaseOrder: GoodsInfo, viewModel: ReceiptViewMod
|
|||||||
.padding(horizontal = 30.dp)
|
.padding(horizontal = 30.dp)
|
||||||
) {
|
) {
|
||||||
AdjustedRowInputLayout(
|
AdjustedRowInputLayout(
|
||||||
label = "单价", value = purchaseOrder.recUnitPriceTaxInStr,
|
label = "单价", value = purchaseOrder.newRecUnitPriceTaxInListStr,
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
viewModel.updatePurchaseItem(
|
viewModel.updatePurchaseItem(
|
||||||
purchaseOrder = purchaseOrder.copy(
|
purchaseOrder = purchaseOrder.copy(
|
||||||
@@ -593,7 +593,7 @@ private fun ReceiptProductEditView(
|
|||||||
|
|
||||||
RowInputLayout(
|
RowInputLayout(
|
||||||
label = "收货单价",
|
label = "收货单价",
|
||||||
value = selectedItem!!.recUnitPriceTaxInTemp,
|
value = selectedItem!!.newRecUnitPriceTaxInTemp,
|
||||||
trailingLabel = "元",
|
trailingLabel = "元",
|
||||||
isInitUpdate = true,
|
isInitUpdate = true,
|
||||||
onValueChange = { value ->
|
onValueChange = { value ->
|
||||||
@@ -604,8 +604,8 @@ private fun ReceiptProductEditView(
|
|||||||
selectedItem!!.copy(
|
selectedItem!!.copy(
|
||||||
recPriceExItemTemp = "",
|
recPriceExItemTemp = "",
|
||||||
recPriceExItem = 0f,
|
recPriceExItem = 0f,
|
||||||
recUnitPriceTaxInTemp = value,
|
newRecUnitPriceTaxInTemp = value,
|
||||||
recUnitPriceTaxIn = value.toSafeFloat()
|
newRecUnitPriceTaxIn = value.toSafeFloat()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -682,7 +682,7 @@ private fun ReceiptProductEditView(
|
|||||||
return@clickable
|
return@clickable
|
||||||
}
|
}
|
||||||
val expectAmount =
|
val expectAmount =
|
||||||
selectedItem!!.receivedNum!!.times(selectedItem!!.recUnitPriceTaxIn!!)
|
selectedItem!!.receivedNum!!.times(selectedItem!!.newRecUnitPriceTaxIn!!)
|
||||||
.toSafeFloat()
|
.toSafeFloat()
|
||||||
Timber.d("金额判断:期望金额 = $expectAmount, 实际金额 = ${selectedItem!!.recPriceExItem}")
|
Timber.d("金额判断:期望金额 = $expectAmount, 实际金额 = ${selectedItem!!.recPriceExItem}")
|
||||||
// if (expectAmount != selectedItem!!.recPriceExItem) {
|
// if (expectAmount != selectedItem!!.recPriceExItem) {
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ fun ReceiptUnadjustedListView(
|
|||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.width(20.dp))
|
Spacer(modifier = Modifier.width(20.dp))
|
||||||
CustomSingleRightText(
|
CustomSingleRightText(
|
||||||
modifier = Modifier.width(140.dp),
|
modifier = Modifier.width(200.dp),
|
||||||
text = "数量",
|
text = "数量",
|
||||||
style = AppTypography.gray96a0aaTextStyle.bold()
|
style = AppTypography.gray96a0aaTextStyle.bold()
|
||||||
)
|
)
|
||||||
@@ -93,7 +93,7 @@ fun ReceiptUnadjustedListView(
|
|||||||
LazyColumn() {
|
LazyColumn() {
|
||||||
itemsIndexed(
|
itemsIndexed(
|
||||||
items = productList,
|
items = productList,
|
||||||
key = { index, it -> it.goodId!! + index }) { index, it ->
|
key = { index, it -> it.id ?: index }) { index, it ->
|
||||||
|
|
||||||
val checkedBg =
|
val checkedBg =
|
||||||
if (selectIndex == index) Gray_DCDCF0 else Color.Transparent
|
if (selectIndex == index) Gray_DCDCF0 else Color.Transparent
|
||||||
@@ -120,8 +120,8 @@ fun ReceiptUnadjustedListView(
|
|||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.width(20.dp))
|
Spacer(modifier = Modifier.width(20.dp))
|
||||||
CustomSingleRightText(
|
CustomSingleRightText(
|
||||||
modifier = Modifier.width(140.dp),
|
modifier = Modifier.width(200.dp),
|
||||||
text = "${it.receiveCountListStr}${it.unitNameStr}",
|
text = "${it.dualCountStr}${it.unitNameStr}",
|
||||||
style = AppTypography.blackTextStyle
|
style = AppTypography.blackTextStyle
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.width(20.dp))
|
Spacer(modifier = Modifier.width(20.dp))
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import com.sw.inbound.R
|
|||||||
import com.sw.inbound.ext.bold
|
import com.sw.inbound.ext.bold
|
||||||
import com.sw.inbound.model.request.PurchaseWarehouseParam
|
import com.sw.inbound.model.request.PurchaseWarehouseParam
|
||||||
import com.sw.inbound.ui.theme.AppTypography
|
import com.sw.inbound.ui.theme.AppTypography
|
||||||
import com.sw.inbound.ui.theme.Gray_DCDCF0
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自采购 左侧列表
|
* 自采购 左侧列表
|
||||||
@@ -89,11 +88,9 @@ fun SelfProcurementListItem(
|
|||||||
//// key = { it.goodsId }
|
//// key = { it.goodsId }
|
||||||
// )
|
// )
|
||||||
{ index, it ->
|
{ index, it ->
|
||||||
val checkedBg =
|
|
||||||
if (it.goodsId == checkedItem?.goodsId) Gray_DCDCF0 else Color.Transparent
|
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.background(color = checkedBg)
|
.background(color = Color.Transparent)
|
||||||
.padding(30.dp)
|
.padding(30.dp)
|
||||||
.clickable {
|
.clickable {
|
||||||
onItemCheckedClick(it)
|
onItemCheckedClick(it)
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ fun ReceiptTipDialog(
|
|||||||
Spacer(modifier = Modifier.width(10.dp))
|
Spacer(modifier = Modifier.width(10.dp))
|
||||||
CustomSingleRightText(
|
CustomSingleRightText(
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
text = "${goods.receivedNumListStr}${goods.unitNameStr}",
|
text = "${goods.receiveCountListStr}${goods.unitNameStr}",
|
||||||
style = AppTypography.blackMediumTextStyle.withColor(
|
style = AppTypography.blackMediumTextStyle.withColor(
|
||||||
color = Color(0xFF0032C8)
|
color = Color(0xFF0032C8)
|
||||||
),
|
),
|
||||||
@@ -153,7 +153,7 @@ fun ReceiptTipDialog(
|
|||||||
Spacer(modifier = Modifier.width(10.dp))
|
Spacer(modifier = Modifier.width(10.dp))
|
||||||
CustomSingleRightText(
|
CustomSingleRightText(
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
text = "${goods.receiveCountListStr}${goods.unitNameStr}",
|
text = "${goods.receivedNumListStr}${goods.unitNameStr}",
|
||||||
style = AppTypography.blackMediumTextStyle.withColor(
|
style = AppTypography.blackMediumTextStyle.withColor(
|
||||||
Color.Red
|
Color.Red
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -51,12 +51,12 @@ class ReceiptViewModel @Inject constructor(
|
|||||||
|
|
||||||
// 已调整列表
|
// 已调整列表
|
||||||
val adjustedOrders: StateFlow<List<GoodsInfo>> = _orders
|
val adjustedOrders: StateFlow<List<GoodsInfo>> = _orders
|
||||||
.map { orders -> orders.filter { it.isAdjusted && it.goodId != null } }
|
.map { orders -> orders.filter { it.isAdjusted } }
|
||||||
.stateIn(viewModelScope, SharingStarted.Lazily, emptyList())
|
.stateIn(viewModelScope, SharingStarted.Lazily, emptyList())
|
||||||
|
|
||||||
// 未调整列表
|
// 未调整列表
|
||||||
val unadjustedOrders: StateFlow<List<GoodsInfo>> = _orders
|
val unadjustedOrders: StateFlow<List<GoodsInfo>> = _orders
|
||||||
.map { orders -> orders.filter { !it.isAdjusted && it.goodId != null } }
|
.map { orders -> orders.filter { !it.isAdjusted } }
|
||||||
.stateIn(viewModelScope, SharingStarted.Lazily, emptyList())
|
.stateIn(viewModelScope, SharingStarted.Lazily, emptyList())
|
||||||
|
|
||||||
// 选中的商品
|
// 选中的商品
|
||||||
@@ -115,24 +115,24 @@ class ReceiptViewModel @Inject constructor(
|
|||||||
fun updateSelectedItem(purchaseOrder: GoodsInfo?) {
|
fun updateSelectedItem(purchaseOrder: GoodsInfo?) {
|
||||||
if (purchaseOrder != null) {
|
if (purchaseOrder != null) {
|
||||||
if (purchaseOrder.receivedNum != null && purchaseOrder.receivedNum != 0f) {
|
if (purchaseOrder.receivedNum != null && purchaseOrder.receivedNum != 0f) {
|
||||||
if (purchaseOrder.recUnitPriceTaxInTemp.isNotEmpty()) { // 计算金额 单价不为空,并且金额没有手动输入
|
if (purchaseOrder.newRecUnitPriceTaxInTemp.isNotEmpty()) { // 计算金额 单价不为空,并且金额没有手动输入
|
||||||
val result =
|
val result =
|
||||||
purchaseOrder.receivedNum!!.times(purchaseOrder.recUnitPriceTaxIn!!)
|
purchaseOrder.receivedNum!!.times(purchaseOrder.newRecUnitPriceTaxIn!!)
|
||||||
purchaseOrder.recPriceExItem = result.toSafeFloat()
|
purchaseOrder.recPriceExItem = result.toSafeFloat()
|
||||||
purchaseOrder.recPriceExItemTemp = result.toFormattedString()
|
purchaseOrder.recPriceExItemTemp = result.toFormattedString()
|
||||||
} else if (purchaseOrder.recPriceExItemTemp.isNotEmpty()) { // 计算单价 金额不为空,并且单价没有手动输入
|
} else if (purchaseOrder.recPriceExItemTemp.isNotEmpty()) { // 计算单价 金额不为空,并且单价没有手动输入
|
||||||
val result =
|
val result =
|
||||||
purchaseOrder.recPriceExItem!!.div(purchaseOrder.receivedNum!!)
|
purchaseOrder.recPriceExItem!!.div(purchaseOrder.receivedNum!!)
|
||||||
purchaseOrder.recUnitPriceTaxIn = result.toSafeFloat()
|
purchaseOrder.newRecUnitPriceTaxIn = result.toSafeFloat()
|
||||||
purchaseOrder.recUnitPriceTaxInTemp = result.toFormattedString()
|
purchaseOrder.newRecUnitPriceTaxInTemp = result.toFormattedString()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (_priceUserInput.value) {
|
if (_priceUserInput.value) {
|
||||||
purchaseOrder.recPriceExItem = 0f
|
purchaseOrder.recPriceExItem = 0f
|
||||||
purchaseOrder.recPriceExItemTemp = ""
|
purchaseOrder.recPriceExItemTemp = ""
|
||||||
} else if (_amountUserInput.value) {
|
} else if (_amountUserInput.value) {
|
||||||
purchaseOrder.recUnitPriceTaxIn = 0f
|
purchaseOrder.newRecUnitPriceTaxIn = 0f
|
||||||
purchaseOrder.recUnitPriceTaxInTemp = ""
|
purchaseOrder.newRecUnitPriceTaxInTemp = ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -176,7 +176,7 @@ class ReceiptViewModel @Inject constructor(
|
|||||||
fun updatePurchaseItem(purchaseOrder: GoodsInfo) {
|
fun updatePurchaseItem(purchaseOrder: GoodsInfo) {
|
||||||
_orders.update { currentList ->
|
_orders.update { currentList ->
|
||||||
currentList.map { order ->
|
currentList.map { order ->
|
||||||
if (order.goodId == purchaseOrder.goodId) purchaseOrder else order
|
if (order.id == purchaseOrder.id) purchaseOrder else order
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -250,8 +250,14 @@ class ReceiptViewModel @Inject constructor(
|
|||||||
)
|
)
|
||||||
return@startScale
|
return@startScale
|
||||||
}
|
}
|
||||||
val consumeValue = currentItem.consumeValue?.toDouble() ?: 1.0
|
var consumeValue = currentItem.consumeValue?.toDouble() ?: 1.0
|
||||||
val purchaseValue = currentItem.purchaseValue?.toDouble() ?: 1.0
|
var purchaseValue = currentItem.purchaseValue?.toDouble() ?: 1.0
|
||||||
|
if (consumeValue == 0.0) {
|
||||||
|
consumeValue = 1.0
|
||||||
|
}
|
||||||
|
if (purchaseValue == 0.0) {
|
||||||
|
purchaseValue = 1.0
|
||||||
|
}
|
||||||
val count =
|
val count =
|
||||||
weight * 1000 / consumeValue / purchaseValue
|
weight * 1000 / consumeValue / purchaseValue
|
||||||
val finalCount = count.toSafeFloat(currentItem.unitName)
|
val finalCount = count.toSafeFloat(currentItem.unitName)
|
||||||
@@ -275,7 +281,7 @@ class ReceiptViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
_priceUserInput.value && !_amountUserInput.value -> {
|
_priceUserInput.value && !_amountUserInput.value -> {
|
||||||
finalCount.times(info.recUnitPriceTaxIn!!).toSafeFloat()
|
finalCount.times(info.newRecUnitPriceTaxIn!!).toSafeFloat()
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> 0f
|
else -> 0f
|
||||||
@@ -287,8 +293,8 @@ class ReceiptViewModel @Inject constructor(
|
|||||||
receivedNumTemp = finalCount.toFormattedString(),
|
receivedNumTemp = finalCount.toFormattedString(),
|
||||||
receivedNum = finalCount,
|
receivedNum = finalCount,
|
||||||
// 单价
|
// 单价
|
||||||
recUnitPriceTaxIn = if (_priceUserInput.value) info.recUnitPriceTaxIn else finalPrice,
|
newRecUnitPriceTaxIn = if (_priceUserInput.value) info.newRecUnitPriceTaxIn else finalPrice,
|
||||||
recUnitPriceTaxInTemp = if (_priceUserInput.value) info.recUnitPriceTaxInTemp else finalPrice.toFormattedString(),
|
newRecUnitPriceTaxInTemp = if (_priceUserInput.value) info.newRecUnitPriceTaxInTemp else finalPrice.toFormattedString(),
|
||||||
// 金额
|
// 金额
|
||||||
recPriceExItem = if (_amountUserInput.value) info.recPriceExItem else finalAmount,
|
recPriceExItem = if (_amountUserInput.value) info.recPriceExItem else finalAmount,
|
||||||
recPriceExItemTemp = if (_amountUserInput.value) info.recPriceExItemTemp else finalAmount.toFormattedString(),
|
recPriceExItemTemp = if (_amountUserInput.value) info.recPriceExItemTemp else finalAmount.toFormattedString(),
|
||||||
|
|||||||
@@ -119,8 +119,14 @@ class SelfProcurementViewModel @Inject constructor(
|
|||||||
// val selectUnitType = currentItem.selectUnitType
|
// val selectUnitType = currentItem.selectUnitType
|
||||||
// if (selectUnitType == null) return@startScale
|
// if (selectUnitType == null) return@startScale
|
||||||
|
|
||||||
val consumeValue = selectUnitType.consumeValue?.toDouble() ?: 1.0
|
var consumeValue = selectUnitType.consumeValue?.toDouble() ?: 1.0
|
||||||
val purchaseValue = selectUnitType.purchaseValue?.toDouble() ?: 1.0
|
var purchaseValue = selectUnitType.purchaseValue?.toDouble() ?: 1.0
|
||||||
|
if (consumeValue == 0.0) {
|
||||||
|
consumeValue = 1.0
|
||||||
|
}
|
||||||
|
if (purchaseValue == 0.0) {
|
||||||
|
purchaseValue = 1.0
|
||||||
|
}
|
||||||
val count =
|
val count =
|
||||||
weight * 1000 / consumeValue / purchaseValue
|
weight * 1000 / consumeValue / purchaseValue
|
||||||
val finalCount = count.toSafeDouble(currentItem.unitName)
|
val finalCount = count.toSafeDouble(currentItem.unitName)
|
||||||
|
|||||||
Reference in New Issue
Block a user