feat: 出港组装 开始组装 卸货、装货 api
This commit is contained in:
@@ -13,6 +13,7 @@ class AssembleWaybillBean {
|
|||||||
var isMarked: Boolean = false // 是否标记(红色显示)
|
var isMarked: Boolean = false // 是否标记(红色显示)
|
||||||
var fno: String = ""
|
var fno: String = ""
|
||||||
var fdate: String = ""
|
var fdate: String = ""
|
||||||
|
var whId: Long = 0 // 运单ID(用于接口调用)
|
||||||
|
|
||||||
val fLightInfo: String
|
val fLightInfo: String
|
||||||
get() = "$fno/${fdate.replace("-", "")}"
|
get() = "$fno/${fdate.replace("-", "")}"
|
||||||
|
|||||||
@@ -610,6 +610,24 @@ interface Api {
|
|||||||
@GET("IntExpAssemble/getUld")
|
@GET("IntExpAssemble/getUld")
|
||||||
suspend fun getUldWithConsumeWeight(@Query("uld") uld: String): BaseResultBean<GjcUldUseBean>
|
suspend fun getUldWithConsumeWeight(@Query("uld") uld: String): BaseResultBean<GjcUldUseBean>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 国际出港组装 - 卸货
|
||||||
|
* 接口路径: /IntExpAssemble/drop
|
||||||
|
* @param data 请求参数:abPc(组装件数)、abWeight(组装重量)、consumeWeight(耗材重量)、
|
||||||
|
* ldId(组装人)、loadArea(组装区)、useInfo(ULD信息)、wbInfo(运单信息)、userId(用户ID)
|
||||||
|
*/
|
||||||
|
@POST("IntExpAssemble/drop")
|
||||||
|
suspend fun assembleDropCargo(@Body data: RequestBody): BaseResultBean<GjcWarehouse>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 国际出港组装 - 装货
|
||||||
|
* 接口路径: /IntExpAssemble/assemble
|
||||||
|
* @param data 请求参数:abPc(组装件数)、abWeight(组装重量)、consumeWeight(耗材重量)、
|
||||||
|
* ldId(组装人)、loadArea(组装区)、useInfo(ULD信息)、wbInfo(运单信息)、userId(用户ID)
|
||||||
|
*/
|
||||||
|
@POST("IntExpAssemble/assemble")
|
||||||
|
suspend fun assembleLoadCargo(@Body data: RequestBody): BaseResultBean<GjcWarehouse>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 国际出港出库交接-分页查询
|
* 国际出港出库交接-分页查询
|
||||||
* 接口路径: /IntExpOutHandover/pageQuery
|
* 接口路径: /IntExpOutHandover/pageQuery
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.lukouguoji.module_base.http.net.NetApply
|
|||||||
import com.lukouguoji.module_base.ktx.launchCollect
|
import com.lukouguoji.module_base.ktx.launchCollect
|
||||||
import com.lukouguoji.module_base.ktx.launchLoadingCollect
|
import com.lukouguoji.module_base.ktx.launchLoadingCollect
|
||||||
import com.lukouguoji.module_base.ktx.showToast
|
import com.lukouguoji.module_base.ktx.showToast
|
||||||
|
import com.lukouguoji.module_base.ktx.toRequestBody
|
||||||
import com.lukouguoji.module_base.model.ScanModel
|
import com.lukouguoji.module_base.model.ScanModel
|
||||||
import dev.utils.app.info.KeyValue
|
import dev.utils.app.info.KeyValue
|
||||||
|
|
||||||
@@ -165,6 +166,7 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
|
|||||||
flight = warehouse.flight
|
flight = warehouse.flight
|
||||||
fno = warehouse.fno
|
fno = warehouse.fno
|
||||||
fdate = warehouse.fdate
|
fdate = warehouse.fdate
|
||||||
|
whId = warehouse.whId // 添加运单ID
|
||||||
isMarked = false
|
isMarked = false
|
||||||
}
|
}
|
||||||
}.toMutableList()
|
}.toMutableList()
|
||||||
@@ -201,6 +203,7 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
|
|||||||
flight = warehouse.flight
|
flight = warehouse.flight
|
||||||
fno = warehouse.fno
|
fno = warehouse.fno
|
||||||
fdate = warehouse.fdate
|
fdate = warehouse.fdate
|
||||||
|
whId = warehouse.whId // 添加运单ID
|
||||||
isMarked = false
|
isMarked = false
|
||||||
}
|
}
|
||||||
}.toMutableList()
|
}.toMutableList()
|
||||||
@@ -291,13 +294,122 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
|
|||||||
* 卸货按钮点击
|
* 卸货按钮点击
|
||||||
*/
|
*/
|
||||||
fun onUnloadClick() {
|
fun onUnloadClick() {
|
||||||
showToast("卸货操作(静态页面暂不实现)")
|
performAssembleOperation(isLoad = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 装货按钮点击
|
* 装货按钮点击
|
||||||
*/
|
*/
|
||||||
fun onLoadClick() {
|
fun onLoadClick() {
|
||||||
showToast("装货操作(静态页面暂不实现)")
|
performAssembleOperation(isLoad = true)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行组装操作(卸货或装货)
|
||||||
|
* @param isLoad true-装货,false-卸货
|
||||||
|
*/
|
||||||
|
private fun performAssembleOperation(isLoad: Boolean) {
|
||||||
|
// 1. 验证必填字段
|
||||||
|
val uldNo = uldInfo.value?.uldNo?.trim() ?: ""
|
||||||
|
if (uldNo.isEmpty()) {
|
||||||
|
showToast("请输入ULD编号")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val materialWeight = uldInfo.value?.materialWeight?.trim() ?: ""
|
||||||
|
if (materialWeight.isEmpty()) {
|
||||||
|
showToast("请输入耗材重量")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val waybillNo = waybillInfo.value?.waybillNo?.trim() ?: ""
|
||||||
|
if (waybillNo.isEmpty()) {
|
||||||
|
showToast("请选择运单")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val assembleCount = waybillInfo.value?.assembleCount?.trim() ?: ""
|
||||||
|
if (assembleCount.isEmpty()) {
|
||||||
|
showToast("请输入组装件数")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val assembleWeight = waybillInfo.value?.assembleWeight?.trim() ?: ""
|
||||||
|
// 组装重量为非必填,不进行验证
|
||||||
|
|
||||||
|
val operator = waybillInfo.value?.operator?.trim() ?: ""
|
||||||
|
if (operator.isEmpty()) {
|
||||||
|
showToast("请选择组装人")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val loadArea = selectedPosition.value?.positionName?.trim() ?: ""
|
||||||
|
if (loadArea.isEmpty()) {
|
||||||
|
showToast("请选择组装位置")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 获取选中的运单Bean
|
||||||
|
val currentWaybillList = waybillList.value ?: return
|
||||||
|
val selectedWaybill = currentWaybillList.firstOrNull { it.isSelected.get() }
|
||||||
|
if (selectedWaybill == null) {
|
||||||
|
showToast("请选择运单")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 构建useInfo(ULD信息)
|
||||||
|
val useInfo = mapOf(
|
||||||
|
"uld" to uldNo,
|
||||||
|
"consumeWeight" to materialWeight.toDoubleOrNull(),
|
||||||
|
"status" to when (uldInfo.value?.uldStatus) {
|
||||||
|
"正常" -> "0"
|
||||||
|
"故障" -> "1"
|
||||||
|
else -> ""
|
||||||
|
},
|
||||||
|
"loadArea" to loadArea
|
||||||
|
)
|
||||||
|
|
||||||
|
// 4. 构建wbInfo(运单信息)
|
||||||
|
val wbInfo = mapOf(
|
||||||
|
"wbNo" to selectedWaybill.waybillNo,
|
||||||
|
"pc" to selectedWaybill.pieces.toLongOrNull(),
|
||||||
|
"weight" to selectedWaybill.weight.toDoubleOrNull(),
|
||||||
|
"fdate" to selectedWaybill.fdate,
|
||||||
|
"fno" to selectedWaybill.fno,
|
||||||
|
"whId" to selectedWaybill.whId
|
||||||
|
)
|
||||||
|
|
||||||
|
// 5. 构建完整请求参数
|
||||||
|
val params = mapOf(
|
||||||
|
"abPc" to assembleCount.toLongOrNull(),
|
||||||
|
"abWeight" to assembleWeight.toDoubleOrNull(),
|
||||||
|
"consumeWeight" to materialWeight.toDoubleOrNull(),
|
||||||
|
"ldId" to operator,
|
||||||
|
"loadArea" to loadArea,
|
||||||
|
"useInfo" to useInfo,
|
||||||
|
"wbInfo" to wbInfo,
|
||||||
|
"userId" to SharedPreferenceUtil.getString(Constant.Share.account)
|
||||||
|
).toRequestBody()
|
||||||
|
|
||||||
|
// 6. 调用接口
|
||||||
|
val operationName = if (isLoad) "装货" else "卸货"
|
||||||
|
launchLoadingCollect({
|
||||||
|
if (isLoad) {
|
||||||
|
NetApply.api.assembleLoadCargo(params)
|
||||||
|
} else {
|
||||||
|
NetApply.api.assembleDropCargo(params)
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
onSuccess = { result ->
|
||||||
|
showToast("${operationName}成功")
|
||||||
|
// 刷新运单列表
|
||||||
|
loadInitialWaitingAssemble()
|
||||||
|
// 清空运单信息
|
||||||
|
waybillInfo.value = WaybillInfoBean()
|
||||||
|
}
|
||||||
|
onFailed = { code, message ->
|
||||||
|
showToast("${operationName}失败: $message")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,7 +139,7 @@
|
|||||||
<!-- 搜索框 -->
|
<!-- 搜索框 -->
|
||||||
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayoutNew
|
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayoutNew
|
||||||
android:id="@+id/tvWbSearch"
|
android:id="@+id/tvWbSearch"
|
||||||
hint='@{"请输入原单号"}'
|
hint='@{"请输入运单号"}'
|
||||||
icon="@{@drawable/img_search}"
|
icon="@{@drawable/img_search}"
|
||||||
setOnSearchListener="@{viewModel::loadWaitingAssembleWaybills}"
|
setOnSearchListener="@{viewModel::loadWaitingAssembleWaybills}"
|
||||||
setSearchIconClickListener="@{viewModel::loadWaitingAssembleWaybills}"
|
setSearchIconClickListener="@{viewModel::loadWaitingAssembleWaybills}"
|
||||||
@@ -364,6 +364,7 @@
|
|||||||
|
|
||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
enable="@{true}"
|
enable="@{true}"
|
||||||
|
required="@{false}"
|
||||||
title='@{"组装重量:"}'
|
title='@{"组装重量:"}'
|
||||||
titleLength="@{5}"
|
titleLength="@{5}"
|
||||||
type="@{DataLayoutType.INPUT}"
|
type="@{DataLayoutType.INPUT}"
|
||||||
@@ -410,7 +411,7 @@
|
|||||||
style="@style/tv_bottom_btn"
|
style="@style/tv_bottom_btn"
|
||||||
android:layout_width="120dp"
|
android:layout_width="120dp"
|
||||||
android:layout_height="44dp"
|
android:layout_height="44dp"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="32dp"
|
||||||
android:background="@drawable/bg_red_radius_4"
|
android:background="@drawable/bg_red_radius_4"
|
||||||
android:onClick="@{() -> viewModel.onLoadClick()}"
|
android:onClick="@{() -> viewModel.onLoadClick()}"
|
||||||
android:text="装货"
|
android:text="装货"
|
||||||
|
|||||||
Reference in New Issue
Block a user