添加物品消耗单位输入
This commit is contained in:
@@ -56,7 +56,11 @@ data class GoodsAddParam(
|
|||||||
/**
|
/**
|
||||||
* 图片url
|
* 图片url
|
||||||
*/
|
*/
|
||||||
var relativeUrl: String? = null
|
var relativeUrl: String? = null,
|
||||||
|
/**
|
||||||
|
* 库存与克的转换值
|
||||||
|
*/
|
||||||
|
val consumeValue: String = ""
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val goodNameSr: String
|
val goodNameSr: String
|
||||||
@@ -138,6 +142,9 @@ data class GoodsAddParam(
|
|||||||
if (purchasePrice == null || purchasePrice!!.toFloat() <= 0) {
|
if (purchasePrice == null || purchasePrice!!.toFloat() <= 0) {
|
||||||
return "请输入单价"
|
return "请输入单价"
|
||||||
}
|
}
|
||||||
|
if (consumeValue.isEmpty()) {
|
||||||
|
return "请输入库存单位对应的消耗值"
|
||||||
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,8 +7,21 @@ data class GoodsPurchaseUnitParam(
|
|||||||
val purchaseUnit: Int = 0, // 采购单位 integer ,
|
val purchaseUnit: Int = 0, // 采购单位 integer ,
|
||||||
val unitId: Int = 0, // 库存单位id integer,
|
val unitId: Int = 0, // 库存单位id integer,
|
||||||
val purchaseValue: Float = 0f, // 单位转换值 float
|
val purchaseValue: Float = 0f, // 单位转换值 float
|
||||||
|
/**
|
||||||
|
* 库存与克的转换值
|
||||||
|
*/
|
||||||
|
var consumeValue: String = "",
|
||||||
|
val consumeValueTemp: String = "",
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
val consumeValueTempValue: String
|
||||||
|
get() {
|
||||||
|
if (consumeValue.isNotEmpty()) {
|
||||||
|
return consumeValue
|
||||||
|
}
|
||||||
|
return consumeValueTemp
|
||||||
|
}
|
||||||
|
|
||||||
val unitIdStr: String
|
val unitIdStr: String
|
||||||
get() {
|
get() {
|
||||||
if (unitId == 0) return ""
|
if (unitId == 0) return ""
|
||||||
@@ -35,6 +48,10 @@ data class GoodsPurchaseUnitParam(
|
|||||||
if (purchaseValue == null || purchaseValue == 0f) {
|
if (purchaseValue == null || purchaseValue == 0f) {
|
||||||
return "请输入采购单位对应的库存数量"
|
return "请输入采购单位对应的库存数量"
|
||||||
}
|
}
|
||||||
|
if (consumeValueTemp.isEmpty()) {
|
||||||
|
return "请输入库存单位对应的消耗值"
|
||||||
|
}
|
||||||
|
consumeValue = consumeValueTemp
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,9 @@ data class PurchaseWarehouseParam(
|
|||||||
// 搜索的物品单位列表
|
// 搜索的物品单位列表
|
||||||
var unitList: List<UnitVo>? = null,
|
var unitList: List<UnitVo>? = null,
|
||||||
// 选中的采购单位
|
// 选中的采购单位
|
||||||
var selectUnitType: UnitVo? = null
|
var selectUnitType: UnitVo? = null,
|
||||||
|
// 库存单位与克的转换值
|
||||||
|
val consumeValue: String = ""
|
||||||
) : Parcelable {
|
) : Parcelable {
|
||||||
|
|
||||||
val warehouseNameStr: String
|
val warehouseNameStr: String
|
||||||
|
|||||||
@@ -53,6 +53,12 @@ data class SearchGoodsInfo(
|
|||||||
*/
|
*/
|
||||||
@SerializedName("kcUnitName")
|
@SerializedName("kcUnitName")
|
||||||
val kcUnitName: String? = "",
|
val kcUnitName: String? = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存与克的转换值
|
||||||
|
*/
|
||||||
|
val consumeValue: String? = "",
|
||||||
|
|
||||||
@SerializedName("specification")
|
@SerializedName("specification")
|
||||||
val specification: String? = "",
|
val specification: String? = "",
|
||||||
@SerializedName("typeId")
|
@SerializedName("typeId")
|
||||||
@@ -63,7 +69,7 @@ data class SearchGoodsInfo(
|
|||||||
* 采购单位列表
|
* 采购单位列表
|
||||||
*/
|
*/
|
||||||
@SerializedName("unitVoList")
|
@SerializedName("unitVoList")
|
||||||
val unitVoList: List<UnitVo>? = null,
|
val unitVoList: List<UnitVo>? = listOf(),
|
||||||
@SerializedName("zjmCode")
|
@SerializedName("zjmCode")
|
||||||
val zjmCode: String? = ""
|
val zjmCode: String? = ""
|
||||||
) : Parcelable {
|
) : Parcelable {
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ fun ReceiptLeftView(
|
|||||||
"采购单号:${currentPurchaseInfo?.purCode ?: "-"}",
|
"采购单号:${currentPurchaseInfo?.purCode ?: "-"}",
|
||||||
style = gray96a0aaTextStyle.copy(fontSize = 20.sp)
|
style = gray96a0aaTextStyle.copy(fontSize = 20.sp)
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.width(120.dp))
|
Spacer(modifier = Modifier.width(30.dp))
|
||||||
Text(
|
Text(
|
||||||
"收货单号:${currentPurchaseInfo?.receiveCode ?: "-"}",
|
"收货单号:${currentPurchaseInfo?.receiveCode ?: "-"}",
|
||||||
style = gray96a0aaTextStyle.copy(fontSize = 20.sp)
|
style = gray96a0aaTextStyle.copy(fontSize = 20.sp)
|
||||||
|
|||||||
@@ -266,9 +266,10 @@ fun ProductIdentification(viewModel: SelfProcurementViewModel) {
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
// 菜品识别
|
// 菜品识别
|
||||||
IdentityView(showSearchView = true, onOptionSelected = {
|
IdentityView(
|
||||||
viewModel.updateSelectedItemWithSearch(it)
|
showSearchView = true, onOptionSelected = {
|
||||||
},
|
viewModel.updateSelectedItemWithSearch(it)
|
||||||
|
},
|
||||||
checkedItem = selectedItem,
|
checkedItem = selectedItem,
|
||||||
baseViewModel = viewModel,
|
baseViewModel = viewModel,
|
||||||
pageType = PageType.SELF_PROCUREMENT
|
pageType = PageType.SELF_PROCUREMENT
|
||||||
@@ -349,14 +350,26 @@ private fun DialogRightEditView(viewModel: SelfProcurementViewModel) {
|
|||||||
onValueChange = {
|
onValueChange = {
|
||||||
viewModel.updateGoodsAddParam(goodsAddParam.copy(goodName = it))
|
viewModel.updateGoodsAddParam(goodsAddParam.copy(goodName = it))
|
||||||
})
|
})
|
||||||
|
// ColumnInputText(
|
||||||
|
// modifier = Modifier.width(474.dp),
|
||||||
|
// label = "物品编码(系统生成)",
|
||||||
|
// value = "",
|
||||||
|
// enabled = false,
|
||||||
|
// onValueChange = {
|
||||||
|
//// viewModel.updateFormState(formState.copy(goodCode = it))
|
||||||
|
// })
|
||||||
|
|
||||||
ColumnInputText(
|
ColumnInputText(
|
||||||
modifier = Modifier.width(474.dp),
|
modifier = Modifier
|
||||||
label = "物品编码(系统生成)",
|
.weight(1f)
|
||||||
value = "",
|
.width(474.dp),
|
||||||
enabled = false,
|
label = "净材率",
|
||||||
|
value = goodsAddParam.netRateStr,
|
||||||
|
inputType = InputType.Percent,
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
// viewModel.updateFormState(formState.copy(goodCode = it))
|
viewModel.updateGoodsAddParam(goodsAddParam.copy(netRate = it.toSafeFloat()))
|
||||||
})
|
}, trailingLabel = "%"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
@@ -397,17 +410,7 @@ private fun DialogRightEditView(viewModel: SelfProcurementViewModel) {
|
|||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.spacedBy(60.dp)
|
horizontalArrangement = Arrangement.spacedBy(60.dp)
|
||||||
) {
|
) {
|
||||||
ColumnInputText(
|
|
||||||
modifier = Modifier
|
|
||||||
.weight(1f)
|
|
||||||
.width(474.dp),
|
|
||||||
label = "净材率",
|
|
||||||
value = goodsAddParam.netRateStr,
|
|
||||||
inputType = InputType.Percent,
|
|
||||||
onValueChange = {
|
|
||||||
viewModel.updateGoodsAddParam(goodsAddParam.copy(netRate = it.toSafeFloat()))
|
|
||||||
}, trailingLabel = "%"
|
|
||||||
)
|
|
||||||
ColumnInputText(
|
ColumnInputText(
|
||||||
modifier = Modifier.width(474.dp),
|
modifier = Modifier.width(474.dp),
|
||||||
value = goodsAddParam.unitIdStr,
|
value = goodsAddParam.unitIdStr,
|
||||||
@@ -421,6 +424,7 @@ private fun DialogRightEditView(viewModel: SelfProcurementViewModel) {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
@@ -477,12 +481,45 @@ private fun DialogRightEditView(viewModel: SelfProcurementViewModel) {
|
|||||||
if (it.isValidAmount()) {
|
if (it.isValidAmount()) {
|
||||||
viewModel.updateGoodsAddParam(goodsAddParam.copy(purchasePrice = it.toSafeBigDecimal()))
|
viewModel.updateGoodsAddParam(goodsAddParam.copy(purchasePrice = it.toSafeBigDecimal()))
|
||||||
}
|
}
|
||||||
}, inputType = InputType.Decimal, hasNext = false
|
}, inputType = InputType.Decimal, hasNext = true
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.width(24.dp))
|
Spacer(modifier = Modifier.width(24.dp))
|
||||||
Text("元", style = AppTypography.gray96a0aaTextStyle)
|
Text("元", style = AppTypography.gray96a0aaTextStyle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
Text(text = "消耗单位", style = AppTypography.black141428TextStyle)
|
||||||
|
Spacer(modifier = Modifier.height(20.dp))
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.height(92.dp)
|
||||||
|
.fillMaxWidth()
|
||||||
|
.dashedBorder()
|
||||||
|
.padding(vertical = 16.dp, horizontal = 26.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween
|
||||||
|
) {
|
||||||
|
Text("1", style = AppTypography.black141428TextStyle.bold())
|
||||||
|
Spacer(modifier = Modifier.width(24.dp))
|
||||||
|
Text(goodsAddParam.unitIdStr, style = AppTypography.gray96a0aaTextStyle)
|
||||||
|
Spacer(modifier = Modifier.width(24.dp))
|
||||||
|
Text(text = "=", style = AppTypography.gray96a0aaTextStyle)
|
||||||
|
Spacer(modifier = Modifier.width(24.dp))
|
||||||
|
CustomTextField(
|
||||||
|
modifier = Modifier.width(200.dp),
|
||||||
|
value = goodsAddParam.consumeValue,
|
||||||
|
placeholderValue = "请录入",
|
||||||
|
isInitUpdate = true,
|
||||||
|
onValueChange = {
|
||||||
|
viewModel.updateGoodsAddParam(goodsAddParam.copy(consumeValue = it))
|
||||||
|
}, inputType = InputType.Decimal, hasNext = false
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.width(24.dp))
|
||||||
|
Text("克", style = AppTypography.gray96a0aaTextStyle)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Spacer(modifier = Modifier.height(24.dp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -592,6 +629,39 @@ private fun DialogAddPurchaseUnitEditView(viewModel: SelfProcurementViewModel) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
Text(text = "消耗单位", style = AppTypography.black141428TextStyle)
|
||||||
|
Spacer(modifier = Modifier.height(20.dp))
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.height(92.dp)
|
||||||
|
.fillMaxWidth()
|
||||||
|
.dashedBorder()
|
||||||
|
.padding(vertical = 16.dp, horizontal = 26.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween
|
||||||
|
) {
|
||||||
|
Text("1", style = AppTypography.black141428TextStyle.bold())
|
||||||
|
Spacer(modifier = Modifier.width(24.dp))
|
||||||
|
Text(goodsAddUnitParam.unitIdStr, style = AppTypography.gray96a0aaTextStyle)
|
||||||
|
Spacer(modifier = Modifier.width(24.dp))
|
||||||
|
Text(text = "=", style = AppTypography.gray96a0aaTextStyle)
|
||||||
|
Spacer(modifier = Modifier.width(24.dp))
|
||||||
|
CustomTextField(
|
||||||
|
modifier = Modifier.width(260.dp),
|
||||||
|
value = goodsAddUnitParam.consumeValueTempValue,
|
||||||
|
isInitUpdate = true,
|
||||||
|
placeholderValue = "请录入",
|
||||||
|
enabled = goodsAddUnitParam.consumeValue.isEmpty(),
|
||||||
|
onValueChange = {
|
||||||
|
viewModel.updateGoodsPurchaseUnit(goodsAddUnitParam.copy(consumeValueTemp = it))
|
||||||
|
}, inputType = InputType.Decimal, hasNext = false
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.width(24.dp))
|
||||||
|
Text("克", style = AppTypography.gray96a0aaTextStyle)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
verticalArrangement = Arrangement.Center,
|
verticalArrangement = Arrangement.Center,
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
@@ -602,6 +672,7 @@ private fun DialogAddPurchaseUnitEditView(viewModel: SelfProcurementViewModel) {
|
|||||||
style = AppTypography.gray999999TextStyle
|
style = AppTypography.gray999999TextStyle
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Spacer(modifier = Modifier.height(24.dp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -734,7 +805,8 @@ private fun SelfProductEditView(
|
|||||||
viewModel.updateGoodsPurchaseUnit(
|
viewModel.updateGoodsPurchaseUnit(
|
||||||
goodsAddUnitParam.copy(
|
goodsAddUnitParam.copy(
|
||||||
goodsId = selectedItem!!.goodsId,
|
goodsId = selectedItem!!.goodsId,
|
||||||
unitId = selectedItem!!.kcUnitId
|
unitId = selectedItem!!.kcUnitId,
|
||||||
|
consumeValue = selectedItem!!.consumeValue
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
viewModel.updateAddPurchaseUnitDialog(true)
|
viewModel.updateAddPurchaseUnitDialog(true)
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ import com.sw.inbound.ui.theme.AppTypography
|
|||||||
import com.sw.inbound.utils.InteractionUtils.Debouncer
|
import com.sw.inbound.utils.InteractionUtils.Debouncer
|
||||||
import com.sw.inbound.utils.rememberPhotoCapture
|
import com.sw.inbound.utils.rememberPhotoCapture
|
||||||
import com.sw.inbound.viewmodel.BaseViewModel
|
import com.sw.inbound.viewmodel.BaseViewModel
|
||||||
|
import com.sw.inbound.viewmodel.ReceiptViewModel
|
||||||
|
import com.sw.inbound.viewmodel.SelfProcurementViewModel
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|
||||||
enum class PageType {
|
enum class PageType {
|
||||||
@@ -94,6 +96,11 @@ fun IdentityView(
|
|||||||
// 处理拍照成功的逻辑
|
// 处理拍照成功的逻辑
|
||||||
baseViewModel.updateLastPhotoUri(savedUri)
|
baseViewModel.updateLastPhotoUri(savedUri)
|
||||||
Timber.d("photoUri = $savedUri")
|
Timber.d("photoUri = $savedUri")
|
||||||
|
if (pageType == PageType.SELF_PROCUREMENT) {
|
||||||
|
(baseViewModel as SelfProcurementViewModel).updateSelectedItem(null)
|
||||||
|
} else if (pageType == PageType.RECEIPT_PRODUCT) {
|
||||||
|
(baseViewModel as ReceiptViewModel).updateSelectedItem(null)
|
||||||
|
}
|
||||||
baseViewModel.getIdentityList(savedUri)
|
baseViewModel.getIdentityList(savedUri)
|
||||||
},
|
},
|
||||||
onError = { error ->
|
onError = { error ->
|
||||||
@@ -113,7 +120,17 @@ fun IdentityView(
|
|||||||
Timber.d("LaunchedEffect weightInfo1 = $weightInfo, lastWeight = $lastWeight")
|
Timber.d("LaunchedEffect weightInfo1 = $weightInfo, lastWeight = $lastWeight")
|
||||||
if (weightInfo - lastWeight > 1.0) {
|
if (weightInfo - lastWeight > 1.0) {
|
||||||
Timber.d("LaunchedEffect pageType = $pageType, receiptList = ${receiptList.size}")
|
Timber.d("LaunchedEffect pageType = $pageType, receiptList = ${receiptList.size}")
|
||||||
if (pageType == PageType.RECEIPT_PRODUCT && receiptList.isNotEmpty() || pageType == PageType.SELF_PROCUREMENT) {
|
var canIdentity = false
|
||||||
|
if (pageType == PageType.RECEIPT_PRODUCT) {
|
||||||
|
val selectItem = (baseViewModel as ReceiptViewModel).selectedItem.value
|
||||||
|
canIdentity =
|
||||||
|
receiptList.isNotEmpty() && (selectItem == null || selectItem.goodId == 0)
|
||||||
|
} else if (pageType == PageType.SELF_PROCUREMENT) {
|
||||||
|
val selectItem = (baseViewModel as SelfProcurementViewModel).selectedItem.value
|
||||||
|
canIdentity = selectItem == null || selectItem.goodsId == 0
|
||||||
|
}
|
||||||
|
Timber.d("LaunchedEffect canIdentity = $canIdentity")
|
||||||
|
if (canIdentity) {
|
||||||
debouncer.debounce {
|
debouncer.debounce {
|
||||||
takePhoto()
|
takePhoto()
|
||||||
}
|
}
|
||||||
@@ -137,6 +154,9 @@ fun IdentityView(
|
|||||||
if (showSearchView) {
|
if (showSearchView) {
|
||||||
Spacer(modifier = Modifier.height(30.dp))
|
Spacer(modifier = Modifier.height(30.dp))
|
||||||
CustomSearchView(onSearchClick = {
|
CustomSearchView(onSearchClick = {
|
||||||
|
if (pageType == PageType.SELF_PROCUREMENT) {
|
||||||
|
(baseViewModel as SelfProcurementViewModel).updateSelectedItem(null)
|
||||||
|
}
|
||||||
searchInfo = it
|
searchInfo = it
|
||||||
baseViewModel.searchGoodsInfoList(it)
|
baseViewModel.searchGoodsInfoList(it)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ fun AddProductDialog(
|
|||||||
color = Color.White,
|
color = Color.White,
|
||||||
shadowElevation = 0.dp
|
shadowElevation = 0.dp
|
||||||
) {
|
) {
|
||||||
ToastUtils.ToastComposable()
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
@@ -96,6 +95,7 @@ fun AddProductDialog(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ToastUtils.ToastComposable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -55,7 +55,6 @@ fun AddPurchaseUnitDialog(
|
|||||||
color = Color.White,
|
color = Color.White,
|
||||||
shadowElevation = 0.dp
|
shadowElevation = 0.dp
|
||||||
) {
|
) {
|
||||||
ToastUtils.ToastComposable()
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
@@ -98,6 +97,7 @@ fun AddPurchaseUnitDialog(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ToastUtils.ToastComposable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,6 @@ fun ReceiptTipDialog(
|
|||||||
color = Color.White,
|
color = Color.White,
|
||||||
shadowElevation = 0.dp
|
shadowElevation = 0.dp
|
||||||
) {
|
) {
|
||||||
ToastUtils.ToastComposable()
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
@@ -223,6 +222,7 @@ fun ReceiptTipDialog(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ToastUtils.ToastComposable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ object ToastUtils {
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
// .fillMaxWidth()
|
// .fillMaxWidth()
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.padding(bottom = 56.dp),
|
.padding(bottom = 156.dp),
|
||||||
contentAlignment = Alignment.BottomCenter
|
contentAlignment = Alignment.BottomCenter
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
|
|||||||
@@ -262,6 +262,7 @@ class SelfProcurementViewModel @Inject constructor(
|
|||||||
goodsName = searchFirst.goodsName,
|
goodsName = searchFirst.goodsName,
|
||||||
kcUnitId = searchFirst.kcUnitId ?: 0,
|
kcUnitId = searchFirst.kcUnitId ?: 0,
|
||||||
unitList = searchFirst.unitVoList,
|
unitList = searchFirst.unitVoList,
|
||||||
|
consumeValue = searchFirst.consumeValue ?: ""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -369,8 +370,11 @@ class SelfProcurementViewModel @Inject constructor(
|
|||||||
val searchList: List<SearchGoodsInfo.Record> =
|
val searchList: List<SearchGoodsInfo.Record> =
|
||||||
response.result?.records ?: emptyList()
|
response.result?.records ?: emptyList()
|
||||||
if (searchList.isNotEmpty()) {
|
if (searchList.isNotEmpty()) {
|
||||||
|
val searchItem = searchList[0]
|
||||||
_selectedItem.value = _selectedItem.value?.copy(
|
_selectedItem.value = _selectedItem.value?.copy(
|
||||||
unitList = searchList[0].unitVoList
|
unitList = searchItem.unitVoList,
|
||||||
|
kcUnitId = searchItem.kcUnitId ?: 0,
|
||||||
|
consumeValue = searchItem.consumeValue ?: ""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,12 +12,23 @@ class ExampleUnitTest {
|
|||||||
@Test
|
@Test
|
||||||
fun addition_isCorrect() {
|
fun addition_isCorrect() {
|
||||||
// println(4, 2 + 2)
|
// println(4, 2 + 2)
|
||||||
|
val decimalPlaces = 2
|
||||||
|
val r1 = "%.${decimalPlaces}f".format(0.1)
|
||||||
|
logStr("r1", r1)
|
||||||
|
val r2 = "%.${decimalPlaces}f".format(1.0)
|
||||||
|
logStr("r2", r2)
|
||||||
|
val r3 = "%.${decimalPlaces}f".format(1.23)
|
||||||
|
logStr("r3", r3)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun log(tag: String, msg: Boolean) {
|
fun log(tag: String, msg: Boolean) {
|
||||||
println("$tag, result = $msg")
|
println("$tag, result = $msg")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun logStr(tag: String, msg: String) {
|
||||||
|
println("$tag, result = $msg")
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testFloat() {
|
fun testFloat() {
|
||||||
log("0.00", "0.00".isValidFloat())
|
log("0.00", "0.00".isValidFloat())
|
||||||
|
|||||||
Reference in New Issue
Block a user