fix: 国际进港仓库清仓入参改为 body 传递

清仓原先把 clearNormal/clearRemark 放在 URL query 上,与接口文档不符。
改为与国际出港一致的单对象 body:clearNormal、clearRemark 在顶层,
选中数据放 warehouseList(出港侧对应字段为 maWbList)。
同时移除逐条写入主单 clearRemark 的兼容写法。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-17 11:24:58 +08:00
parent 50275457a4
commit 6b02f71e8a
3 changed files with 14 additions and 16 deletions

View File

@@ -56,7 +56,7 @@ class IntImpStorageUseActivity :
val list = viewModel.pageModel.rv?.commonAdapter()?.items as? List<*> ?: return
val allItems = list.filterIsInstance<com.lukouguoji.module_base.bean.GjcMaWb>()
val maWbListForClear = allItems.mapNotNull { maWb ->
val warehouseListForClear = allItems.mapNotNull { maWb ->
if (maWb.isSelected) {
// 勾选运单号 → 默认全选该运单号下的所有库位
maWb.copy(storageUseList = maWb.storageUseList ?: emptyList())
@@ -71,7 +71,7 @@ class IntImpStorageUseActivity :
}
}
if (maWbListForClear.isEmpty()) {
if (warehouseListForClear.isEmpty()) {
showToast("请至少选择一个库位")
return
}
@@ -79,7 +79,7 @@ class IntImpStorageUseActivity :
IntImpMoveClearDialogModel { dialog ->
val clearNormal = dialog.clearNormal.value ?: ""
val clearRemark = dialog.clearRemark.value ?: ""
viewModel.performClear(clearNormal, clearRemark, maWbListForClear)
viewModel.performClear(clearNormal, clearRemark, warehouseListForClear)
}.show(this)
}

View File

@@ -119,20 +119,22 @@ class IntImpStorageUseViewModel : BasePageViewModel() {
* 执行清仓操作
* @param clearNormal 清仓正常("0"或"1"
* @param clearRemark 清仓备注(选填)
* @param maWbListForClear 包含选中子列表项的主列表数据
* @param warehouseListForClear 包含选中子列表项的主列表数据
*/
fun performClear(clearNormal: String, clearRemark: String, maWbListForClear: List<GjcMaWb>) {
if (maWbListForClear.isEmpty()) {
fun performClear(clearNormal: String, clearRemark: String, warehouseListForClear: List<GjcMaWb>) {
if (warehouseListForClear.isEmpty()) {
showToast("请至少选择一个库位")
return
}
// 备注同时通过 query 参数和主单字段传递,兼容服务端两种取值方式
val remark = clearRemark.ifEmpty { null }
maWbListForClear.forEach { it.clearRemark = remark }
val body = maWbListForClear.toRequestBody()
// 构建请求参数:清仓标志与备注在顶层,选中数据放 warehouseList
val params = mapOf(
"clearNormal" to clearNormal,
"clearRemark" to clearRemark.ifEmpty { null },
"warehouseList" to warehouseListForClear
).toRequestBody()
launchLoadingCollect({ NetApply.api.clearIntImpStorage(clearNormal, remark, body) }) {
launchLoadingCollect({ NetApply.api.clearIntImpStorage(params) }) {
onSuccess = {
showToast("清仓成功")
viewModelScope.launch {