fix: fix 出库
This commit is contained in:
@@ -109,7 +109,9 @@
|
|||||||
"mcp__apifox__read_project_oas_ref_resources_g3xqex",
|
"mcp__apifox__read_project_oas_ref_resources_g3xqex",
|
||||||
"mcp__apifox__refresh_project_oas_g3xqex",
|
"mcp__apifox__refresh_project_oas_g3xqex",
|
||||||
"mcp__apifox__read_project_oas_4h0w3b",
|
"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": [],
|
"deny": [],
|
||||||
"ask": []
|
"ask": []
|
||||||
|
|||||||
@@ -133,22 +133,12 @@ class IntImpStorageUseActivity :
|
|||||||
val list = viewModel.pageModel.rv?.commonAdapter()?.items as? List<*> ?: return
|
val list = viewModel.pageModel.rv?.commonAdapter()?.items as? List<*> ?: return
|
||||||
val allItems = list.filterIsInstance<com.lukouguoji.module_base.bean.GjcMaWb>()
|
val allItems = list.filterIsInstance<com.lukouguoji.module_base.bean.GjcMaWb>()
|
||||||
|
|
||||||
val maWbListForOutStorage = allItems.mapNotNull { maWb ->
|
val selectedStorageList = mutableListOf<com.lukouguoji.module_base.bean.GjcStorageUse>()
|
||||||
if (maWb.isSelected) {
|
allItems.forEach { maWb ->
|
||||||
// 勾选运单号 → 默认全选该运单号下的所有库位
|
maWb.storageUseList?.filter { it.isSelected }?.let { selectedStorageList.addAll(it) }
|
||||||
maWb.copy(storageUseList = maWb.storageUseList ?: emptyList())
|
|
||||||
} else {
|
|
||||||
// 勾选库位号 → 只对选择的库位进行操作
|
|
||||||
val selectedStorageList = maWb.storageUseList?.filter { it.isSelected } ?: emptyList()
|
|
||||||
if (selectedStorageList.isNotEmpty()) {
|
|
||||||
maWb.copy(storageUseList = selectedStorageList)
|
|
||||||
} else {
|
|
||||||
null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maWbListForOutStorage.isEmpty()) {
|
if (selectedStorageList.isEmpty()) {
|
||||||
showToast("请选择要出库的库位")
|
showToast("请选择要出库的库位")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -157,7 +147,7 @@ class IntImpStorageUseActivity :
|
|||||||
message = "是否确认出库?",
|
message = "是否确认出库?",
|
||||||
title = "出库确认"
|
title = "出库确认"
|
||||||
) {
|
) {
|
||||||
viewModel.performOutStorage(maWbListForOutStorage)
|
viewModel.performOutStorage(selectedStorageList)
|
||||||
}.show(this)
|
}.show(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.lukouguoji.gjj.R
|
|||||||
import com.lukouguoji.gjj.holder.IntImpStorageUseViewHolder
|
import com.lukouguoji.gjj.holder.IntImpStorageUseViewHolder
|
||||||
import com.lukouguoji.module_base.base.BasePageViewModel
|
import com.lukouguoji.module_base.base.BasePageViewModel
|
||||||
import com.lukouguoji.module_base.bean.GjcMaWb
|
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.Constant
|
||||||
import com.lukouguoji.module_base.common.ConstantEvent
|
import com.lukouguoji.module_base.common.ConstantEvent
|
||||||
import com.lukouguoji.module_base.http.net.NetApply
|
import com.lukouguoji.module_base.http.net.NetApply
|
||||||
@@ -185,13 +186,13 @@ class IntImpStorageUseViewModel : BasePageViewModel() {
|
|||||||
/**
|
/**
|
||||||
* 执行出库操作
|
* 执行出库操作
|
||||||
*/
|
*/
|
||||||
fun performOutStorage(maWbListForOutStorage: List<GjcMaWb>) {
|
fun performOutStorage(storageUseList: List<GjcStorageUse>) {
|
||||||
if (maWbListForOutStorage.isEmpty()) {
|
if (storageUseList.isEmpty()) {
|
||||||
showToast("请选择要出库的库位")
|
showToast("请选择要出库的库位")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val params = maWbListForOutStorage.toRequestBody()
|
val params = storageUseList.toRequestBody()
|
||||||
|
|
||||||
launchLoadingCollect({ NetApply.api.outIntImpStorage(params) }) {
|
launchLoadingCollect({ NetApply.api.outIntImpStorage(params) }) {
|
||||||
onSuccess = {
|
onSuccess = {
|
||||||
|
|||||||
Reference in New Issue
Block a user