feat: 国际出港 板箱过磅 fix v2
This commit is contained in:
@@ -554,6 +554,13 @@ interface Api {
|
|||||||
@POST("IntExpWeighting/weight")
|
@POST("IntExpWeighting/weight")
|
||||||
suspend fun submitGjcBoxWeighing(@Body data: RequestBody): BaseResultBean<SimpleResultBean>
|
suspend fun submitGjcBoxWeighing(@Body data: RequestBody): BaseResultBean<SimpleResultBean>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 国际出港板箱过磅-根据ULD查询正在使用的记录
|
||||||
|
* 接口路径: /IntExpWeighting/queryUsingUldByUld
|
||||||
|
*/
|
||||||
|
@GET("IntExpWeighting/queryUsingUldByUld")
|
||||||
|
suspend fun queryUsingUldByUld(@Query("uld") uld: String): BaseResultBean<GjcUldUseBean>
|
||||||
|
|
||||||
// ==================== 国际出港-出港组装 ====================
|
// ==================== 国际出港-出港组装 ====================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ class GjcBoxWeighingAddViewModel : BaseViewModel() {
|
|||||||
// 数据Bean
|
// 数据Bean
|
||||||
val dataBean = MutableLiveData(GjcUldUseBean())
|
val dataBean = MutableLiveData(GjcUldUseBean())
|
||||||
|
|
||||||
|
// 保存 queryUsingUldByUld 返回的数据(用于复磅场景)
|
||||||
|
private var usingUldData: GjcUldUseBean? = null
|
||||||
|
|
||||||
// 地磅集成 - 暂时注释
|
// 地磅集成 - 暂时注释
|
||||||
// val diBangModel = DiBangWeightModel()
|
// val diBangModel = DiBangWeightModel()
|
||||||
val channel = MutableLiveData("") // 通道号(用于控制地磅key)
|
val channel = MutableLiveData("") // 通道号(用于控制地磅key)
|
||||||
@@ -295,6 +298,9 @@ class GjcBoxWeighingAddViewModel : BaseViewModel() {
|
|||||||
lastQueriedFlight = ""
|
lastQueriedFlight = ""
|
||||||
lastQueriedCarId = ""
|
lastQueriedCarId = ""
|
||||||
lastQueriedUld = ""
|
lastQueriedUld = ""
|
||||||
|
|
||||||
|
// 重置 ULD 使用记录
|
||||||
|
usingUldData = null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -313,8 +319,14 @@ class GjcBoxWeighingAddViewModel : BaseViewModel() {
|
|||||||
if (bean.carId.verifyNullOrEmpty("请输入架子车号")) return
|
if (bean.carId.verifyNullOrEmpty("请输入架子车号")) return
|
||||||
if (bean.uld.verifyNullOrEmpty("请输入ULD编号")) return
|
if (bean.uld.verifyNullOrEmpty("请输入ULD编号")) return
|
||||||
|
|
||||||
// 提交数据
|
// 验证是否已组装(复磅场景必须有 useId)
|
||||||
val params = mapOf(
|
if (usingUldData == null || usingUldData?.useId == 0L) {
|
||||||
|
showToast("未组装,不可复磅")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建基础提交参数
|
||||||
|
val baseParams = mutableMapOf(
|
||||||
"carId" to bean.carId,
|
"carId" to bean.carId,
|
||||||
"passageway" to bean.passageway,
|
"passageway" to bean.passageway,
|
||||||
"uld" to bean.uld,
|
"uld" to bean.uld,
|
||||||
@@ -333,7 +345,38 @@ class GjcBoxWeighingAddViewModel : BaseViewModel() {
|
|||||||
"netWeight" to bean.netWeight,
|
"netWeight" to bean.netWeight,
|
||||||
"cargoWeight" to bean.cargoWeight,
|
"cargoWeight" to bean.cargoWeight,
|
||||||
"printTag" to printTag.value
|
"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({
|
launchLoadingCollect({
|
||||||
NetApply.api.submitGjcBoxWeighing(params)
|
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}"
|
icon="@{@drawable/img_scan}"
|
||||||
setOnIconClickListener="@{()-> viewModel.carIdScanClick()}"
|
setOnIconClickListener="@{()-> viewModel.carIdScanClick()}"
|
||||||
type="@{SearchLayoutType.INPUT}"
|
type="@{SearchLayoutType.INPUT}"
|
||||||
value="@={viewModel.carId}" />
|
value="@={viewModel.carId}"
|
||||||
|
setUpperCaseAlphanumeric="@{true}" />
|
||||||
|
|
||||||
<!-- ULD编号 -->
|
<!-- ULD编号 -->
|
||||||
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
|
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
|
||||||
@@ -78,7 +79,8 @@
|
|||||||
icon="@{@drawable/img_scan}"
|
icon="@{@drawable/img_scan}"
|
||||||
setOnIconClickListener="@{()-> viewModel.uldScanClick()}"
|
setOnIconClickListener="@{()-> viewModel.uldScanClick()}"
|
||||||
type="@{SearchLayoutType.INPUT}"
|
type="@{SearchLayoutType.INPUT}"
|
||||||
value="@={viewModel.uld}" />
|
value="@={viewModel.uld}"
|
||||||
|
setUpperCaseAlphanumeric="@{true}" />
|
||||||
|
|
||||||
<!-- 搜索和添加按钮 -->
|
<!-- 搜索和添加按钮 -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|||||||
Reference in New Issue
Block a user