feat: 开始组装 opt
This commit is contained in:
@@ -14,6 +14,7 @@ import com.lukouguoji.module_base.base.CommonAdapter
|
||||
import com.lukouguoji.module_base.common.Constant
|
||||
import com.lukouguoji.module_base.interfaces.IOnItemClickListener
|
||||
import com.lukouguoji.module_base.ktx.addOnItemClickListener
|
||||
import com.lukouguoji.module_base.ktx.setUpperCaseAlphanumericFilter
|
||||
import com.lukouguoji.module_base.router.ARouterConstants
|
||||
|
||||
/**
|
||||
@@ -44,6 +45,9 @@ class IntExpAssembleStartActivity :
|
||||
setBackArrow("开始组装")
|
||||
binding.viewModel = viewModel
|
||||
|
||||
// 为ULD编号添加大写字母和数字的输入限制
|
||||
binding.uldNoInput.et.setUpperCaseAlphanumericFilter()
|
||||
|
||||
// 初始化列表
|
||||
initRecyclerViews()
|
||||
|
||||
|
||||
@@ -51,6 +51,9 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
|
||||
// ========== 组装人列表 ==========
|
||||
val assemblerList = MutableLiveData<List<KeyValue>>(emptyList())
|
||||
|
||||
// ========== 标记位,避免重复查询 ==========
|
||||
private var lastQueriedUldNo = ""
|
||||
|
||||
/**
|
||||
* 初始化模拟数据(已废弃)
|
||||
*/
|
||||
@@ -192,7 +195,7 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
|
||||
val warehouseList = result.data ?: mutableListOf()
|
||||
val waybillBeanList = warehouseList.map { warehouse ->
|
||||
AssembleWaybillBean().apply {
|
||||
waybillNo = warehouse.no
|
||||
waybillNo = warehouse.wbNo
|
||||
pieces = warehouse.pc.toString()
|
||||
weight = String.format("%.1f", warehouse.weight)
|
||||
flight = warehouse.flight
|
||||
@@ -244,6 +247,46 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ULD编号输入完成时调用
|
||||
*/
|
||||
fun onUldNoInputComplete() {
|
||||
val uld = uldInfo.value?.uldNo?.trim() ?: ""
|
||||
if (uld.isNotEmpty() && uld != lastQueriedUldNo) {
|
||||
lastQueriedUldNo = uld
|
||||
queryUldInfo(uld)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询ULD信息(状态和耗材重量)
|
||||
*/
|
||||
private fun queryUldInfo(uldNo: String) {
|
||||
launchCollect({ NetApply.api.getUldWithConsumeWeight(uldNo) }) {
|
||||
onSuccess = { result ->
|
||||
val uldBean = result.data
|
||||
if (uldBean != null) {
|
||||
// 更新ULD状态和耗材重量
|
||||
uldInfo.value = uldInfo.value?.apply {
|
||||
// status: 0-正常, 1-故障
|
||||
uldStatus = when (uldBean.status) {
|
||||
"0" -> "正常"
|
||||
"1" -> "故障"
|
||||
else -> uldBean.status ?: ""
|
||||
}
|
||||
// 耗材重量保持可编辑,仅在为空时填充
|
||||
if (materialWeight.isEmpty()) {
|
||||
materialWeight = uldBean.consumeWeight?.toString() ?: ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
onFailed = { code, message ->
|
||||
showToast("查询ULD信息失败: $message")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 卸货按钮点击
|
||||
*/
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
android:orientation="vertical">
|
||||
<!-- 搜索框 -->
|
||||
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayoutNew
|
||||
hint='@{"请输入搜索内容"}'
|
||||
hint='@{"请输入ULD编码"}'
|
||||
type="@{SearchLayoutType.INPUT}"
|
||||
value="@={viewModel.searchText}"
|
||||
android:layout_width="match_parent"
|
||||
@@ -139,7 +139,7 @@
|
||||
<!-- 搜索框 -->
|
||||
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayoutNew
|
||||
android:id="@+id/tvWbSearch"
|
||||
hint='@{"请输入搜索内容"}'
|
||||
hint='@{"请输入原单号"}'
|
||||
icon="@{@drawable/img_search}"
|
||||
setOnSearchListener="@{viewModel::loadWaitingAssembleWaybills}"
|
||||
setSearchIconClickListener="@{viewModel::loadWaitingAssembleWaybills}"
|
||||
@@ -248,7 +248,9 @@
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||
android:id="@+id/uldNoInput"
|
||||
required="@{false}"
|
||||
setRefreshCallBack="@{viewModel::onUldNoInputComplete}"
|
||||
title='@{"ULD编号:"}'
|
||||
titleLength="@{5}"
|
||||
type="@{DataLayoutType.INPUT}"
|
||||
|
||||
@@ -18,11 +18,13 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="36dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/white"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
|
||||
Reference in New Issue
Block a user