From 74f1280896a2534d478630db176b2e03d8bad774 Mon Sep 17 00:00:00 2001 From: YANG JIANKUAN Date: Thu, 24 Sep 2026 11:32:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=9B=BD=E9=99=85=E8=BF=9B=E6=B8=AF?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E5=85=A5=E5=BA=93/=E5=87=BA=E5=BA=93?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=A1=AB=E5=86=99=E4=BB=B6=E6=95=B0=E9=87=8D?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 入库弹窗新增件数、重量输入,默认取选中运单件数重量(装机单入库不显示) - 出库改用出库弹窗(替换确认框),新增件数、重量输入,默认取库位入库件数重量 - 出库接口请求体由数组改为对象,选中库位放入 storageUseList - 库位子列表新增入库件数/重量、出库件数/重量四列 Co-Authored-By: Claude Opus 5.5 (1M context) --- .../gjj/activity/IntImpStorageUseActivity.kt | 35 +++-- .../gjj/dialog/IntImpInStorageDialogModel.kt | 26 ++++ .../gjj/dialog/IntImpOutStorageDialogModel.kt | 58 +++++++++ .../viewModel/IntImpStorageUseViewModel.kt | 16 ++- .../res/layout/dialog_int_imp_in_storage.xml | 63 +++++++++ .../res/layout/dialog_int_imp_out_storage.xml | 123 ++++++++++++++++++ .../res/layout/item_int_imp_storage_use.xml | 40 ++++++ .../layout/item_int_imp_storage_use_sub.xml | 44 +++++++ 8 files changed, 393 insertions(+), 12 deletions(-) create mode 100644 module_gjj/src/main/java/com/lukouguoji/gjj/dialog/IntImpOutStorageDialogModel.kt create mode 100644 module_gjj/src/main/res/layout/dialog_int_imp_out_storage.xml diff --git a/module_gjj/src/main/java/com/lukouguoji/gjj/activity/IntImpStorageUseActivity.kt b/module_gjj/src/main/java/com/lukouguoji/gjj/activity/IntImpStorageUseActivity.kt index d7fbd66..eeb5c61 100644 --- a/module_gjj/src/main/java/com/lukouguoji/gjj/activity/IntImpStorageUseActivity.kt +++ b/module_gjj/src/main/java/com/lukouguoji/gjj/activity/IntImpStorageUseActivity.kt @@ -3,13 +3,13 @@ package com.lukouguoji.gjj.activity import android.app.Activity import android.content.Intent import android.os.Bundle -import com.lukouguoji.module_base.model.ConfirmDialogModel import com.alibaba.android.arouter.facade.annotation.Route import com.lukouguoji.gjj.R import com.lukouguoji.gjj.databinding.ActivityIntImpStorageUseBinding import com.lukouguoji.gjj.dialog.IntImpMoveClearDialogModel import com.lukouguoji.gjj.dialog.IntImpModifyStorageDialogModel import com.lukouguoji.gjj.dialog.IntImpInStorageDialogModel +import com.lukouguoji.gjj.dialog.IntImpOutStorageDialogModel import com.lukouguoji.gjj.viewModel.IntImpStorageUseViewModel import com.lukouguoji.module_base.base.BaseBindingActivity import com.lukouguoji.module_base.common.Constant @@ -141,11 +141,17 @@ class IntImpStorageUseActivity : return } - ConfirmDialogModel( - message = "是否确认出库?", - title = "出库确认" - ) { - viewModel.performOutStorage(selectedStorageList) + // 显示出库对话框,件数/重量默认取选中库位的入库件数/重量 + IntImpOutStorageDialogModel( + storageCount = selectedStorageList.size, + defaultPc = selectedStorageList.mapNotNull { it.inPc }.takeIf { it.isNotEmpty() }?.sum(), + defaultWeight = selectedStorageList.mapNotNull { it.inWeight }.takeIf { it.isNotEmpty() }?.sum() + ) { dialog -> + viewModel.performOutStorage( + dialog.pc.value?.toLongOrNull(), + dialog.weight.value?.toDoubleOrNull(), + selectedStorageList + ) }.show(this) } @@ -176,10 +182,19 @@ class IntImpStorageUseActivity : return } - IntImpInStorageDialogModel { dialog -> - val locationName = dialog.locationName - val locationId = dialog.locationId - viewModel.performInStorage(locationName, locationId, maWbListForInStorage) + // 显示入库对话框,件数/重量默认取选中运单的件数/重量 + IntImpInStorageDialogModel( + showPcWeight = true, + defaultPc = maWbListForInStorage.mapNotNull { it.pc }.takeIf { it.isNotEmpty() }?.sum(), + defaultWeight = maWbListForInStorage.mapNotNull { it.weight }.takeIf { it.isNotEmpty() }?.sum() + ) { dialog -> + viewModel.performInStorage( + dialog.locationName, + dialog.locationId, + dialog.pc.value?.toLongOrNull(), + dialog.weight.value?.toDoubleOrNull(), + maWbListForInStorage + ) }.show(this) } diff --git a/module_gjj/src/main/java/com/lukouguoji/gjj/dialog/IntImpInStorageDialogModel.kt b/module_gjj/src/main/java/com/lukouguoji/gjj/dialog/IntImpInStorageDialogModel.kt index 83de66b..098e191 100644 --- a/module_gjj/src/main/java/com/lukouguoji/gjj/dialog/IntImpInStorageDialogModel.kt +++ b/module_gjj/src/main/java/com/lukouguoji/gjj/dialog/IntImpInStorageDialogModel.kt @@ -1,6 +1,7 @@ package com.lukouguoji.gjj.dialog import android.content.Context +import android.text.InputType import androidx.lifecycle.MutableLiveData import com.lukouguoji.gjj.R import com.lukouguoji.gjj.databinding.DialogIntImpInStorageBinding @@ -8,13 +9,20 @@ import com.lukouguoji.module_base.base.BaseDialogModel import com.lukouguoji.module_base.http.net.NetApply import com.lukouguoji.module_base.ktx.launchCollect import com.lukouguoji.module_base.ktx.showToast +import com.lukouguoji.module_base.ktx.toPlainText import com.lukouguoji.module_base.ktx.verifyNullOrEmpty import dev.utils.app.info.KeyValue /** * 国际进港仓库 - 入库操作对话框 + * @param showPcWeight 是否显示件数/重量输入(仓库页入库显示,装机单入库不显示) + * @param defaultPc 默认件数(选中运单的件数) + * @param defaultWeight 默认重量(选中运单的重量) */ class IntImpInStorageDialogModel( + val showPcWeight: Boolean = false, + defaultPc: Long? = null, + defaultWeight: Double? = null, private val callback: (IntImpInStorageDialogModel) -> Unit ) : BaseDialogModel(DIALOG_TYPE_CENTER) { @@ -30,12 +38,20 @@ class IntImpInStorageDialogModel( // 库位名称 (后端需要的name) var locationName: String = "" + // 入库件数 + val pc = MutableLiveData(defaultPc?.toString() ?: "") + + // 入库重量 + val weight = MutableLiveData(defaultWeight?.toPlainText() ?: "") + override fun layoutId(): Int { return R.layout.dialog_int_imp_in_storage } override fun onDialogCreated(context: Context) { binding.model = this + binding.pcInput.et.inputType = InputType.TYPE_CLASS_NUMBER + binding.weightInput.et.inputType = InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_FLAG_DECIMAL loadLocationList() // 监听选择变化,更新locationId和locationName @@ -68,6 +84,16 @@ class IntImpInStorageDialogModel( if (selectedLocationCode.value.verifyNullOrEmpty("请选择库位")) { return } + if (showPcWeight) { + if (pc.value?.toLongOrNull() == null) { + showToast("请输入正确的件数") + return + } + if (weight.value?.toDoubleOrNull() == null) { + showToast("请输入正确的重量") + return + } + } dismiss() callback(this) } diff --git a/module_gjj/src/main/java/com/lukouguoji/gjj/dialog/IntImpOutStorageDialogModel.kt b/module_gjj/src/main/java/com/lukouguoji/gjj/dialog/IntImpOutStorageDialogModel.kt new file mode 100644 index 0000000..5610d96 --- /dev/null +++ b/module_gjj/src/main/java/com/lukouguoji/gjj/dialog/IntImpOutStorageDialogModel.kt @@ -0,0 +1,58 @@ +package com.lukouguoji.gjj.dialog + +import android.content.Context +import android.text.InputType +import androidx.lifecycle.MutableLiveData +import com.lukouguoji.gjj.R +import com.lukouguoji.gjj.databinding.DialogIntImpOutStorageBinding +import com.lukouguoji.module_base.base.BaseDialogModel +import com.lukouguoji.module_base.ktx.showToast +import com.lukouguoji.module_base.ktx.toPlainText + +/** + * 国际进港仓库 - 出库操作对话框 + * @param storageCount 选中的库位数 + * @param defaultPc 默认件数(选中库位的入库件数) + * @param defaultWeight 默认重量(选中库位的入库重量) + */ +class IntImpOutStorageDialogModel( + storageCount: Int, + defaultPc: Long?, + defaultWeight: Double?, + private val callback: (IntImpOutStorageDialogModel) -> Unit +) : BaseDialogModel(DIALOG_TYPE_CENTER) { + + val tip = "已选择 $storageCount 个库位执行出库操作" + + // 出库件数 + val pc = MutableLiveData(defaultPc?.toString() ?: "") + + // 出库重量 + val weight = MutableLiveData(defaultWeight?.toPlainText() ?: "") + + override fun layoutId(): Int { + return R.layout.dialog_int_imp_out_storage + } + + override fun onDialogCreated(context: Context) { + binding.model = this + binding.pcInput.et.inputType = InputType.TYPE_CLASS_NUMBER + binding.weightInput.et.inputType = InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_FLAG_DECIMAL + } + + /** + * 确定按钮点击 + */ + fun onSaveClick() { + if (pc.value?.toLongOrNull() == null) { + showToast("请输入正确的件数") + return + } + if (weight.value?.toDoubleOrNull() == null) { + showToast("请输入正确的重量") + return + } + dismiss() + callback(this) + } +} diff --git a/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpStorageUseViewModel.kt b/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpStorageUseViewModel.kt index 8e8aca2..b177992 100644 --- a/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpStorageUseViewModel.kt +++ b/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpStorageUseViewModel.kt @@ -192,14 +192,20 @@ class IntImpStorageUseViewModel : BasePageViewModel() { /** * 执行出库操作 + * @param pc 出库件数 + * @param weight 出库重量 */ - fun performOutStorage(storageUseList: List) { + fun performOutStorage(pc: Long?, weight: Double?, storageUseList: List) { if (storageUseList.isEmpty()) { showToast("请选择要出库的库位") return } - val params = storageUseList.toRequestBody() + val params = mapOf( + "pc" to pc, + "weight" to weight, + "storageUseList" to storageUseList + ).toRequestBody() launchLoadingCollect({ NetApply.api.outIntImpStorage(params) }) { onSuccess = { @@ -221,10 +227,14 @@ class IntImpStorageUseViewModel : BasePageViewModel() { /** * 执行入库操作 + * @param pc 入库件数 + * @param weight 入库重量 */ fun performInStorage( locationName: String, locationId: String, + pc: Long?, + weight: Double?, maWbListForInStorage: List ) { if (maWbListForInStorage.isEmpty()) { @@ -240,6 +250,8 @@ class IntImpStorageUseViewModel : BasePageViewModel() { val body = mapOf( "location" to locationName, "locationId" to locationId.toLongOrNull(), + "pc" to pc, + "weight" to weight, "warehouseList" to maWbListForInStorage ).toRequestBody() diff --git a/module_gjj/src/main/res/layout/dialog_int_imp_in_storage.xml b/module_gjj/src/main/res/layout/dialog_int_imp_in_storage.xml index 2dba956..f6b6d20 100644 --- a/module_gjj/src/main/res/layout/dialog_int_imp_in_storage.xml +++ b/module_gjj/src/main/res/layout/dialog_int_imp_in_storage.xml @@ -62,6 +62,69 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/module_gjj/src/main/res/layout/dialog_int_imp_out_storage.xml b/module_gjj/src/main/res/layout/dialog_int_imp_out_storage.xml new file mode 100644 index 0000000..e297cf9 --- /dev/null +++ b/module_gjj/src/main/res/layout/dialog_int_imp_out_storage.xml @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/module_gjj/src/main/res/layout/item_int_imp_storage_use.xml b/module_gjj/src/main/res/layout/item_int_imp_storage_use.xml index 5744132..a732a5f 100644 --- a/module_gjj/src/main/res/layout/item_int_imp_storage_use.xml +++ b/module_gjj/src/main/res/layout/item_int_imp_storage_use.xml @@ -415,6 +415,26 @@ android:textSize="14sp" android:textStyle="bold" /> + + + + + + + + + + + + + + + + + + + +