feat: 国际出港 出港仓库 finish

This commit is contained in:
2026-01-17 16:30:29 +08:00
parent dfddf646f5
commit e2f6cdde04
8 changed files with 312 additions and 26 deletions

View File

@@ -177,17 +177,25 @@ class IntExpStorageUseViewModel : BasePageViewModel() {
/**
* 执行修改库位操作
* @param newLocation 新的库位
* @param locationName 新的库位名称 (后端的location字段)
* @param locationId 新的库位ID (后端的locationId字段)
* @param storageUse 选中的单个库位使用对象
*/
fun performModifyStorage(newLocation: String, storageUse: com.lukouguoji.module_base.bean.GjcStorageUse) {
if (newLocation.isEmpty()) {
showToast("请输入新的库位号")
fun performModifyStorage(
locationName: String,
locationId: String,
storageUse: com.lukouguoji.module_base.bean.GjcStorageUse
) {
if (locationName.isEmpty() || locationId.isEmpty()) {
showToast("请选择库位")
return
}
// 创建更新后的库位对象(覆盖 location 字段)
val updatedStorage = storageUse.copy(location = newLocation)
// 创建更新后的库位对象(覆盖 location 和 locationId 字段)
val updatedStorage = storageUse.copy(
location = locationName,
locationId = locationId.toLongOrNull() ?: 0
)
// 直接使用更新后的对象构建请求参数
val params = updatedStorage.toRequestBody()
@@ -244,21 +252,49 @@ class IntExpStorageUseViewModel : BasePageViewModel() {
* 入库操作
*/
fun inStorage() {
val list = pageModel.rv?.commonAdapter()?.items as? List<GjcMaWb> ?: return
// 由Activity显示对话框
}
// 收集所有选中的子列表项(库位)
val selectedStorageUseList = mutableListOf<com.lukouguoji.module_base.bean.GjcStorageUse>()
list.forEach { maWb ->
maWb.storageUseList?.filter { it.isSelected }?.let { selectedStorageUseList.addAll(it) }
}
if (selectedStorageUseList.isEmpty()) {
showToast("请选择要入库的库位")
/**
* 执行入库操作
* @param locationName 库位名称 (后端的location字段)
* @param locationId 库位ID (后端的locationId字段)
* @param maWbListForInStorage 包含选中子列表项的主列表数据
*/
fun performInStorage(
locationName: String,
locationId: String,
maWbListForInStorage: List<GjcMaWb>
) {
if (maWbListForInStorage.isEmpty()) {
showToast("请至少选择一个单据")
return
}
// TODO: 实现入库接口调用
showToast("入库功能待实现")
if (locationName.isEmpty() || locationId.isEmpty()) {
showToast("请选择库位")
return
}
// 构建请求参数:库位名称 + 库位ID + 完整的主子列表结构
val params = mapOf(
"location" to locationName,
"locationId" to locationId.toLongOrNull(),
"maWbList" to maWbListForInStorage
).toRequestBody()
launchLoadingCollect({ NetApply.api.inIntExpStorage(params) }) {
onSuccess = {
showToast("入库成功")
viewModelScope.launch {
FlowBus.with<String>(ConstantEvent.EVENT_REFRESH).emit("refresh")
}
refresh() // 刷新列表
}
onFailed = { _, msg ->
showToast(msg.noNull("入库失败"))
}
}
}
/**