fix(gjc): 计重记录运单详情补齐航班日期、航班号、航程与业务类型

IntExpCheckIn/checked/pageQuery 出参中 fdate/fno/range/businessType/remark 恒为空,
详情页只展示列表传入的数据,因此全部显示 "-"。进入后按 11 位运单号调用
IntExpCheckIn/queryWbByNo 补齐空值,业务类型代码按国际出港字典(IO)转中文名。

Refs: 禅道 Bug #622

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
YANG JIANKUAN
2026-10-14 20:21:04 -07:00
parent 2c8fa689a5
commit fa6c3f473e

View File

@@ -5,14 +5,18 @@ import androidx.lifecycle.MutableLiveData
import com.lukouguoji.module_base.base.BaseViewModel
import com.lukouguoji.module_base.bean.GjcWeighingRecordBean
import com.lukouguoji.module_base.common.Constant
import com.lukouguoji.module_base.http.net.NetApply
import com.lukouguoji.module_base.ktx.formatDate
import com.lukouguoji.module_base.ktx.launchCollect
import com.lukouguoji.module_base.ktx.showToast
import com.lukouguoji.module_base.util.DictUtils
/**
* 国际出港计重-运单详情 ViewModel(5.5寸手机版专属页面)
*
* 只读展示计重记录列表传入的运单信息,无接口请求。
* 注:设计稿中的「通道号」字段在 /IntExpCheckIn/checked/pageQuery 出参中不存在(后端缺口,
* 见接口问题清单),布局侧空值兜底显示 "-"。
* 先展示计重记录列表传入的运单信息;/IntExpCheckIn/checked/pageQuery 出参中
* 航班日期/航班号/航程/业务类型/备注恒为空(Bug #622),再按 11 位运单号调
* /IntExpCheckIn/queryWbByNo 补齐这些字段(只补空值,不覆盖列表已有数据)。
*/
class GjcWeighingWbDetailViewModel : BaseViewModel() {
@@ -23,8 +27,37 @@ class GjcWeighingWbDetailViewModel : BaseViewModel() {
val data = intent.getSerializableExtra(Constant.Key.BEAN) as? GjcWeighingRecordBean
if (data != null) {
bean.value = data
loadWaybillInfo(data)
} else {
showToast("参数错误")
}
}
private fun loadWaybillInfo(data: GjcWeighingRecordBean) {
if (data.wbNo.isEmpty()) return
launchCollect({ NetApply.api.getIntExpCheckInWbByNo(data.wbNo) }) {
onSuccess = { result ->
result.data?.let { wb ->
if (data.fdate.isEmpty()) data.fdate = wb.fdate.formatDate()
if (data.fno.isEmpty()) data.fno = wb.fno.orEmpty()
if (data.range.isEmpty()) data.range = wb.range.orEmpty()
if (data.businessType.isEmpty()) data.businessType = wb.businessType.orEmpty()
if (data.businessName.isEmpty()) data.businessName = wb.businessName.orEmpty()
if (data.remark.isEmpty()) data.remark = wb.remark.orEmpty()
bean.value = data
fillBusinessName(data)
}
}
}
}
/** queryWbByNo 只返回业务类型代码(如 ANR),按国际出港业务类型字典转成中文名(与开始计重页同源) */
private fun fillBusinessName(data: GjcWeighingRecordBean) {
if (data.businessName.isNotEmpty() || data.businessType.isEmpty()) return
DictUtils.getBusinessTypeList(type = "IO", addAll = false) { list ->
val name = list.firstOrNull { it.value == data.businessType }?.key ?: return@getBusinessTypeList
data.businessName = name
bean.postValue(data)
}
}
}