From a4095d6e725f1c7d675163357e5c0c0034cd7ca9 Mon Sep 17 00:00:00 2001 From: YANGJIANKUAN Date: Fri, 13 Mar 2026 14:06:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9B=BD=E9=99=85=E8=BF=9B=E6=B8=AF?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E6=8E=A5=E5=8F=A3=E8=B7=AF=E5=BE=84=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=8F=8A=E6=93=8D=E4=BD=9C=E9=80=BB=E8=BE=91=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - API路径从 IntImpStorageUse 修正为 IntImpStorage - 清仓/入库接口参数改为 Query + Body 分离传递 - 清仓/出库/入库支持勾选运单号全选所有库位 - 出库确认弹框改为自定义 ConfirmDialogModel - 搜索增加清仓综合结果筛选参数 Co-Authored-By: Claude Opus 4.6 --- .../lukouguoji/module_base/http/net/Api.kt | 28 ++++---- .../gjj/activity/IntImpStorageUseActivity.kt | 65 ++++++++++++------- .../viewModel/IntImpStorageUseViewModel.kt | 24 +++---- .../layout/activity_int_imp_storage_use.xml | 2 +- 4 files changed, 66 insertions(+), 53 deletions(-) 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 dd64d48..eed277b 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 @@ -912,45 +912,45 @@ interface Api { /** * 国际进港仓库-分页查询 - * 接口路径: /IntImpStorageUse/pageQuery + * 接口路径: /IntImpStorage/pageQuery */ - @POST("IntImpStorageUse/pageQuery") + @POST("IntImpStorage/pageQuery") suspend fun getIntImpStorageUseList(@Body data: RequestBody): PageInfo /** * 国际进港仓库-分页合计 - * 接口路径: /IntImpStorageUse/pageQueryTotal + * 接口路径: /IntImpStorage/pageQueryTotal */ - @POST("IntImpStorageUse/pageQueryTotal") + @POST("IntImpStorage/pageQueryTotal") suspend fun getIntImpStorageUseTotal(@Body data: RequestBody): BaseResultBean /** * 国际进港库位操作-清仓 - * 接口路径: /IntImpStorageUse/updateClear + * 接口路径: /IntImpStorage/updateClear */ - @POST("IntImpStorageUse/updateClear") - suspend fun clearIntImpStorage(@Body data: RequestBody): BaseResultBean + @POST("IntImpStorage/updateClear") + suspend fun clearIntImpStorage(@Query("clearNormal") clearNormal: String, @Body data: RequestBody): BaseResultBean /** * 国际进港库位操作-修改库位 - * 接口路径: /IntImpStorageUse/modifyStorage + * 接口路径: /IntImpStorage/modifyStorage */ - @POST("IntImpStorageUse/modifyStorage") + @POST("IntImpStorage/modifyStorage") suspend fun modifyIntImpStorage(@Body data: RequestBody): BaseResultBean /** * 国际进港库位操作-出库 - * 接口路径: /IntImpStorageUse/outStorage + * 接口路径: /IntImpStorage/outStorage */ - @POST("IntImpStorageUse/outStorage") + @POST("IntImpStorage/outStorage") suspend fun outIntImpStorage(@Body data: RequestBody): BaseResultBean /** * 国际进港库位操作-入库 - * 接口路径: /IntImpStorageUse/inStorage + * 接口路径: /IntImpStorage/inStorage */ - @POST("IntImpStorageUse/inStorage") - suspend fun inIntImpStorage(@Body data: RequestBody): BaseResultBean + @POST("IntImpStorage/inStorage") + suspend fun inIntImpStorage(@Query("location") location: String, @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 4c467d1..8908aab 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 @@ -3,7 +3,7 @@ package com.lukouguoji.gjj.activity import android.app.Activity import android.content.Intent import android.os.Bundle -import androidx.appcompat.app.AlertDialog +import com.lukouguoji.module_base.model.ConfirmDialogModel import com.alibaba.android.arouter.facade.annotation.Route import com.lukouguoji.gjj.R import com.lukouguoji.gjj.databinding.ActivityIntImpStorageUseBinding @@ -60,12 +60,17 @@ class IntImpStorageUseActivity : val allItems = list.filterIsInstance() val maWbListForClear = allItems.mapNotNull { maWb -> - val selectedStorageList = maWb.storageUseList?.filter { it.isSelected } ?: emptyList() - - if (selectedStorageList.isNotEmpty() || maWb.isSelected) { - maWb.copy(storageUseList = selectedStorageList) + if (maWb.isSelected) { + // 勾选运单号 → 默认全选该运单号下的所有库位 + maWb.copy(storageUseList = maWb.storageUseList ?: emptyList()) } else { - null + // 勾选库位号 → 只对选择的库位进行操作 + val selectedStorageList = maWb.storageUseList?.filter { it.isSelected } ?: emptyList() + if (selectedStorageList.isNotEmpty()) { + maWb.copy(storageUseList = selectedStorageList) + } else { + null + } } } @@ -105,6 +110,7 @@ class IntImpStorageUseActivity : val selectedStorage = selectedStorageUseList[0] + // 弹出库位选择弹框,选择后再调用接口 IntImpModifyStorageDialogModel { dialog -> val locationName = dialog.locationName val locationId = dialog.locationId @@ -119,24 +125,32 @@ class IntImpStorageUseActivity : val list = viewModel.pageModel.rv?.commonAdapter()?.items as? List<*> ?: return val allItems = list.filterIsInstance() - val selectedStorageUseList = mutableListOf() - allItems.forEach { maWb -> - maWb.storageUseList?.filter { it.isSelected }?.let { selectedStorageUseList.addAll(it) } + 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 + } + } } - if (selectedStorageUseList.isEmpty()) { + if (maWbListForOutStorage.isEmpty()) { showToast("请选择要出库的库位") return } - AlertDialog.Builder(this) - .setTitle("出库确认") - .setMessage("确定要将选中的 ${selectedStorageUseList.size} 个库位执行出库操作吗?") - .setPositiveButton("确定") { _, _ -> - viewModel.performOutStorage(selectedStorageUseList) - } - .setNegativeButton("取消", null) - .show() + ConfirmDialogModel( + message = "是否确认出库?", + title = "出库确认" + ) { + viewModel.performOutStorage(maWbListForOutStorage) + }.show(this) } /** @@ -147,12 +161,17 @@ class IntImpStorageUseActivity : val allItems = list.filterIsInstance() val maWbListForInStorage = allItems.mapNotNull { maWb -> - val selectedStorageList = maWb.storageUseList?.filter { it.isSelected } ?: emptyList() - - if (selectedStorageList.isNotEmpty() || maWb.isSelected) { - maWb.copy(storageUseList = selectedStorageList) + if (maWb.isSelected) { + // 勾选运单号 → 默认全选该运单号下的所有库位 + maWb.copy(storageUseList = maWb.storageUseList ?: emptyList()) } else { - null + // 勾选库位号 → 只对选择的库位进行操作 + val selectedStorageList = maWb.storageUseList?.filter { it.isSelected } ?: emptyList() + if (selectedStorageList.isNotEmpty()) { + maWb.copy(storageUseList = selectedStorageList) + } else { + null + } } } 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 64719bc..0be20ce 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 @@ -124,12 +124,9 @@ class IntImpStorageUseViewModel : BasePageViewModel() { return } - val params = mapOf( - "clearNormal" to clearNormal, - "maWbList" to maWbListForClear - ).toRequestBody() + val body = maWbListForClear.toRequestBody() - launchLoadingCollect({ NetApply.api.clearIntImpStorage(params) }) { + launchLoadingCollect({ NetApply.api.clearIntImpStorage(clearNormal, body) }) { onSuccess = { showToast("清仓成功") viewModelScope.launch { @@ -188,13 +185,13 @@ class IntImpStorageUseViewModel : BasePageViewModel() { /** * 执行出库操作 */ - fun performOutStorage(selectedStorageList: List) { - if (selectedStorageList.isEmpty()) { + fun performOutStorage(maWbListForOutStorage: List) { + if (maWbListForOutStorage.isEmpty()) { showToast("请选择要出库的库位") return } - val params = selectedStorageList.toRequestBody() + val params = maWbListForOutStorage.toRequestBody() launchLoadingCollect({ NetApply.api.outIntImpStorage(params) }) { onSuccess = { @@ -232,13 +229,9 @@ class IntImpStorageUseViewModel : BasePageViewModel() { return } - val params = mapOf( - "location" to locationName, - "locationId" to locationId.toLongOrNull(), - "maWbList" to maWbListForInStorage - ).toRequestBody() + val body = maWbListForInStorage.toRequestBody() - launchLoadingCollect({ NetApply.api.inIntImpStorage(params) }) { + launchLoadingCollect({ NetApply.api.inIntImpStorage(locationName, body) }) { onSuccess = { showToast("入库成功") viewModelScope.launch { @@ -257,7 +250,8 @@ class IntImpStorageUseViewModel : BasePageViewModel() { "fdate" to flightDate.value?.ifEmpty { null }, "fno" to flightNo.value?.ifEmpty { null }, "wbNo" to wbNo.value?.ifEmpty { null }, - "location" to location.value?.ifEmpty { null } + "location" to location.value?.ifEmpty { null }, + "clearNormal" to clearResult.value?.ifEmpty { null } ) val listParams = (filterParams + mapOf( diff --git a/module_gjj/src/main/res/layout/activity_int_imp_storage_use.xml b/module_gjj/src/main/res/layout/activity_int_imp_storage_use.xml index 92168b0..e282bb3 100644 --- a/module_gjj/src/main/res/layout/activity_int_imp_storage_use.xml +++ b/module_gjj/src/main/res/layout/activity_int_imp_storage_use.xml @@ -72,7 +72,7 @@ autoQueryMinLength="@{4}" autoQueryParamKey="@{`wbNo`}" autoQueryTitle="@{`选择运单号`}" - autoQueryUrl="@{`/IntImpStorageUse/queryWbNoList`}" + autoQueryUrl="@{`/IntImpStorage/queryWbNoList`}" hint='@{"请输入运单号"}' icon="@{@drawable/img_scan}" setOnIconClickListener="@{(v)-> viewModel.scanWbNo()}"