feat: 国际进港舱单开始理货改用理货库位查询与开始理货接口
- 新增 getSortingStorage 接口定义,开始理货前查询运单当前库位并自动回填下拉选中 - 对话框确认提交由修改库位接口(modifyStorage)改为开始理货接口(inStorage) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -61,6 +61,7 @@ import com.lukouguoji.module_base.bean.GjjLoadingUld
|
||||
import com.lukouguoji.module_base.bean.GjjManifest
|
||||
import com.lukouguoji.module_base.bean.GjjManifestBean
|
||||
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.GjjTallyDetailsBean
|
||||
import com.lukouguoji.module_base.bean.GjjTallyRecordBean
|
||||
@@ -2034,6 +2035,16 @@ interface Api {
|
||||
@POST("IntImpManifest/inStorage")
|
||||
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>
|
||||
|
||||
/**
|
||||
* 国际进港理货报告-分页查询
|
||||
*/
|
||||
|
||||
@@ -482,7 +482,7 @@ class IntImpManifestViewModel : BasePageViewModel() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始理货(弹出修改库位对话框,提交理货库位)
|
||||
* 开始理货(先查该运单已有的理货库位并回填,确认后调用开始理货接口)
|
||||
*/
|
||||
fun startTallyClick() {
|
||||
val list = pageModel.rv?.commonAdapter()?.items as? List<GjjManifest> ?: return
|
||||
@@ -497,37 +497,30 @@ class IntImpManifestViewModel : BasePageViewModel() {
|
||||
return
|
||||
}
|
||||
|
||||
// 舱单列表接口不返回理货库位,需先查装机单记录取出该运单已有的库位再弹窗回填
|
||||
// 舱单列表接口不返回理货库位,需调用「获取运单理货库位」取出该运单目前的库位再弹窗回填
|
||||
val selectedItem = selectedItems.first()
|
||||
val queryParams = mapOf(
|
||||
"fid" to fid.ifEmpty { null },
|
||||
"fdep" to fdep.ifEmpty { null },
|
||||
"wbNo" to selectedItem.wbNo.ifEmpty { null },
|
||||
"pageNum" to 1,
|
||||
"pageSize" to 1
|
||||
).toRequestBody()
|
||||
|
||||
launchLoadingCollect({ NetApply.api.getIntImpLoadingList(queryParams) }) {
|
||||
launchLoadingCollect({
|
||||
NetApply.api.getIntImpSortingStorage(
|
||||
fid = fid.toLongOrNull() ?: 0L,
|
||||
wbNo = selectedItem.wbNo
|
||||
)
|
||||
}) {
|
||||
onSuccess = { result ->
|
||||
// 装机单接口已按 ULD 分组,运单记录在 manifestList 中
|
||||
val tallyRecord = result.list
|
||||
?.flatMap { it.manifestList ?: emptyList() }
|
||||
?.let { list -> list.firstOrNull { it.wbNo == selectedItem.wbNo || it.getWaybillNo() == selectedItem.wbNo } ?: list.firstOrNull() }
|
||||
showModifyStorageDialog(
|
||||
showStartTallyDialog(
|
||||
selectedItems = selectedItems,
|
||||
currentLocationId = tallyRecord?.locationTallyId?.takeIf { it > 0 }?.toString() ?: "",
|
||||
currentLocationName = tallyRecord?.locationTally ?: ""
|
||||
currentLocationId = result.data?.locationId?.toString() ?: "",
|
||||
currentLocationName = result.data?.location ?: ""
|
||||
)
|
||||
}
|
||||
// 查询失败不阻断操作,直接弹出空白库位的对话框
|
||||
onFailed = { _, _ -> showModifyStorageDialog(selectedItems, "", "") }
|
||||
onFailed = { _, _ -> showStartTallyDialog(selectedItems, "", "") }
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 弹出修改库位对话框并提交(currentLocation* 用于回填该运单已有的理货库位)
|
||||
* 弹出理货库位对话框并提交开始理货(currentLocation* 用于回填该运单目前的理货库位)
|
||||
*/
|
||||
private fun showModifyStorageDialog(
|
||||
private fun showStartTallyDialog(
|
||||
selectedItems: List<GjjManifest>,
|
||||
currentLocationId: String,
|
||||
currentLocationName: String
|
||||
@@ -542,14 +535,13 @@ class IntImpManifestViewModel : BasePageViewModel() {
|
||||
"manifestList" to selectedItems
|
||||
).toRequestBody()
|
||||
|
||||
launchLoadingCollect({ NetApply.api.modifyIntImpLoadingStorage(params) }) {
|
||||
launchLoadingCollect({ NetApply.api.inIntImpLoadingStorage(params) }) {
|
||||
onSuccess = {
|
||||
if (it.verifySuccess()) {
|
||||
showToast(it.msg.noNull("修改库位成功"))
|
||||
showToast(it.msg.noNull("开始理货成功"))
|
||||
refresh()
|
||||
} else {
|
||||
showToast(it.msg.noNull("修改库位失败"))
|
||||
}
|
||||
onFailed = { _, msg ->
|
||||
showToast(msg ?: "开始理货失败")
|
||||
}
|
||||
}
|
||||
}.show()
|
||||
|
||||
Reference in New Issue
Block a user