feat: 国际出港 出港仓库 仓位修改
This commit is contained in:
@@ -80,13 +80,22 @@ class IntExpStorageUseViewModel : BasePageViewModel() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 全选按钮点击
|
||||
* 全选按钮点击(联动勾选所有子列表项)
|
||||
*/
|
||||
fun checkAllClick() {
|
||||
val list = pageModel.rv?.commonAdapter()?.items as? List<GjcMaWb> ?: return
|
||||
|
||||
val shouldCheckAll = !isAllChecked.value!!
|
||||
list.forEach { it.checked.set(shouldCheckAll) }
|
||||
|
||||
// 联动勾选/取消主列表和子列表
|
||||
list.forEach { maWb ->
|
||||
maWb.checked.set(shouldCheckAll)
|
||||
// 同时联动勾选/取消所有子列表项
|
||||
maWb.storageUseList?.forEach { storageUse ->
|
||||
storageUse.checked.set(shouldCheckAll)
|
||||
}
|
||||
}
|
||||
|
||||
isAllChecked.value = shouldCheckAll
|
||||
|
||||
pageModel.rv?.commonAdapter()?.notifyDataSetChanged()
|
||||
@@ -131,20 +140,18 @@ class IntExpStorageUseViewModel : BasePageViewModel() {
|
||||
/**
|
||||
* 执行清仓操作
|
||||
* @param clearNormal 清仓正常("0"或"1")
|
||||
* @param maWbListForClear 包含选中子列表项的主列表数据
|
||||
*/
|
||||
fun performClear(clearNormal: String) {
|
||||
val list = pageModel.rv?.commonAdapter()?.items as? List<GjcMaWb> ?: return
|
||||
val selectedItems = list.filter { it.isSelected }
|
||||
|
||||
if (selectedItems.isEmpty()) {
|
||||
showToast("请至少选择一条运单")
|
||||
fun performClear(clearNormal: String, maWbListForClear: List<GjcMaWb>) {
|
||||
if (maWbListForClear.isEmpty()) {
|
||||
showToast("请至少选择一个库位")
|
||||
return
|
||||
}
|
||||
|
||||
// 构建请求参数
|
||||
// 构建请求参数:完整的主子列表结构
|
||||
val params = mapOf(
|
||||
"clearNormal" to clearNormal,
|
||||
"maWbList" to selectedItems
|
||||
"maWbList" to maWbListForClear
|
||||
).toRequestBody()
|
||||
|
||||
launchLoadingCollect({ NetApply.api.clearIntExpStorage(params) }) {
|
||||
@@ -165,16 +172,38 @@ class IntExpStorageUseViewModel : BasePageViewModel() {
|
||||
* 修改库位
|
||||
*/
|
||||
fun modifyStorage() {
|
||||
val list = pageModel.rv?.commonAdapter()?.items as? List<GjcMaWb> ?: return
|
||||
val selectedItems = list.filter { it.isSelected }
|
||||
// 由Activity显示对话框
|
||||
}
|
||||
|
||||
if (selectedItems.isEmpty()) {
|
||||
showToast("请选择要修改库位的运单")
|
||||
/**
|
||||
* 执行修改库位操作
|
||||
* @param newLocation 新的库位号
|
||||
* @param storageUse 选中的单个库位使用对象
|
||||
*/
|
||||
fun performModifyStorage(newLocation: String, storageUse: com.lukouguoji.module_base.bean.GjcStorageUse) {
|
||||
if (newLocation.isEmpty()) {
|
||||
showToast("请输入新的库位号")
|
||||
return
|
||||
}
|
||||
|
||||
// TODO: 实现修改库位接口调用或弹出对话框
|
||||
showToast("修改库位功能待实现")
|
||||
// 创建更新后的库位对象(覆盖 location 字段)
|
||||
val updatedStorage = storageUse.copy(location = newLocation)
|
||||
|
||||
// 直接使用更新后的对象构建请求参数
|
||||
val params = updatedStorage.toRequestBody()
|
||||
|
||||
launchLoadingCollect({ NetApply.api.modifyIntExpStorage(params) }) {
|
||||
onSuccess = {
|
||||
showToast("修改库位成功")
|
||||
viewModelScope.launch {
|
||||
FlowBus.with<String>(ConstantEvent.EVENT_REFRESH).emit("refresh")
|
||||
}
|
||||
refresh() // 刷新列表
|
||||
}
|
||||
onFailed = { _, msg ->
|
||||
showToast(msg.noNull("修改库位失败"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -182,10 +211,15 @@ class IntExpStorageUseViewModel : BasePageViewModel() {
|
||||
*/
|
||||
fun outStorage() {
|
||||
val list = pageModel.rv?.commonAdapter()?.items as? List<GjcMaWb> ?: return
|
||||
val selectedItems = list.filter { it.isSelected }
|
||||
|
||||
if (selectedItems.isEmpty()) {
|
||||
showToast("请选择要出库的运单")
|
||||
// 收集所有选中的子列表项(库位)
|
||||
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("请选择要出库的库位")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -198,10 +232,15 @@ class IntExpStorageUseViewModel : BasePageViewModel() {
|
||||
*/
|
||||
fun inStorage() {
|
||||
val list = pageModel.rv?.commonAdapter()?.items as? List<GjcMaWb> ?: return
|
||||
val selectedItems = list.filter { it.isSelected }
|
||||
|
||||
if (selectedItems.isEmpty()) {
|
||||
showToast("请选择要入库的运单")
|
||||
// 收集所有选中的子列表项(库位)
|
||||
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("请选择要入库的库位")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user