feat: 国际出港 出港仓库 清仓
This commit is contained in:
@@ -811,6 +811,13 @@ interface Api {
|
|||||||
@POST("IntExpMove/move")
|
@POST("IntExpMove/move")
|
||||||
suspend fun submitIntExpMove(@Body data: RequestBody): BaseResultBean<SimpleResultBean>
|
suspend fun submitIntExpMove(@Body data: RequestBody): BaseResultBean<SimpleResultBean>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 国际出港库位操作-清仓
|
||||||
|
* 接口路径: /IntExpStorageUse/updateClear
|
||||||
|
*/
|
||||||
|
@POST("IntExpStorageUse/updateClear")
|
||||||
|
suspend fun clearIntExpStorage(@Body data: RequestBody): BaseResultBean<Boolean>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 国际出港仓库-分页查询
|
* 国际出港仓库-分页查询
|
||||||
* 接口路径: /IntExpStorageUse/pageQuery
|
* 接口路径: /IntExpStorageUse/pageQuery
|
||||||
|
|||||||
@@ -6,12 +6,15 @@ import android.os.Bundle
|
|||||||
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
|
||||||
|
import com.lukouguoji.gjc.dialog.IntExpMoveClearDialogModel
|
||||||
import com.lukouguoji.gjc.viewModel.IntExpStorageUseViewModel
|
import com.lukouguoji.gjc.viewModel.IntExpStorageUseViewModel
|
||||||
import com.lukouguoji.module_base.base.BaseBindingActivity
|
import com.lukouguoji.module_base.base.BaseBindingActivity
|
||||||
import com.lukouguoji.module_base.common.Constant
|
import com.lukouguoji.module_base.common.Constant
|
||||||
import com.lukouguoji.module_base.common.ConstantEvent
|
import com.lukouguoji.module_base.common.ConstantEvent
|
||||||
import com.lukouguoji.module_base.impl.FlowBus
|
import com.lukouguoji.module_base.impl.FlowBus
|
||||||
import com.lukouguoji.module_base.impl.observe
|
import com.lukouguoji.module_base.impl.observe
|
||||||
|
import com.lukouguoji.module_base.ktx.commonAdapter
|
||||||
|
import com.lukouguoji.module_base.ktx.showToast
|
||||||
import com.lukouguoji.module_base.router.ARouterConstants
|
import com.lukouguoji.module_base.router.ARouterConstants
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,6 +30,7 @@ class IntExpStorageUseActivity :
|
|||||||
override fun initOnCreate(savedInstanceState: Bundle?) {
|
override fun initOnCreate(savedInstanceState: Bundle?) {
|
||||||
setBackArrow("国际出港仓库")
|
setBackArrow("国际出港仓库")
|
||||||
binding.viewModel = viewModel
|
binding.viewModel = viewModel
|
||||||
|
binding.activity = this
|
||||||
|
|
||||||
// 观察全选状态,更新图标透明度
|
// 观察全选状态,更新图标透明度
|
||||||
viewModel.isAllChecked.observe(this) { isAllChecked ->
|
viewModel.isAllChecked.observe(this) { isAllChecked ->
|
||||||
@@ -45,6 +49,27 @@ class IntExpStorageUseActivity :
|
|||||||
viewModel.refresh()
|
viewModel.refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示清仓操作对话框
|
||||||
|
*/
|
||||||
|
fun showClearDialog() {
|
||||||
|
val list = viewModel.pageModel.rv?.commonAdapter()?.items as? List<*> ?: return
|
||||||
|
val selectedItems = list.filterIsInstance<com.lukouguoji.module_base.bean.GjcMaWb>()
|
||||||
|
.filter { it.isSelected }
|
||||||
|
|
||||||
|
if (selectedItems.isEmpty()) {
|
||||||
|
showToast("请至少选择一条运单")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 显示清仓对话框
|
||||||
|
IntExpMoveClearDialogModel { dialog ->
|
||||||
|
// 用户点击保存后,执行清仓操作
|
||||||
|
val clearNormal = dialog.clearNormal.value ?: ""
|
||||||
|
viewModel.performClear(clearNormal)
|
||||||
|
}.show(this)
|
||||||
|
}
|
||||||
|
|
||||||
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) {
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.lukouguoji.gjc.dialog
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import com.lukouguoji.gjc.R
|
||||||
|
import com.lukouguoji.gjc.databinding.DialogIntExpMoveClearBinding
|
||||||
|
import com.lukouguoji.module_base.base.BaseDialogModel
|
||||||
|
import com.lukouguoji.module_base.ktx.verifyNullOrEmpty
|
||||||
|
import dev.utils.app.info.KeyValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 国际出港移库 - 清仓操作对话框
|
||||||
|
*/
|
||||||
|
class IntExpMoveClearDialogModel(
|
||||||
|
private val callback: (IntExpMoveClearDialogModel) -> Unit
|
||||||
|
) : BaseDialogModel<DialogIntExpMoveClearBinding>(DIALOG_TYPE_CENTER) {
|
||||||
|
|
||||||
|
// 清仓正常(存储的是 code:"0" 或 "1")
|
||||||
|
val clearNormal = MutableLiveData("")
|
||||||
|
|
||||||
|
// 清仓正常选项列表
|
||||||
|
val clearNormalList = MutableLiveData<List<KeyValue>>().apply {
|
||||||
|
value = listOf(
|
||||||
|
KeyValue("是", "1"),
|
||||||
|
KeyValue("否", "0")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun layoutId(): Int {
|
||||||
|
return R.layout.dialog_int_exp_move_clear
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDialogCreated(context: Context) {
|
||||||
|
binding.model = this
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存按钮点击
|
||||||
|
*/
|
||||||
|
fun onSaveClick() {
|
||||||
|
if (clearNormal.value.verifyNullOrEmpty("请选择清仓正常")) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
dismiss()
|
||||||
|
callback(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ 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.ActivityIntExpMoveBinding
|
import com.lukouguoji.gjc.databinding.ActivityIntExpMoveBinding
|
||||||
|
import com.lukouguoji.gjc.dialog.IntExpMoveClearDialogModel
|
||||||
import com.lukouguoji.gjc.viewModel.IntExpMoveViewModel
|
import com.lukouguoji.gjc.viewModel.IntExpMoveViewModel
|
||||||
import com.lukouguoji.module_base.base.BaseBindingActivity
|
import com.lukouguoji.module_base.base.BaseBindingActivity
|
||||||
import com.lukouguoji.module_base.common.Constant
|
import com.lukouguoji.module_base.common.Constant
|
||||||
@@ -55,6 +56,11 @@ class IntExpMoveActivity : BaseBindingActivity<ActivityIntExpMoveBinding, IntExp
|
|||||||
* 初始化监听器
|
* 初始化监听器
|
||||||
*/
|
*/
|
||||||
private fun initListeners() {
|
private fun initListeners() {
|
||||||
|
// 清仓按钮
|
||||||
|
binding.btnClear.setOnClickListener {
|
||||||
|
showClearDialog()
|
||||||
|
}
|
||||||
|
|
||||||
// 移库按钮
|
// 移库按钮
|
||||||
binding.btnMove.setOnClickListener {
|
binding.btnMove.setOnClickListener {
|
||||||
showMoveConfirmDialog()
|
showMoveConfirmDialog()
|
||||||
@@ -112,6 +118,25 @@ class IntExpMoveActivity : BaseBindingActivity<ActivityIntExpMoveBinding, IntExp
|
|||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示清仓操作对话框
|
||||||
|
*/
|
||||||
|
private fun showClearDialog() {
|
||||||
|
val selectedItems = viewModel.getSelectedItems()
|
||||||
|
|
||||||
|
if (selectedItems.isEmpty()) {
|
||||||
|
showToast("请至少选择一条运单")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 显示清仓对话框
|
||||||
|
IntExpMoveClearDialogModel { dialog ->
|
||||||
|
// 用户点击保存后,执行清仓操作
|
||||||
|
val clearNormal = dialog.clearNormal.value ?: ""
|
||||||
|
viewModel.performClear(clearNormal)
|
||||||
|
}.show(this)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 扫码回调
|
* 扫码回调
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,20 +1,25 @@
|
|||||||
package com.lukouguoji.gjc.viewModel
|
package com.lukouguoji.gjc.viewModel
|
||||||
|
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.lukouguoji.gjc.R
|
import com.lukouguoji.gjc.R
|
||||||
import com.lukouguoji.gjc.holder.IntExpStorageUseViewHolder
|
import com.lukouguoji.gjc.holder.IntExpStorageUseViewHolder
|
||||||
import com.lukouguoji.module_base.base.BasePageViewModel
|
import com.lukouguoji.module_base.base.BasePageViewModel
|
||||||
import com.lukouguoji.module_base.bean.GjcMaWb
|
import com.lukouguoji.module_base.bean.GjcMaWb
|
||||||
import com.lukouguoji.module_base.common.Constant
|
import com.lukouguoji.module_base.common.Constant
|
||||||
|
import com.lukouguoji.module_base.common.ConstantEvent
|
||||||
import com.lukouguoji.module_base.http.net.NetApply
|
import com.lukouguoji.module_base.http.net.NetApply
|
||||||
|
import com.lukouguoji.module_base.impl.FlowBus
|
||||||
import com.lukouguoji.module_base.ktx.commonAdapter
|
import com.lukouguoji.module_base.ktx.commonAdapter
|
||||||
import com.lukouguoji.module_base.ktx.formatDate
|
import com.lukouguoji.module_base.ktx.formatDate
|
||||||
import com.lukouguoji.module_base.ktx.launchCollect
|
import com.lukouguoji.module_base.ktx.launchCollect
|
||||||
import com.lukouguoji.module_base.ktx.launchLoadingCollect
|
import com.lukouguoji.module_base.ktx.launchLoadingCollect
|
||||||
|
import com.lukouguoji.module_base.ktx.noNull
|
||||||
import com.lukouguoji.module_base.ktx.showToast
|
import com.lukouguoji.module_base.ktx.showToast
|
||||||
import com.lukouguoji.module_base.ktx.toRequestBody
|
import com.lukouguoji.module_base.ktx.toRequestBody
|
||||||
import com.lukouguoji.module_base.model.ScanModel
|
import com.lukouguoji.module_base.model.ScanModel
|
||||||
import dev.utils.app.info.KeyValue
|
import dev.utils.app.info.KeyValue
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -117,19 +122,43 @@ class IntExpStorageUseViewModel : BasePageViewModel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清仓操作
|
* 清仓操作(在Activity中调用,会显示对话框)
|
||||||
*/
|
*/
|
||||||
fun clearStorage() {
|
fun clearStorage() {
|
||||||
|
// 由Activity显示对话框
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行清仓操作
|
||||||
|
* @param clearNormal 清仓正常("0"或"1")
|
||||||
|
*/
|
||||||
|
fun performClear(clearNormal: String) {
|
||||||
val list = pageModel.rv?.commonAdapter()?.items as? List<GjcMaWb> ?: return
|
val list = pageModel.rv?.commonAdapter()?.items as? List<GjcMaWb> ?: return
|
||||||
val selectedItems = list.filter { it.isSelected }
|
val selectedItems = list.filter { it.isSelected }
|
||||||
|
|
||||||
if (selectedItems.isEmpty()) {
|
if (selectedItems.isEmpty()) {
|
||||||
showToast("请选择要清仓的运单")
|
showToast("请至少选择一条运单")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: 实现清仓接口调用
|
// 构建请求参数
|
||||||
showToast("清仓功能待实现")
|
val params = mapOf(
|
||||||
|
"clearNormal" to clearNormal,
|
||||||
|
"maWbList" to selectedItems
|
||||||
|
).toRequestBody()
|
||||||
|
|
||||||
|
launchLoadingCollect({ NetApply.api.clearIntExpStorage(params) }) {
|
||||||
|
onSuccess = {
|
||||||
|
showToast("清仓成功")
|
||||||
|
viewModelScope.launch {
|
||||||
|
FlowBus.with<String>(ConstantEvent.EVENT_REFRESH).emit("refresh")
|
||||||
|
}
|
||||||
|
refresh() // 刷新列表
|
||||||
|
}
|
||||||
|
onFailed = { _, msg ->
|
||||||
|
showToast(msg.noNull("清仓失败"))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -194,6 +194,13 @@
|
|||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- 清仓按钮 -->
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/btnClear"
|
||||||
|
style="@style/tv_bottom_btn"
|
||||||
|
android:text="清仓"
|
||||||
|
android:visibility="visible" />
|
||||||
|
|
||||||
<!-- 移库按钮 -->
|
<!-- 移库按钮 -->
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/btnMove"
|
android:id="@+id/btnMove"
|
||||||
|
|||||||
@@ -12,6 +12,10 @@
|
|||||||
<variable
|
<variable
|
||||||
name="viewModel"
|
name="viewModel"
|
||||||
type="com.lukouguoji.gjc.viewModel.IntExpStorageUseViewModel" />
|
type="com.lukouguoji.gjc.viewModel.IntExpStorageUseViewModel" />
|
||||||
|
|
||||||
|
<variable
|
||||||
|
name="activity"
|
||||||
|
type="com.lukouguoji.gjc.activity.IntExpStorageUseActivity" />
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -218,7 +222,7 @@
|
|||||||
<!-- 清仓按钮 -->
|
<!-- 清仓按钮 -->
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/tv_bottom_btn"
|
style="@style/tv_bottom_btn"
|
||||||
android:onClick="@{()-> viewModel.clearStorage()}"
|
android:onClick="@{()-> activity.showClearDialog()}"
|
||||||
android:text="清 仓" />
|
android:text="清 仓" />
|
||||||
|
|
||||||
<!-- 修改库位按钮 -->
|
<!-- 修改库位按钮 -->
|
||||||
|
|||||||
86
module_gjc/src/main/res/layout/dialog_int_exp_move_clear.xml
Normal file
86
module_gjc/src/main/res/layout/dialog_int_exp_move_clear.xml
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<data>
|
||||||
|
<import type="com.lukouguoji.module_base.ui.weight.search.layout.SearchLayoutType"/>
|
||||||
|
|
||||||
|
<variable
|
||||||
|
name="model"
|
||||||
|
type="com.lukouguoji.gjc.dialog.IntExpMoveClearDialogModel" />
|
||||||
|
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="600dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/bg_dialog_f2_radius_10"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<!-- 标题栏 -->
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:background="@drawable/bg_primary_radius_top_10"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="清仓操作"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<!-- 表单内容 -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="30dp"
|
||||||
|
android:layout_marginTop="30dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<!-- 清仓正常 -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
completeSpace="@{5}"
|
||||||
|
android:text="清仓正常:"
|
||||||
|
android:textColor="@color/text_normal"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
type="@{SearchLayoutType.SPINNER}"
|
||||||
|
list="@{model.clearNormalList}"
|
||||||
|
value="@={model.clearNormal}" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- 底部按钮 -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="40dp"
|
||||||
|
android:layout_marginBottom="20dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/tv_bottom_btn"
|
||||||
|
android:onClick="@{()->model.dismiss()}"
|
||||||
|
android:text="取消" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/tv_bottom_btn"
|
||||||
|
android:onClick="@{()->model.onSaveClick()}"
|
||||||
|
android:text="保存" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</layout>
|
||||||
Reference in New Issue
Block a user