feat: 国际出港 出港仓库 出库
This commit is contained in:
@@ -825,6 +825,13 @@ interface Api {
|
|||||||
@POST("IntExpStorageUse/modifyStorage")
|
@POST("IntExpStorageUse/modifyStorage")
|
||||||
suspend fun modifyIntExpStorage(@Body data: RequestBody): BaseResultBean<Boolean>
|
suspend fun modifyIntExpStorage(@Body data: RequestBody): BaseResultBean<Boolean>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 国际出港库位操作-出库
|
||||||
|
* 接口路径: /IntExpStorageUse/outStorage
|
||||||
|
*/
|
||||||
|
@POST("IntExpStorageUse/outStorage")
|
||||||
|
suspend fun outIntExpStorage(@Body data: RequestBody): BaseResultBean<Boolean>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 国际出港仓库-分页查询
|
* 国际出港仓库-分页查询
|
||||||
* 接口路径: /IntExpStorageUse/pageQuery
|
* 接口路径: /IntExpStorageUse/pageQuery
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.lukouguoji.gjc.activity
|
|||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import androidx.appcompat.app.AlertDialog
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route
|
import com.alibaba.android.arouter.facade.annotation.Route
|
||||||
import com.lukouguoji.gjc.R
|
import com.lukouguoji.gjc.R
|
||||||
import com.lukouguoji.gjc.databinding.ActivityIntExpStorageUseBinding
|
import com.lukouguoji.gjc.databinding.ActivityIntExpStorageUseBinding
|
||||||
@@ -119,6 +120,37 @@ class IntExpStorageUseActivity :
|
|||||||
}.show(this)
|
}.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?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
super.onActivityResult(requestCode, resultCode, data)
|
super.onActivityResult(requestCode, resultCode, data)
|
||||||
if (requestCode == Constant.RequestCode.WAYBILL && resultCode == Activity.RESULT_OK) {
|
if (requestCode == Constant.RequestCode.WAYBILL && resultCode == Activity.RESULT_OK) {
|
||||||
|
|||||||
@@ -207,24 +207,37 @@ class IntExpStorageUseViewModel : BasePageViewModel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 出库操作
|
* 出库操作(在Activity中调用,会显示二次确认对话框)
|
||||||
*/
|
*/
|
||||||
fun outStorage() {
|
fun outStorage() {
|
||||||
val list = pageModel.rv?.commonAdapter()?.items as? List<GjcMaWb> ?: return
|
// 由Activity显示二次确认对话框
|
||||||
|
}
|
||||||
|
|
||||||
// 收集所有选中的子列表项(库位)
|
/**
|
||||||
val selectedStorageUseList = mutableListOf<com.lukouguoji.module_base.bean.GjcStorageUse>()
|
* 执行出库操作
|
||||||
list.forEach { maWb ->
|
* @param selectedStorageList 选中的子列表项(库位)
|
||||||
maWb.storageUseList?.filter { it.isSelected }?.let { selectedStorageUseList.addAll(it) }
|
*/
|
||||||
}
|
fun performOutStorage(selectedStorageList: List<com.lukouguoji.module_base.bean.GjcStorageUse>) {
|
||||||
|
if (selectedStorageList.isEmpty()) {
|
||||||
if (selectedStorageUseList.isEmpty()) {
|
|
||||||
showToast("请选择要出库的库位")
|
showToast("请选择要出库的库位")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: 实现出库接口调用
|
// 将选中的子列表项转换为RequestBody
|
||||||
showToast("出库功能待实现")
|
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("出库失败"))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -234,7 +234,7 @@
|
|||||||
<!-- 出库按钮 -->
|
<!-- 出库按钮 -->
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/tv_bottom_btn"
|
style="@style/tv_bottom_btn"
|
||||||
android:onClick="@{()-> viewModel.outStorage()}"
|
android:onClick="@{()-> activity.showOutStorageDialog()}"
|
||||||
android:text="出 库" />
|
android:text="出 库" />
|
||||||
|
|
||||||
<!-- 入库按钮 -->
|
<!-- 入库按钮 -->
|
||||||
|
|||||||
Reference in New Issue
Block a user