feat: 国际出港 出港仓库 出库

This commit is contained in:
2026-01-16 17:53:46 +08:00
parent a8d125ef9d
commit dfddf646f5
4 changed files with 64 additions and 12 deletions

View File

@@ -825,6 +825,13 @@ interface Api {
@POST("IntExpStorageUse/modifyStorage")
suspend fun modifyIntExpStorage(@Body data: RequestBody): BaseResultBean<Boolean>
/**
* 国际出港库位操作-出库
* 接口路径: /IntExpStorageUse/outStorage
*/
@POST("IntExpStorageUse/outStorage")
suspend fun outIntExpStorage(@Body data: RequestBody): BaseResultBean<Boolean>
/**
* 国际出港仓库-分页查询
* 接口路径: /IntExpStorageUse/pageQuery

View File

@@ -3,6 +3,7 @@ package com.lukouguoji.gjc.activity
import android.app.Activity
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AlertDialog
import com.alibaba.android.arouter.facade.annotation.Route
import com.lukouguoji.gjc.R
import com.lukouguoji.gjc.databinding.ActivityIntExpStorageUseBinding
@@ -119,6 +120,37 @@ class IntExpStorageUseActivity :
}.show(this)
}
/**
* 显示出库二次确认对话框
*/
fun showOutStorageDialog() {
val list = viewModel.pageModel.rv?.commonAdapter()?.items as? List<*> ?: return
val allItems = list.filterIsInstance<com.lukouguoji.module_base.bean.GjcMaWb>()
// 收集所有选中的子列表项(库位)
val selectedStorageUseList = mutableListOf<com.lukouguoji.module_base.bean.GjcStorageUse>()
allItems.forEach { maWb ->
maWb.storageUseList?.filter { it.isSelected }?.let { selectedStorageUseList.addAll(it) }
}
// 校验:必须至少选中一个库位
if (selectedStorageUseList.isEmpty()) {
showToast("请选择要出库的库位")
return
}
// 显示二次确认对话框
AlertDialog.Builder(this)
.setTitle("出库确认")
.setMessage("确定要将选中的 ${selectedStorageUseList.size} 个库位执行出库操作吗?")
.setPositiveButton("确定") { _, _ ->
// 用户确认后,执行出库操作
viewModel.performOutStorage(selectedStorageUseList)
}
.setNegativeButton("取消", null)
.show()
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == Constant.RequestCode.WAYBILL && resultCode == Activity.RESULT_OK) {

View File

@@ -207,24 +207,37 @@ class IntExpStorageUseViewModel : BasePageViewModel() {
}
/**
* 出库操作
* 出库操作在Activity中调用会显示二次确认对话框
*/
fun outStorage() {
val list = pageModel.rv?.commonAdapter()?.items as? List<GjcMaWb> ?: return
// 收集所有选中的子列表项(库位)
val selectedStorageUseList = mutableListOf<com.lukouguoji.module_base.bean.GjcStorageUse>()
list.forEach { maWb ->
maWb.storageUseList?.filter { it.isSelected }?.let { selectedStorageUseList.addAll(it) }
// 由Activity显示二次确认对话框
}
if (selectedStorageUseList.isEmpty()) {
/**
* 执行出库操作
* @param selectedStorageList 选中的子列表项(库位)
*/
fun performOutStorage(selectedStorageList: List<com.lukouguoji.module_base.bean.GjcStorageUse>) {
if (selectedStorageList.isEmpty()) {
showToast("请选择要出库的库位")
return
}
// TODO: 实现出库接口调用
showToast("出库功能待实现")
// 将选中的子列表项转换为RequestBody
val params = selectedStorageList.toRequestBody()
launchLoadingCollect({ NetApply.api.outIntExpStorage(params) }) {
onSuccess = {
showToast("出库成功")
viewModelScope.launch {
FlowBus.with<String>(ConstantEvent.EVENT_REFRESH).emit("refresh")
}
refresh() // 刷新列表
}
onFailed = { _, msg ->
showToast(msg.noNull("出库失败"))
}
}
}
/**

View File

@@ -234,7 +234,7 @@
<!-- 出库按钮 -->
<TextView
style="@style/tv_bottom_btn"
android:onClick="@{()-> viewModel.outStorage()}"
android:onClick="@{()-> activity.showOutStorageDialog()}"
android:text="出 库" />
<!-- 入库按钮 -->