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:
@@ -991,11 +991,7 @@ interface Api {
|
|||||||
* 接口路径: /IntImpStorage/updateClear
|
* 接口路径: /IntImpStorage/updateClear
|
||||||
*/
|
*/
|
||||||
@POST("IntImpStorage/updateClear")
|
@POST("IntImpStorage/updateClear")
|
||||||
suspend fun clearIntImpStorage(
|
suspend fun clearIntImpStorage(@Body data: RequestBody): BaseResultBean<Boolean>
|
||||||
@Query("clearNormal") clearNormal: String,
|
|
||||||
@Query("clearRemark") clearRemark: String?,
|
|
||||||
@Body data: RequestBody
|
|
||||||
): BaseResultBean<Boolean>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 国际进港库位操作-修改库位
|
* 国际进港库位操作-修改库位
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ 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 maWbListForClear = allItems.mapNotNull { maWb ->
|
val warehouseListForClear = allItems.mapNotNull { maWb ->
|
||||||
if (maWb.isSelected) {
|
if (maWb.isSelected) {
|
||||||
// 勾选运单号 → 默认全选该运单号下的所有库位
|
// 勾选运单号 → 默认全选该运单号下的所有库位
|
||||||
maWb.copy(storageUseList = maWb.storageUseList ?: emptyList())
|
maWb.copy(storageUseList = maWb.storageUseList ?: emptyList())
|
||||||
@@ -71,7 +71,7 @@ class IntImpStorageUseActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maWbListForClear.isEmpty()) {
|
if (warehouseListForClear.isEmpty()) {
|
||||||
showToast("请至少选择一个库位")
|
showToast("请至少选择一个库位")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,7 @@ class IntImpStorageUseActivity :
|
|||||||
IntImpMoveClearDialogModel { dialog ->
|
IntImpMoveClearDialogModel { dialog ->
|
||||||
val clearNormal = dialog.clearNormal.value ?: ""
|
val clearNormal = dialog.clearNormal.value ?: ""
|
||||||
val clearRemark = dialog.clearRemark.value ?: ""
|
val clearRemark = dialog.clearRemark.value ?: ""
|
||||||
viewModel.performClear(clearNormal, clearRemark, maWbListForClear)
|
viewModel.performClear(clearNormal, clearRemark, warehouseListForClear)
|
||||||
}.show(this)
|
}.show(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,20 +119,22 @@ class IntImpStorageUseViewModel : BasePageViewModel() {
|
|||||||
* 执行清仓操作
|
* 执行清仓操作
|
||||||
* @param clearNormal 清仓正常("0"或"1")
|
* @param clearNormal 清仓正常("0"或"1")
|
||||||
* @param clearRemark 清仓备注(选填)
|
* @param clearRemark 清仓备注(选填)
|
||||||
* @param maWbListForClear 包含选中子列表项的主列表数据
|
* @param warehouseListForClear 包含选中子列表项的主列表数据
|
||||||
*/
|
*/
|
||||||
fun performClear(clearNormal: String, clearRemark: String, maWbListForClear: List<GjcMaWb>) {
|
fun performClear(clearNormal: String, clearRemark: String, warehouseListForClear: List<GjcMaWb>) {
|
||||||
if (maWbListForClear.isEmpty()) {
|
if (warehouseListForClear.isEmpty()) {
|
||||||
showToast("请至少选择一个库位")
|
showToast("请至少选择一个库位")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 备注同时通过 query 参数和主单字段传递,兼容服务端两种取值方式
|
// 构建请求参数:清仓标志与备注在顶层,选中数据放 warehouseList
|
||||||
val remark = clearRemark.ifEmpty { null }
|
val params = mapOf(
|
||||||
maWbListForClear.forEach { it.clearRemark = remark }
|
"clearNormal" to clearNormal,
|
||||||
val body = maWbListForClear.toRequestBody()
|
"clearRemark" to clearRemark.ifEmpty { null },
|
||||||
|
"warehouseList" to warehouseListForClear
|
||||||
|
).toRequestBody()
|
||||||
|
|
||||||
launchLoadingCollect({ NetApply.api.clearIntImpStorage(clearNormal, remark, body) }) {
|
launchLoadingCollect({ NetApply.api.clearIntImpStorage(params) }) {
|
||||||
onSuccess = {
|
onSuccess = {
|
||||||
showToast("清仓成功")
|
showToast("清仓成功")
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
|
|||||||
Reference in New Issue
Block a user