feat: 国际出港 出港组装 开始组装

This commit is contained in:
2025-12-09 20:44:01 +08:00
parent 7d39cbf70f
commit a81567f10b
5 changed files with 77 additions and 147 deletions

View File

@@ -47,8 +47,8 @@ class IntExpAssembleStartActivity :
// 初始化列表
initRecyclerViews()
// 加载模拟数据
viewModel.initMockData()
// 初始化加载待组装运单数据
viewModel.loadInitialWaitingAssemble()
// 加载组装位置数据从API
viewModel.loadAssemblePosition()

View File

@@ -11,7 +11,6 @@ import com.lukouguoji.module_base.common.Constant
import com.lukouguoji.module_base.http.net.NetApply
import com.lukouguoji.module_base.ktx.launchLoadingCollect
import com.lukouguoji.module_base.ktx.showToast
import com.lukouguoji.module_base.ktx.toRequestBody
import com.lukouguoji.module_base.model.ScanModel
/**
@@ -41,113 +40,16 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
val waybillViewHolder = AssembleWaybillViewHolder::class.java
// ========== ULD信息 ==========
val uldInfo = MutableLiveData(UldInfoBean().apply {
uldNo = "PMC12345MU"
materialWeight = ""
uldStatus = "正常"
})
val uldInfo = MutableLiveData(UldInfoBean())
// ========== 运单信息 ==========
val waybillInfo = MutableLiveData(WaybillInfoBean().apply {
waybillNo = "78112345678"
waybillPieces = "100"
waybillWeight = "200"
assembleCount = ""
assembleWeight = ""
operator = "张三"
})
val waybillInfo = MutableLiveData(WaybillInfoBean())
/**
* 初始化模拟数据
* 初始化模拟数据(已废弃)
*/
fun initMockData() {
// 组装信息列表(左侧)
assembleInfoList.value = mutableListOf(
AssembleInfoBean().apply {
uldNo = "PMC12345MU"
weightInfo = "100/290kg"
hasArrow = true
isOrange = false
showIndex = true
},
AssembleInfoBean().apply {
uldNo = "AKE453654CZ"
weightInfo = "100/290kg"
hasArrow = true
isOrange = false
showIndex = true
},
AssembleInfoBean().apply {
uldNo = "AKE598190CZ"
weightInfo = "100/290kg"
hasArrow = true
isOrange = false
showIndex = true
},
AssembleInfoBean().apply {
uldNo = "78112345678"
weightInfo = "100/100kg"
hasArrow = false
isOrange = true
showIndex = false
},
AssembleInfoBean().apply {
uldNo = "78112345999"
weightInfo = "150/200kg"
hasArrow = false
isOrange = true
showIndex = false
},
AssembleInfoBean().apply {
uldNo = "78112345454"
weightInfo = "120/300kg"
hasArrow = false
isOrange = true
showIndex = false
}
)
// 组装位置列表(左侧)- 已改为从API加载不再使用模拟数据
// assemblePositionList.value = mutableListOf(
// AssemblePositionBean().apply {
// positionName = "组装区001"
// isSelected = true
// },
// AssemblePositionBean().apply {
// positionName = "组装区002"
// isSelected = false
// },
// AssemblePositionBean().apply {
// positionName = "组装区003"
// isSelected = false
// },
// AssemblePositionBean().apply {
// positionName = "组装区004"
// isSelected = false
// }
// )
// 运单列表(右侧)
waybillList.value = mutableListOf(
AssembleWaybillBean().apply {
waybillNo = "99912345678"
pieces = "25"
weight = "350.5"
isMarked = false
},
AssembleWaybillBean().apply {
waybillNo = "99912345679"
pieces = "18"
weight = "280.0"
isMarked = true // 标记为红色
},
AssembleWaybillBean().apply {
waybillNo = "99912345680"
pieces = "32"
weight = "520.8"
isMarked = false
}
)
// 不再加载mock数据
}
/**
@@ -211,11 +113,8 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
return
}
// 构建请求参数
val params = mapOf("wbNo" to wbNo).toRequestBody()
// 发起网络请求
launchLoadingCollect({ NetApply.api.queryWaitingAssemble(params) }) {
launchLoadingCollect({ NetApply.api.queryWaitingAssemble(wbNo) }) {
onSuccess = { result ->
// 数据转换: GjcWarehouse -> AssembleWaybillBean
val warehouseList = result.data ?: mutableListOf()
@@ -246,6 +145,36 @@ class IntExpAssembleStartViewModel : BaseViewModel() {
}
}
/**
* 初始化加载待组装运单列表(页面打开时调用)
*/
fun loadInitialWaitingAssemble() {
launchLoadingCollect({ NetApply.api.queryWaitingAssemble("") }) {
onSuccess = { result ->
val warehouseList = result.data ?: mutableListOf()
val waybillBeanList = warehouseList.map { warehouse ->
AssembleWaybillBean().apply {
waybillNo = warehouse.no
pieces = warehouse.pc.toString()
weight = String.format("%.1f", warehouse.weight)
flight = warehouse.flight
isMarked = false
}
}.toMutableList()
waybillList.value = waybillBeanList
if (waybillBeanList.isEmpty()) {
showToast("暂无待组装运单")
}
}
onFailed = { code, message ->
showToast("加载失败: $message")
waybillList.value = mutableListOf()
}
}
}
/**
* 卸货按钮点击