diff --git a/module_base/src/main/java/com/lukouguoji/module_base/http/net/Api.kt b/module_base/src/main/java/com/lukouguoji/module_base/http/net/Api.kt index 212ef6c..7423bd4 100644 --- a/module_base/src/main/java/com/lukouguoji/module_base/http/net/Api.kt +++ b/module_base/src/main/java/com/lukouguoji/module_base/http/net/Api.kt @@ -991,11 +991,7 @@ interface Api { * 接口路径: /IntImpStorage/updateClear */ @POST("IntImpStorage/updateClear") - suspend fun clearIntImpStorage( - @Query("clearNormal") clearNormal: String, - @Query("clearRemark") clearRemark: String?, - @Body data: RequestBody - ): BaseResultBean + suspend fun clearIntImpStorage(@Body data: RequestBody): BaseResultBean /** * 国际进港库位操作-修改库位 diff --git a/module_gjj/src/main/java/com/lukouguoji/gjj/activity/IntImpStorageUseActivity.kt b/module_gjj/src/main/java/com/lukouguoji/gjj/activity/IntImpStorageUseActivity.kt index 85e23cf..d7fbd66 100644 --- a/module_gjj/src/main/java/com/lukouguoji/gjj/activity/IntImpStorageUseActivity.kt +++ b/module_gjj/src/main/java/com/lukouguoji/gjj/activity/IntImpStorageUseActivity.kt @@ -56,7 +56,7 @@ class IntImpStorageUseActivity : val list = viewModel.pageModel.rv?.commonAdapter()?.items as? List<*> ?: return val allItems = list.filterIsInstance() - 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) } diff --git a/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpStorageUseViewModel.kt b/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpStorageUseViewModel.kt index 4a74fd1..8e8aca2 100644 --- a/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpStorageUseViewModel.kt +++ b/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpStorageUseViewModel.kt @@ -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) { - if (maWbListForClear.isEmpty()) { + fun performClear(clearNormal: String, clearRemark: String, warehouseListForClear: List) { + 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 {