实现了部分收货UI。替换为张欢测试服务
This commit is contained in:
@@ -107,16 +107,17 @@ class SelfProcurementViewModel @Inject constructor(
|
||||
val currentItem = _selectedItem.value
|
||||
|
||||
currentItem?.let { info ->
|
||||
val selectUnitType = currentItem.selectUnitType
|
||||
// 用户输入数量后不再通过重量反算
|
||||
if (_countUserInput.value) {
|
||||
if (_countUserInput.value || selectUnitType == null) {
|
||||
_selectedItem.value = info.copy(
|
||||
goodsWeight = weight.toSafeBigDecimal(),
|
||||
)
|
||||
return@startScale
|
||||
}
|
||||
|
||||
val selectUnitType = currentItem.selectUnitType
|
||||
if (selectUnitType == null) return@startScale
|
||||
// val selectUnitType = currentItem.selectUnitType
|
||||
// if (selectUnitType == null) return@startScale
|
||||
|
||||
val consumeValue = selectUnitType.consumeValue?.toDouble() ?: 1.0
|
||||
val purchaseValue = selectUnitType.purchaseValue?.toDouble() ?: 1.0
|
||||
@@ -265,8 +266,8 @@ class SelfProcurementViewModel @Inject constructor(
|
||||
}
|
||||
val response = repository.searchGoodsInfoList(goodsName, pageNo, pageSize)
|
||||
_isMoreLoading.value = false
|
||||
if (response.isSuccess()) {
|
||||
val data = response.data
|
||||
if (parseResponse(response)) {
|
||||
val data = response.result
|
||||
data?.records?.let {
|
||||
_canLoadMore.value = data.records.size >= pageSize
|
||||
if (pageNo > 1) {
|
||||
@@ -334,22 +335,20 @@ class SelfProcurementViewModel @Inject constructor(
|
||||
|
||||
launchWithLoading {
|
||||
val uploadResponse = repository.uploadImage(imageUri)
|
||||
if (!uploadResponse.isSuccess()) {
|
||||
parseResponse(uploadResponse)
|
||||
if (!parseResponse(uploadResponse)) {
|
||||
return@launchWithLoading
|
||||
}
|
||||
// ToastUtils.showToast("图片上传成功,${uploadResponse.data}")
|
||||
GlobalData.imageUri = null
|
||||
_goodsAddParam.value.relativeUrl = uploadResponse.data
|
||||
_goodsAddParam.value.relativeUrl = uploadResponse.result
|
||||
val response = repository.selfPurchaseGoodsAdd(_goodsAddParam.value)
|
||||
if (!response.isSuccess()) {
|
||||
parseResponse(response)
|
||||
if (!parseResponse(response)) {
|
||||
return@launchWithLoading
|
||||
}
|
||||
FileUtils.deleteFileWithUri(context = ContextUtils.getAppContext(), uri = imageUri)
|
||||
_showAddProductDialog.value = false
|
||||
_goodsAddParam.value = GoodsAddParam()
|
||||
val searchFirst = response.data!!.records?.get(0)
|
||||
val searchFirst = response.result!!.records?.get(0)
|
||||
searchFirst?.let {
|
||||
updateSelectedItemWithSearch(searchFirst)
|
||||
}
|
||||
@@ -369,6 +368,8 @@ class SelfProcurementViewModel @Inject constructor(
|
||||
val response = repository.selfPurchaseWarehousing(_purchaseList.value)
|
||||
if (parseResponse(response)) {
|
||||
_addToWarehouseResult.value = true
|
||||
} else {
|
||||
_addToWarehouseResult.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user