diff --git a/module_base/src/main/java/com/lukouguoji/module_base/bean/GjjManifest.kt b/module_base/src/main/java/com/lukouguoji/module_base/bean/GjjManifest.kt index aa1d9eb..bfbb612 100644 --- a/module_base/src/main/java/com/lukouguoji/module_base/bean/GjjManifest.kt +++ b/module_base/src/main/java/com/lukouguoji/module_base/bean/GjjManifest.kt @@ -60,6 +60,7 @@ data class GjjManifest( var unNumber: String = "", // 危险品编号 var activeId: Long = 0, // 活动ID var locationTally: String = "", // 理货库位号 + var locationTallyId: Long = 0, // 理货库位ID var pic: String = "", // 交接图片缩略图路径 var originalPic: String = "", // 交接图片原图地址 var picNumber: String = "" // 交接图片数量 diff --git a/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpManifestViewModel.kt b/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpManifestViewModel.kt index 43e586d..65ee829 100644 --- a/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpManifestViewModel.kt +++ b/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpManifestViewModel.kt @@ -125,15 +125,15 @@ class IntImpManifestViewModel : BasePageViewModel() { // ========== 全选状态 ========== val isAllChecked = MutableLiveData(false) - - fun onItemCheckChanged() { - updateCheckAllStatus() - } - - fun updateCheckAllStatus() { - val list = pageModel.rv?.commonAdapter()?.items as? List ?: return - isAllChecked.value = list.isNotEmpty() && list.all { it.checked.get() } - } + + fun onItemCheckChanged() { + updateCheckAllStatus() + } + + fun updateCheckAllStatus() { + val list = pageModel.rv?.commonAdapter()?.items as? List ?: 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 ?: 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, + 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() + } + /** * 货物发放 */ diff --git a/module_gjj/src/main/res/layout/activity_int_imp_manifest.xml b/module_gjj/src/main/res/layout/activity_int_imp_manifest.xml index 550b04f..be51231 100644 --- a/module_gjj/src/main/res/layout/activity_int_imp_manifest.xml +++ b/module_gjj/src/main/res/layout/activity_int_imp_manifest.xml @@ -274,9 +274,15 @@ style="@style/tv_bottom_btn" android:layout_marginEnd="15dp" android:onClick="@{()-> viewModel.sortingTallyClick()}" - android:text="分拣理货" /> + android:text="装机单" /> - + + + diff --git a/module_gjj/src/main/res/layout/item_int_imp_loading_list.xml b/module_gjj/src/main/res/layout/item_int_imp_loading_list.xml index 97ccd28..15d1e0a 100644 --- a/module_gjj/src/main/res/layout/item_int_imp_loading_list.xml +++ b/module_gjj/src/main/res/layout/item_int_imp_loading_list.xml @@ -67,7 +67,7 @@ @@ -194,7 +194,7 @@