fix: fix 出库

This commit is contained in:
2026-03-25 17:20:42 +08:00
parent 5981a60d68
commit 6d2a79a639
3 changed files with 12 additions and 19 deletions

View File

@@ -109,7 +109,9 @@
"mcp__apifox__read_project_oas_ref_resources_g3xqex",
"mcp__apifox__refresh_project_oas_g3xqex",
"mcp__apifox__read_project_oas_4h0w3b",
"mcp__apifox__read_project_oas_ref_resources_4h0w3b"
"mcp__apifox__read_project_oas_ref_resources_4h0w3b",
"mcp__apifox__read_project_oas_6i29va",
"mcp__apifox__read_project_oas_ref_resources_6i29va"
],
"deny": [],
"ask": []

View File

@@ -133,22 +133,12 @@ class IntImpStorageUseActivity :
val list = viewModel.pageModel.rv?.commonAdapter()?.items as? List<*> ?: return
val allItems = list.filterIsInstance<com.lukouguoji.module_base.bean.GjcMaWb>()
val maWbListForOutStorage = allItems.mapNotNull { maWb ->
if (maWb.isSelected) {
// 勾选运单号 → 默认全选该运单号下的所有库位
maWb.copy(storageUseList = maWb.storageUseList ?: emptyList())
} else {
// 勾选库位号 → 只对选择的库位进行操作
val selectedStorageList = maWb.storageUseList?.filter { it.isSelected } ?: emptyList()
if (selectedStorageList.isNotEmpty()) {
maWb.copy(storageUseList = selectedStorageList)
} else {
null
}
}
val selectedStorageList = mutableListOf<com.lukouguoji.module_base.bean.GjcStorageUse>()
allItems.forEach { maWb ->
maWb.storageUseList?.filter { it.isSelected }?.let { selectedStorageList.addAll(it) }
}
if (maWbListForOutStorage.isEmpty()) {
if (selectedStorageList.isEmpty()) {
showToast("请选择要出库的库位")
return
}
@@ -157,7 +147,7 @@ class IntImpStorageUseActivity :
message = "是否确认出库?",
title = "出库确认"
) {
viewModel.performOutStorage(maWbListForOutStorage)
viewModel.performOutStorage(selectedStorageList)
}.show(this)
}

View File

@@ -6,6 +6,7 @@ import com.lukouguoji.gjj.R
import com.lukouguoji.gjj.holder.IntImpStorageUseViewHolder
import com.lukouguoji.module_base.base.BasePageViewModel
import com.lukouguoji.module_base.bean.GjcMaWb
import com.lukouguoji.module_base.bean.GjcStorageUse
import com.lukouguoji.module_base.common.Constant
import com.lukouguoji.module_base.common.ConstantEvent
import com.lukouguoji.module_base.http.net.NetApply
@@ -185,13 +186,13 @@ class IntImpStorageUseViewModel : BasePageViewModel() {
/**
* 执行出库操作
*/
fun performOutStorage(maWbListForOutStorage: List<GjcMaWb>) {
if (maWbListForOutStorage.isEmpty()) {
fun performOutStorage(storageUseList: List<GjcStorageUse>) {
if (storageUseList.isEmpty()) {
showToast("请选择要出库的库位")
return
}
val params = maWbListForOutStorage.toRequestBody()
val params = storageUseList.toRequestBody()
launchLoadingCollect({ NetApply.api.outIntImpStorage(params) }) {
onSuccess = {