feat: 国际进港舱单开始理货改用理货库位查询与开始理货接口

- 新增 getSortingStorage 接口定义,开始理货前查询运单当前库位并自动回填下拉选中
- 对话框确认提交由修改库位接口(modifyStorage)改为开始理货接口(inStorage)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-09-29 13:23:42 +08:00
parent 9b820ba8ef
commit 9e66e892f2
2 changed files with 31 additions and 28 deletions

View File

@@ -61,6 +61,7 @@ import com.lukouguoji.module_base.bean.GjjLoadingUld
import com.lukouguoji.module_base.bean.GjjManifest import com.lukouguoji.module_base.bean.GjjManifest
import com.lukouguoji.module_base.bean.GjjManifestBean import com.lukouguoji.module_base.bean.GjjManifestBean
import com.lukouguoji.module_base.bean.GjjPackTypeBean import com.lukouguoji.module_base.bean.GjjPackTypeBean
import com.lukouguoji.module_base.bean.GjjStorageUse
import com.lukouguoji.module_base.bean.GjjTallyBean import com.lukouguoji.module_base.bean.GjjTallyBean
import com.lukouguoji.module_base.bean.GjjTallyDetailsBean import com.lukouguoji.module_base.bean.GjjTallyDetailsBean
import com.lukouguoji.module_base.bean.GjjTallyRecordBean import com.lukouguoji.module_base.bean.GjjTallyRecordBean
@@ -2034,6 +2035,16 @@ interface Api {
@POST("IntImpManifest/inStorage") @POST("IntImpManifest/inStorage")
suspend fun inIntImpLoadingStorage(@Body data: RequestBody): BaseResultBean<Boolean> suspend fun inIntImpLoadingStorage(@Body data: RequestBody): BaseResultBean<Boolean>
/**
* 国际进港舱单-获取运单理货库位
* 接口路径: /IntImpManifest/getSortingStorage
*/
@POST("IntImpManifest/getSortingStorage")
suspend fun getIntImpSortingStorage(
@Query("fid") fid: Long,
@Query("wbNo") wbNo: String
): BaseResultBean<GjjStorageUse>
/** /**
* 国际进港理货报告-分页查询 * 国际进港理货报告-分页查询
*/ */

View File

@@ -482,7 +482,7 @@ class IntImpManifestViewModel : BasePageViewModel() {
} }
/** /**
* 开始理货(弹出修改库位对话框,提交理货库位) * 开始理货(先查该运单已有的理货库位并回填,确认后调用开始理货接口)
*/ */
fun startTallyClick() { fun startTallyClick() {
val list = pageModel.rv?.commonAdapter()?.items as? List<GjjManifest> ?: return val list = pageModel.rv?.commonAdapter()?.items as? List<GjjManifest> ?: return
@@ -497,37 +497,30 @@ class IntImpManifestViewModel : BasePageViewModel() {
return return
} }
// 舱单列表接口不返回理货库位,需先查装机单记录取出该运单已有的库位再弹窗回填 // 舱单列表接口不返回理货库位,需调用「获取运单理货库位」取出该运单目前的库位再弹窗回填
val selectedItem = selectedItems.first() val selectedItem = selectedItems.first()
val queryParams = mapOf( launchLoadingCollect({
"fid" to fid.ifEmpty { null }, NetApply.api.getIntImpSortingStorage(
"fdep" to fdep.ifEmpty { null }, fid = fid.toLongOrNull() ?: 0L,
"wbNo" to selectedItem.wbNo.ifEmpty { null }, wbNo = selectedItem.wbNo
"pageNum" to 1, )
"pageSize" to 1 }) {
).toRequestBody()
launchLoadingCollect({ NetApply.api.getIntImpLoadingList(queryParams) }) {
onSuccess = { result -> onSuccess = { result ->
// 装机单接口已按 ULD 分组,运单记录在 manifestList 中 showStartTallyDialog(
val tallyRecord = result.list
?.flatMap { it.manifestList ?: emptyList() }
?.let { list -> list.firstOrNull { it.wbNo == selectedItem.wbNo || it.getWaybillNo() == selectedItem.wbNo } ?: list.firstOrNull() }
showModifyStorageDialog(
selectedItems = selectedItems, selectedItems = selectedItems,
currentLocationId = tallyRecord?.locationTallyId?.takeIf { it > 0 }?.toString() ?: "", currentLocationId = result.data?.locationId?.toString() ?: "",
currentLocationName = tallyRecord?.locationTally ?: "" currentLocationName = result.data?.location ?: ""
) )
} }
// 查询失败不阻断操作,直接弹出空白库位的对话框 // 查询失败不阻断操作,直接弹出空白库位的对话框
onFailed = { _, _ -> showModifyStorageDialog(selectedItems, "", "") } onFailed = { _, _ -> showStartTallyDialog(selectedItems, "", "") }
} }
} }
/** /**
* 弹出修改库位对话框并提交(currentLocation* 用于回填该运单已有的理货库位) * 弹出理货库位对话框并提交开始理货(currentLocation* 用于回填该运单目前的理货库位)
*/ */
private fun showModifyStorageDialog( private fun showStartTallyDialog(
selectedItems: List<GjjManifest>, selectedItems: List<GjjManifest>,
currentLocationId: String, currentLocationId: String,
currentLocationName: String currentLocationName: String
@@ -542,14 +535,13 @@ class IntImpManifestViewModel : BasePageViewModel() {
"manifestList" to selectedItems "manifestList" to selectedItems
).toRequestBody() ).toRequestBody()
launchLoadingCollect({ NetApply.api.modifyIntImpLoadingStorage(params) }) { launchLoadingCollect({ NetApply.api.inIntImpLoadingStorage(params) }) {
onSuccess = { onSuccess = {
if (it.verifySuccess()) { showToast(it.msg.noNull("开始理货成功"))
showToast(it.msg.noNull("修改库位成功")) refresh()
refresh() }
} else { onFailed = { _, msg ->
showToast(it.msg.noNull("修改库位失败")) showToast(msg ?: "开始理货失败")
}
} }
} }
}.show() }.show()