feat: 国际进港舱单新增开始理货按钮

- 底部「货物发放」改名为「理货完成」,「分拣理货」改名为「装机单」
- 新增蓝色「开始理货」按钮,选中唯一一条运单后弹出修改库位对话框,
  提交 /IntImpManifest/modifyStorage
- 弹窗默认回填该运单已有的理货库位:舱单列表接口不返回 locationTally,
  改为先按 fid + wbNo 查一次装机单记录取出库位再回填
- GjjManifest 补充 locationTallyId 字段
- 装机单列表项运单号、品名列 completeSpace 调整为 5 以对齐

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-28 16:19:47 +08:00
parent 6f27c15d9a
commit f312ef866c
4 changed files with 92 additions and 14 deletions

View File

@@ -125,15 +125,15 @@ class IntImpManifestViewModel : BasePageViewModel() {
// ========== 全选状态 ==========
val isAllChecked = MutableLiveData(false)
fun onItemCheckChanged() {
updateCheckAllStatus()
}
fun updateCheckAllStatus() {
val list = pageModel.rv?.commonAdapter()?.items as? List<GjjManifest> ?: return
isAllChecked.value = list.isNotEmpty() && list.all { it.checked.get() }
}
fun onItemCheckChanged() {
updateCheckAllStatus()
}
fun updateCheckAllStatus() {
val list = pageModel.rv?.commonAdapter()?.items as? List<GjjManifest> ?: return
isAllChecked.value = list.isNotEmpty() && list.all { it.checked.get() }
}
// ========== 展开/收起 ==========
val isAllExpanded = MutableLiveData(false)
@@ -481,6 +481,77 @@ class IntImpManifestViewModel : BasePageViewModel() {
.navigation()
}
/**
* 开始理货(弹出修改库位对话框,提交理货库位)
*/
fun startTallyClick() {
val list = pageModel.rv?.commonAdapter()?.items as? List<GjjManifest> ?: return
val selectedItems = list.filter { it.isSelected }
if (selectedItems.isEmpty()) {
showToast("请选择要理货的运单")
return
}
if (selectedItems.size > 1) {
showToast("只能选择一个运单")
return
}
// 舱单列表接口不返回理货库位,需先查装机单记录取出该运单已有的库位再弹窗回填
val selectedItem = selectedItems.first()
val queryParams = mapOf(
"fid" to fid.ifEmpty { null },
"fdep" to fdep.ifEmpty { null },
"wbNo" to selectedItem.wbNo.ifEmpty { null },
"pageNum" to 1,
"pageSize" to 1
).toRequestBody()
launchLoadingCollect({ NetApply.api.getIntImpLoadingList(queryParams) }) {
onSuccess = { result ->
val tallyRecord = result.list?.firstOrNull()
showModifyStorageDialog(
selectedItems = selectedItems,
currentLocationId = tallyRecord?.locationTallyId?.takeIf { it > 0 }?.toString() ?: "",
currentLocationName = tallyRecord?.locationTally ?: ""
)
}
// 查询失败不阻断操作,直接弹出空白库位的对话框
onFailed = { _, _ -> showModifyStorageDialog(selectedItems, "", "") }
}
}
/**
* 弹出修改库位对话框并提交currentLocation* 用于回填该运单已有的理货库位)
*/
private fun showModifyStorageDialog(
selectedItems: List<GjjManifest>,
currentLocationId: String,
currentLocationName: String
) {
IntImpModifyStorageDialogModel(
currentLocationId = currentLocationId,
currentLocationName = currentLocationName
) { dialog ->
val params = mapOf(
"location" to dialog.locationName,
"locationId" to dialog.locationId.toLongOrNull(),
"manifestList" to selectedItems
).toRequestBody()
launchLoadingCollect({ NetApply.api.modifyIntImpLoadingStorage(params) }) {
onSuccess = {
if (it.verifySuccess()) {
showToast(it.msg.noNull("修改库位成功"))
refresh()
} else {
showToast(it.msg.noNull("修改库位失败"))
}
}
}
}.show()
}
/**
* 货物发放
*/

View File

@@ -274,9 +274,15 @@
style="@style/tv_bottom_btn"
android:layout_marginEnd="15dp"
android:onClick="@{()-> viewModel.sortingTallyClick()}"
android:text="分拣理货" />
android:text="装机单" />
<!-- 货物发放按钮 (红色) -->
<TextView
style="@style/tv_bottom_btn"
android:layout_marginEnd="15dp"
android:onClick="@{()-> viewModel.startTallyClick()}"
android:text="开始理货" />
<!-- 理货完成按钮 (红色) -->
<TextView
android:layout_width="100dp"
android:layout_height="40dp"
@@ -284,7 +290,7 @@
android:background="@drawable/bg_red_btn_bottom"
android:gravity="center"
android:onClick="@{()-> viewModel.cargoReleaseClick()}"
android:text="货物发放"
android:text="理货完成"
android:textColor="@color/white"
android:textSize="18sp" />

View File

@@ -67,7 +67,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{4}"
completeSpace="@{5}"
android:text="运单号:"
android:textSize="15sp" />
@@ -194,7 +194,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{4}"
completeSpace="@{5}"
android:text="品名(中)"
android:textSize="15sp" />