feat: 国际出港开始组装新增 IMP代码、板型、BUP 输入项
- ULD 信息卡新增第二行:IMP代码(大写过滤)、板型(手输 + 下拉选择,箭头与 Spinner 同源)、BUP(否/是,默认否) - 装货/卸货提交时 dgrCode、boardType、bupFlag 同时写入顶层参数与 useInfo,输入 ULD 后从 getUld 回填 - 板型选项走通用字典接口,字典 code 暂定 BOARDTYPE,测试环境返回为空时提示手动输入 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.lukouguoji.gjc.R
|
||||
@@ -66,8 +67,17 @@ class IntExpAssembleStartActivity :
|
||||
setBackArrow("国际出港开始组装")
|
||||
binding.viewModel = viewModel
|
||||
|
||||
// 为ULD编号添加大写字母和数字的输入限制
|
||||
// 为ULD编号、IMP代码添加大写字母和数字的输入限制
|
||||
binding.uldNoInput.et.setUpperCaseAlphanumericFilter()
|
||||
binding.impCodeInput.et.setUpperCaseAlphanumericFilter()
|
||||
|
||||
// 板型:手动输入 + 下拉选择组合框。箭头复用 Spinner 同款背景绘制(同资源、同尺寸、同边距),
|
||||
// 图标位不放图片,仅作为覆盖在箭头上的透明点击区域(点击事件由布局 setOnIconClickListener 绑定)
|
||||
binding.boardTypeInput.apply {
|
||||
ll.setBackgroundResource(com.lukouguoji.module_base.R.drawable.bg_data_layout_new_dropdown)
|
||||
iv.setImageDrawable(null)
|
||||
iv.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
// 初始化列表
|
||||
initRecyclerViews()
|
||||
@@ -81,6 +91,9 @@ class IntExpAssembleStartActivity :
|
||||
// 加载组装人列表
|
||||
viewModel.loadAssemblerList()
|
||||
|
||||
// 加载板型选项列表
|
||||
viewModel.loadBoardTypeList()
|
||||
|
||||
// 监听登出事件,清空缓存
|
||||
FlowBus.with<Any>(ConstantEvent.LOGOUT).observe(this) {
|
||||
viewModel.clearCachedOperator()
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.lukouguoji.gjc.viewModel
|
||||
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.alibaba.fastjson.JSONArray
|
||||
import com.lukouguoji.gjc.R
|
||||
import com.lukouguoji.gjc.holder.AssembleInfoViewHolder
|
||||
import com.lukouguoji.gjc.holder.AssemblePositionViewHolder
|
||||
@@ -16,8 +17,11 @@ import com.lukouguoji.module_base.impl.FlowBus
|
||||
import com.lukouguoji.module_base.ktx.launchCollect
|
||||
import com.lukouguoji.module_base.ktx.launchLoadingCollect
|
||||
import com.lukouguoji.module_base.ktx.showToast
|
||||
import com.lukouguoji.module_base.ktx.toJson
|
||||
import com.lukouguoji.module_base.ktx.toRequestBody
|
||||
import com.lukouguoji.module_base.model.ScanModel
|
||||
import com.lukouguoji.module_base.util.Common
|
||||
import com.lukouguoji.module_base.util.DictUtils
|
||||
import dev.utils.app.info.KeyValue
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@@ -75,6 +79,12 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
|
||||
// ========== 组装人列表 ==========
|
||||
val assemblerList = MutableLiveData<List<KeyValue>>(emptyList())
|
||||
|
||||
// ========== BUP选项(0:否;1:是),默认否 ==========
|
||||
val bupFlagList = listOf(KeyValue("否", "0"), KeyValue("是", "1"))
|
||||
|
||||
// ========== 板型选项(字典;支持下拉选择,也支持手动输入)==========
|
||||
val boardTypeList = MutableLiveData<List<KeyValue>>(emptyList())
|
||||
|
||||
// ========== 标记位,避免重复查询 ==========
|
||||
private var lastQueriedUldNo = ""
|
||||
|
||||
@@ -404,6 +414,37 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 加载板型选项列表(字典)
|
||||
*/
|
||||
fun loadBoardTypeList() {
|
||||
DictUtils.getBoardTypeList { boardTypeList.value = it }
|
||||
}
|
||||
|
||||
/**
|
||||
* 板型下拉图标点击:弹出选项列表,选中后回填到板型输入框(回填后仍可手动修改)
|
||||
*/
|
||||
fun onBoardTypeSelectClick() {
|
||||
val list = boardTypeList.value ?: emptyList()
|
||||
if (list.isEmpty()) {
|
||||
showToast("暂无板型选项,请手动输入")
|
||||
return
|
||||
}
|
||||
val jsonArray = JSONArray.parseArray(
|
||||
list.map { mapOf("name" to it.key, "code" to it.value) }.toJson(false)
|
||||
)
|
||||
Common.singleSelect(
|
||||
getTopActivity(),
|
||||
"选择板型",
|
||||
jsonArray,
|
||||
uldInfo.value?.boardType
|
||||
) { position, _ ->
|
||||
uldInfo.value = uldInfo.value?.apply {
|
||||
boardType = list.getOrNull(position)?.value ?: ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ULD编号输入完成时调用
|
||||
*/
|
||||
@@ -438,6 +479,10 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
|
||||
}
|
||||
// 保存useId(用于装货/卸货接口)
|
||||
useId = uldBean.useId
|
||||
// 回填 IMP代码 / 板型 / BUP:服务端有值时覆盖(修改模式回显),为空时保留当前输入
|
||||
if (!uldBean.dgrCode.isNullOrEmpty()) dgrCode = uldBean.dgrCode
|
||||
if (!uldBean.boardType.isNullOrEmpty()) boardType = uldBean.boardType
|
||||
if (!uldBean.bupFlag.isNullOrEmpty()) bupFlag = uldBean.bupFlag
|
||||
}
|
||||
|
||||
// 【新增】从ULD信息提取航班信息
|
||||
@@ -606,9 +651,17 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
|
||||
|
||||
val loadAreaId = selectedPosition.value?.positionCode?.trim() ?: ""
|
||||
|
||||
// IMP代码 / 板型 / BUP(接口新增字段,useInfo 与顶层参数均需携带)
|
||||
val dgrCode = uldInfo.value?.dgrCode?.trim() ?: ""
|
||||
val boardType = uldInfo.value?.boardType?.trim() ?: ""
|
||||
val bupFlag = uldInfo.value?.bupFlag?.ifEmpty { "0" } ?: "0"
|
||||
|
||||
// 2. 构建useInfo(ULD信息)
|
||||
val useInfo = mapOf(
|
||||
"uld" to uldNo,
|
||||
"dgrCode" to dgrCode.ifEmpty { null },
|
||||
"boardType" to boardType.ifEmpty { null },
|
||||
"bupFlag" to bupFlag,
|
||||
"consumeWeight" to materialWeight.toDoubleOrNull(),
|
||||
"status" to when (uldInfo.value?.uldStatus) {
|
||||
"正常" -> "0"
|
||||
@@ -693,6 +746,9 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
|
||||
"ldId" to operatorValue,
|
||||
"loadArea" to loadArea,
|
||||
"loadAreaId" to loadAreaId.ifEmpty { null }, // 组装位置ID
|
||||
"dgrCode" to dgrCode.ifEmpty { null }, // IMP代码
|
||||
"boardType" to boardType.ifEmpty { null }, // 板型
|
||||
"bupFlag" to bupFlag, // BUP选项(0:否;1:是)
|
||||
"useInfo" to useInfo,
|
||||
"wbInfo" to wbInfo,
|
||||
"userId" to SharedPreferenceUtil.getString(Constant.Share.account)
|
||||
|
||||
@@ -293,6 +293,54 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 第二行:IMP代码、板型(下拉选择 + 手动输入)、BUP -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||
android:id="@+id/impCodeInput"
|
||||
enable="@{true}"
|
||||
hint='@{"请输入IMP代码"}'
|
||||
required="@{false}"
|
||||
title='@{"IMP代码:"}'
|
||||
titleLength="@{5}"
|
||||
type="@{DataLayoutType.INPUT}"
|
||||
value="@={viewModel.uldInfo.dgrCode}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||
android:id="@+id/boardTypeInput"
|
||||
enable="@{true}"
|
||||
hint='@{"请输入或选择"}'
|
||||
required="@{false}"
|
||||
setOnIconClickListener="@{(v) -> viewModel.onBoardTypeSelectClick()}"
|
||||
setTextAllCaps="@{true}"
|
||||
title='@{"板型:"}'
|
||||
titleLength="@{5}"
|
||||
type="@{DataLayoutType.INPUT}"
|
||||
value="@={viewModel.uldInfo.boardType}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||
enable="@{true}"
|
||||
list="@{viewModel.bupFlagList}"
|
||||
required="@{false}"
|
||||
title='@{"BUP:"}'
|
||||
titleLength="@{5}"
|
||||
type="@{DataLayoutType.SPINNER}"
|
||||
value="@={viewModel.uldInfo.bupFlag}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 运单信息卡片 -->
|
||||
|
||||
Reference in New Issue
Block a user