feat: 国际出港 板箱过磅 fix v2
This commit is contained in:
@@ -39,6 +39,9 @@ class GjcBoxWeighingAddViewModel : BaseViewModel() {
|
||||
// 数据Bean
|
||||
val dataBean = MutableLiveData(GjcUldUseBean())
|
||||
|
||||
// 保存 queryUsingUldByUld 返回的数据(用于复磅场景)
|
||||
private var usingUldData: GjcUldUseBean? = null
|
||||
|
||||
// 地磅集成 - 暂时注释
|
||||
// val diBangModel = DiBangWeightModel()
|
||||
val channel = MutableLiveData("") // 通道号(用于控制地磅key)
|
||||
@@ -295,6 +298,9 @@ class GjcBoxWeighingAddViewModel : BaseViewModel() {
|
||||
lastQueriedFlight = ""
|
||||
lastQueriedCarId = ""
|
||||
lastQueriedUld = ""
|
||||
|
||||
// 重置 ULD 使用记录
|
||||
usingUldData = null
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -313,8 +319,14 @@ class GjcBoxWeighingAddViewModel : BaseViewModel() {
|
||||
if (bean.carId.verifyNullOrEmpty("请输入架子车号")) return
|
||||
if (bean.uld.verifyNullOrEmpty("请输入ULD编号")) return
|
||||
|
||||
// 提交数据
|
||||
val params = mapOf(
|
||||
// 验证是否已组装(复磅场景必须有 useId)
|
||||
if (usingUldData == null || usingUldData?.useId == 0L) {
|
||||
showToast("未组装,不可复磅")
|
||||
return
|
||||
}
|
||||
|
||||
// 构建基础提交参数
|
||||
val baseParams = mutableMapOf(
|
||||
"carId" to bean.carId,
|
||||
"passageway" to bean.passageway,
|
||||
"uld" to bean.uld,
|
||||
@@ -333,7 +345,38 @@ class GjcBoxWeighingAddViewModel : BaseViewModel() {
|
||||
"netWeight" to bean.netWeight,
|
||||
"cargoWeight" to bean.cargoWeight,
|
||||
"printTag" to printTag.value
|
||||
).toRequestBody(removeEmptyOrNull = true)
|
||||
)
|
||||
|
||||
// 如果有 usingUldData(复磅场景),将其所有字段添加到提交参数
|
||||
usingUldData?.let { usingData ->
|
||||
baseParams["useId"] = usingData.useId
|
||||
baseParams["cargoType"] = usingData.cargoType
|
||||
baseParams["consumeWeight"] = usingData.consumeWeight
|
||||
baseParams["volume"] = usingData.volume
|
||||
baseParams["maxVolume"] = usingData.maxVolume
|
||||
baseParams["maxWeight"] = usingData.maxWeight
|
||||
baseParams["fdep"] = usingData.fdep
|
||||
baseParams["fClose"] = usingData.fClose
|
||||
baseParams["wtId"] = usingData.wtId
|
||||
baseParams["wtUsername"] = usingData.wtUsername
|
||||
baseParams["wtDate"] = usingData.wtDate
|
||||
baseParams["ldId"] = usingData.ldId
|
||||
baseParams["ldUserName"] = usingData.ldUserName
|
||||
baseParams["ldDate"] = usingData.ldDate
|
||||
baseParams["hoId"] = usingData.hoId
|
||||
baseParams["hoUserName"] = usingData.hoUserName
|
||||
baseParams["hoDate"] = usingData.hoDate
|
||||
baseParams["uldCarrier"] = usingData.uldCarrier
|
||||
baseParams["uldFlag"] = usingData.uldFlag
|
||||
baseParams["status"] = usingData.status
|
||||
baseParams["passagewayName"] = usingData.passagewayName
|
||||
baseParams["location"] = usingData.location
|
||||
baseParams["checkFlag"] = usingData.checkFlag
|
||||
baseParams["emptyUld"] = usingData.emptyUld
|
||||
}
|
||||
|
||||
// 转换为 RequestBody
|
||||
val params = baseParams.toRequestBody(removeEmptyOrNull = true)
|
||||
|
||||
launchLoadingCollect({
|
||||
NetApply.api.submitGjcBoxWeighing(params)
|
||||
@@ -416,6 +459,26 @@ class GjcBoxWeighingAddViewModel : BaseViewModel() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 查询正在使用的 ULD 记录(复磅场景)
|
||||
launchCollect({ NetApply.api.queryUsingUldByUld(uldNo) }) {
|
||||
onSuccess = { result ->
|
||||
val usingData = result.data
|
||||
if (usingData != null && usingData.useId > 0) {
|
||||
// 保存返回的数据,用于提交时传递
|
||||
usingUldData = usingData
|
||||
} else {
|
||||
// 没有 useId,说明未组装,不可复磅
|
||||
usingUldData = null
|
||||
showToast("未组装,不可复磅")
|
||||
}
|
||||
}
|
||||
onFailed = { _, _ ->
|
||||
// 接口报错时也认为未组装
|
||||
usingUldData = null
|
||||
showToast("未组装,不可复磅")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -67,7 +67,8 @@
|
||||
icon="@{@drawable/img_scan}"
|
||||
setOnIconClickListener="@{()-> viewModel.carIdScanClick()}"
|
||||
type="@{SearchLayoutType.INPUT}"
|
||||
value="@={viewModel.carId}" />
|
||||
value="@={viewModel.carId}"
|
||||
setUpperCaseAlphanumeric="@{true}" />
|
||||
|
||||
<!-- ULD编号 -->
|
||||
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
|
||||
@@ -78,7 +79,8 @@
|
||||
icon="@{@drawable/img_scan}"
|
||||
setOnIconClickListener="@{()-> viewModel.uldScanClick()}"
|
||||
type="@{SearchLayoutType.INPUT}"
|
||||
value="@={viewModel.uld}" />
|
||||
value="@={viewModel.uld}"
|
||||
setUpperCaseAlphanumeric="@{true}" />
|
||||
|
||||
<!-- 搜索和添加按钮 -->
|
||||
<LinearLayout
|
||||
|
||||
Reference in New Issue
Block a user