feat: 国际出港出库交接新增装机状态显示与允许装机操作

列表项新增「装机状态」列,依据分页接口 allowLoad 字段展示,
允许装机绿色、不允许红色,并重新分配列权重避免长字段换行。
底部新增「允许装机」按钮,支持多选后批量调用允许装机接口。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-09-08 20:17:31 +08:00
parent b368efa827
commit 6b2006fdb7
5 changed files with 97 additions and 10 deletions

View File

@@ -65,6 +65,19 @@ class GjcUldUseBean : Serializable {
var loadArea: String = "" // 组装区
var pc: Long = 0 // 组装件数
var allowLoad: String = "" // 允许装机0不允许1允许
// 是否允许装机
val isAllowLoad: Boolean
get() = allowLoad == "1"
// 装机状态文本
val allowLoadText: String
get() = when (allowLoad) {
"1" -> "允许装机"
"0" -> "不允许装机"
else -> ""
}
var fillWeightFlag: String = "" // 回填状态0-未回填1-部分回填2-已回填
// 回填状态文本

View File

@@ -738,6 +738,14 @@ interface Api {
@POST("IntExpOutHandover/waitingTrans")
suspend fun waitingTrans(@Body data: RequestBody): BaseResultBean<String>
/**
* 国际出港出库交接-允许装机
* 接口路径: /IntExpOutHandover/allow
* @param data 请求参数选中的ULD列表GjcUldUseBean 数组)
*/
@POST("IntExpOutHandover/allow")
suspend fun allowLoading(@Body data: RequestBody): BaseResultBean<Boolean>
/**
* 国际出港-出港装载 分页查询
* 接口路径: /IntExpLoad/pageQuery

View File

@@ -106,6 +106,36 @@ class IntExpOutHandoverViewModel : BasePageViewModel() {
}
}
/**
* 允许装机(多选,批量操作)
*/
fun allowLoadClick() {
val list = pageModel.rv?.commonAdapter()?.items as? List<GjcUldUseBean> ?: return
val selectedItems = list.filter { it.isSelected }
if (selectedItems.isEmpty()) {
showToast("请选择要允许装机的ULD")
return
}
if (selectedItems.all { it.isAllowLoad }) {
showToast("所选ULD均已允许装机")
return
}
val requestData = selectedItems.toRequestBody()
launchLoadingCollect({ NetApply.api.allowLoading(requestData) }) {
onSuccess = {
showToast("允许装机成功")
viewModelScope.launch {
FlowBus.with<String>(ConstantEvent.EVENT_REFRESH).emit("refresh")
}
refresh()
}
}
}
/**
* 待配运按钮点击
*/

View File

@@ -173,6 +173,12 @@
</LinearLayout>
<!-- 允许装机按钮(多选) -->
<TextView
style="@style/tv_bottom_btn"
android:onClick="@{()-> viewModel.allowLoadClick()}"
android:text="允许装机" />
<!-- 待配运按钮 -->
<TextView
style="@style/tv_bottom_btn"

View File

@@ -54,7 +54,7 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.1"
android:layout_weight="1.0"
android:gravity="center_vertical"
android:orientation="horizontal">
@@ -77,7 +77,7 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_weight="0.8"
android:gravity="center_vertical"
android:orientation="horizontal">
@@ -100,7 +100,7 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:layout_weight="0.7"
android:gravity="center_vertical"
android:orientation="horizontal">
@@ -123,7 +123,7 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:layout_weight="0.75"
android:gravity="center_vertical"
android:orientation="horizontal">
@@ -146,7 +146,7 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.2"
android:layout_weight="1.3"
android:gravity="center_vertical"
android:orientation="horizontal">
@@ -165,6 +165,30 @@
</LinearLayout>
<!-- 装机状态(允许装机绿色,不允许装机红色) -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{5}"
android:text="装机状态:"
android:textSize="15sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{bean.allowLoadText}"
android:textColor="@{bean.isAllowLoad() ? @color/text_green : @color/text_red}"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
<!-- 第二行目的港、库位号、IMP代码、交接人、交接时间 -->
@@ -179,7 +203,7 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.1"
android:layout_weight="1.0"
android:gravity="center_vertical"
android:orientation="horizontal">
@@ -202,7 +226,7 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_weight="0.8"
android:gravity="center_vertical"
android:orientation="horizontal">
@@ -225,7 +249,7 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:layout_weight="0.7"
android:gravity="center_vertical"
android:orientation="horizontal">
@@ -249,7 +273,7 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:layout_weight="0.75"
android:gravity="center_vertical"
android:orientation="horizontal">
@@ -272,7 +296,7 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.2"
android:layout_weight="1.3"
android:gravity="center_vertical"
android:orientation="horizontal">
@@ -291,6 +315,12 @@
</LinearLayout>
<!-- 占位(与第一行装机状态列等宽,保持列对齐) -->
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1.0" />
</LinearLayout>
</LinearLayout>