feat: 国际出港 装货交接 待配运

This commit is contained in:
2026-01-17 17:33:04 +08:00
parent 675b9d234e
commit b37f330414
6 changed files with 231 additions and 2 deletions

View File

@@ -676,6 +676,14 @@ interface Api {
@POST("IntExpOutHandover/handover") @POST("IntExpOutHandover/handover")
suspend fun completeHandover(@Body data: RequestBody): BaseResultBean<Boolean> suspend fun completeHandover(@Body data: RequestBody): BaseResultBean<Boolean>
/**
* 国际出港出库交接-待配运
* 接口路径: /IntExpOutHandover/waitingTrans
* @param data 请求参数GjcStorageParam (包含库位信息和ULD列表)
*/
@POST("IntExpOutHandover/waitingTrans")
suspend fun waitingTrans(@Body data: RequestBody): BaseResultBean<String>
/** /**
* 国际出港-出港装载 分页查询 * 国际出港-出港装载 分页查询
* 接口路径: /IntExpLoad/pageQuery * 接口路径: /IntExpLoad/pageQuery

View File

@@ -0,0 +1,74 @@
package com.lukouguoji.gjc.dialog
import android.content.Context
import androidx.lifecycle.MutableLiveData
import com.lukouguoji.gjc.R
import com.lukouguoji.gjc.databinding.DialogIntExpOutWaitingTransBinding
import com.lukouguoji.module_base.base.BaseDialogModel
import com.lukouguoji.module_base.http.net.NetApply
import com.lukouguoji.module_base.ktx.launchCollect
import com.lukouguoji.module_base.ktx.showToast
import com.lukouguoji.module_base.ktx.verifyNullOrEmpty
import dev.utils.app.info.KeyValue
/**
* 国际出港出库交接 - 待配运操作对话框
*/
class IntExpOutWaitingTransDialogModel(
private val callback: (IntExpOutWaitingTransDialogModel) -> Unit
) : BaseDialogModel<DialogIntExpOutWaitingTransBinding>(DIALOG_TYPE_CENTER) {
// 库位列表
val locationList = MutableLiveData<List<KeyValue>>()
// 选中的库位存储的是code
val selectedLocationCode = MutableLiveData("")
// 库位ID (后端需要的code)
var locationId: String = ""
// 库位名称 (后端需要的name)
var locationName: String = ""
override fun layoutId(): Int {
return R.layout.dialog_int_exp_out_waiting_trans
}
override fun onDialogCreated(context: Context) {
binding.model = this
loadLocationList()
// 监听选择变化更新locationId和locationName
selectedLocationCode.observeForever { code ->
val selectedItem = locationList.value?.find { it.value == code }
locationId = selectedItem?.value ?: ""
locationName = selectedItem?.key ?: ""
}
}
/**
* 加载库位列表
*/
private fun loadLocationList() {
launchCollect({ NetApply.api.getLocationList(flag = 2) }) {
onSuccess = { result ->
val list = result.data?.map { it.toKeyValue() } ?: emptyList()
locationList.value = list
}
onFailed = { _, msg ->
showToast(msg ?: "加载库位列表失败")
}
}
}
/**
* 保存按钮点击
*/
fun onSaveClick() {
if (selectedLocationCode.value.verifyNullOrEmpty("请选择库位")) {
return
}
dismiss()
callback(this)
}
}

View File

@@ -223,7 +223,7 @@ class IntExpArriveViewModel : BasePageViewModel() {
val filterParams = mapOf( val filterParams = mapOf(
"fdate" to flightDate.value?.ifEmpty { null }, "fdate" to flightDate.value?.ifEmpty { null },
"fno" to flightNo.value?.ifEmpty { null }, "fno" to flightNo.value?.ifEmpty { null },
"likeNo" to waybillNo.value?.ifEmpty { null }, "wbNo" to waybillNo.value?.ifEmpty { null },
"hno" to hno.value?.ifEmpty { null } "hno" to hno.value?.ifEmpty { null }
) )

View File

@@ -4,6 +4,7 @@ import android.app.Activity
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.lukouguoji.gjc.R import com.lukouguoji.gjc.R
import com.lukouguoji.gjc.dialog.IntExpOutWaitingTransDialogModel
import com.lukouguoji.gjc.holder.IntExpOutHandoverViewHolder import com.lukouguoji.gjc.holder.IntExpOutHandoverViewHolder
import com.lukouguoji.module_base.base.BasePageViewModel import com.lukouguoji.module_base.base.BasePageViewModel
import com.lukouguoji.module_base.bean.GjcUldUseBean import com.lukouguoji.module_base.bean.GjcUldUseBean
@@ -105,6 +106,59 @@ class IntExpOutHandoverViewModel : BasePageViewModel() {
} }
} }
/**
* 待配运按钮点击
*/
fun waitingTransClick() {
val list = pageModel.rv?.commonAdapter()?.items as? List<GjcUldUseBean> ?: return
val selectedItems = list.filter { it.isSelected }
if (selectedItems.isEmpty()) {
showToast("请选择要待配运的ULD")
return
}
// 显示待配运弹框
showWaitingTransDialog(selectedItems)
}
/**
* 显示待配运弹框
*/
private fun showWaitingTransDialog(selectedItems: List<GjcUldUseBean>) {
val dialog = IntExpOutWaitingTransDialogModel { model ->
// 弹框确定回调
performWaitingTrans(selectedItems, model.locationId, model.locationName)
}
dialog.show()
}
/**
* 执行待配运操作
*/
private fun performWaitingTrans(
selectedItems: List<GjcUldUseBean>,
locationId: String,
locationName: String
) {
// 构建请求参数
val params = mapOf(
"location" to locationName,
"locationId" to locationId.toLongOrNull(),
"uldUseList" to selectedItems
).toRequestBody()
launchLoadingCollect({ NetApply.api.waitingTrans(params) }) {
onSuccess = {
showToast("待配运操作成功")
viewModelScope.launch {
FlowBus.with<String>(ConstantEvent.EVENT_REFRESH).emit("refresh")
}
refresh()
}
}
}
/** /**
* 获取数据 (重写BasePageViewModel) * 获取数据 (重写BasePageViewModel)
*/ */

View File

@@ -172,6 +172,12 @@
</LinearLayout> </LinearLayout>
<!-- 待配运按钮 -->
<TextView
style="@style/tv_bottom_btn"
android:onClick="@{()-> viewModel.waitingTransClick()}"
android:text="待配运" />
<!-- 交接完成按钮 --> <!-- 交接完成按钮 -->
<TextView <TextView
style="@style/tv_bottom_btn" style="@style/tv_bottom_btn"

View File

@@ -0,0 +1,87 @@
<?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.IntExpOutWaitingTransDialogModel" />
</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}"
hint='@{"请选择库位"}'
list="@{model.locationList}"
value="@={model.selectedLocationCode}" />
</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>