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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 卸货按钮点击
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user