feat: 国际进港仓库入库/出库支持填写件数重量

- 入库弹窗新增件数、重量输入,默认取选中运单件数重量(装机单入库不显示)
- 出库改用出库弹窗(替换确认框),新增件数、重量输入,默认取库位入库件数重量
- 出库接口请求体由数组改为对象,选中库位放入 storageUseList
- 库位子列表新增入库件数/重量、出库件数/重量四列

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-24 11:32:43 +08:00
parent 2dc86bcae5
commit 74f1280896
8 changed files with 393 additions and 12 deletions

View File

@@ -3,13 +3,13 @@ package com.lukouguoji.gjj.activity
import android.app.Activity import android.app.Activity
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import com.lukouguoji.module_base.model.ConfirmDialogModel
import com.alibaba.android.arouter.facade.annotation.Route import com.alibaba.android.arouter.facade.annotation.Route
import com.lukouguoji.gjj.R import com.lukouguoji.gjj.R
import com.lukouguoji.gjj.databinding.ActivityIntImpStorageUseBinding import com.lukouguoji.gjj.databinding.ActivityIntImpStorageUseBinding
import com.lukouguoji.gjj.dialog.IntImpMoveClearDialogModel import com.lukouguoji.gjj.dialog.IntImpMoveClearDialogModel
import com.lukouguoji.gjj.dialog.IntImpModifyStorageDialogModel import com.lukouguoji.gjj.dialog.IntImpModifyStorageDialogModel
import com.lukouguoji.gjj.dialog.IntImpInStorageDialogModel import com.lukouguoji.gjj.dialog.IntImpInStorageDialogModel
import com.lukouguoji.gjj.dialog.IntImpOutStorageDialogModel
import com.lukouguoji.gjj.viewModel.IntImpStorageUseViewModel import com.lukouguoji.gjj.viewModel.IntImpStorageUseViewModel
import com.lukouguoji.module_base.base.BaseBindingActivity import com.lukouguoji.module_base.base.BaseBindingActivity
import com.lukouguoji.module_base.common.Constant import com.lukouguoji.module_base.common.Constant
@@ -141,11 +141,17 @@ class IntImpStorageUseActivity :
return return
} }
ConfirmDialogModel( // 显示出库对话框,件数/重量默认取选中库位的入库件数/重量
message = "是否确认出库?", IntImpOutStorageDialogModel(
title = "出库确认" storageCount = selectedStorageList.size,
) { defaultPc = selectedStorageList.mapNotNull { it.inPc }.takeIf { it.isNotEmpty() }?.sum(),
viewModel.performOutStorage(selectedStorageList) defaultWeight = selectedStorageList.mapNotNull { it.inWeight }.takeIf { it.isNotEmpty() }?.sum()
) { dialog ->
viewModel.performOutStorage(
dialog.pc.value?.toLongOrNull(),
dialog.weight.value?.toDoubleOrNull(),
selectedStorageList
)
}.show(this) }.show(this)
} }
@@ -176,10 +182,19 @@ class IntImpStorageUseActivity :
return return
} }
IntImpInStorageDialogModel { dialog -> // 显示入库对话框,件数/重量默认取选中运单的件数/重量
val locationName = dialog.locationName IntImpInStorageDialogModel(
val locationId = dialog.locationId showPcWeight = true,
viewModel.performInStorage(locationName, locationId, maWbListForInStorage) 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) }.show(this)
} }

View File

@@ -1,6 +1,7 @@
package com.lukouguoji.gjj.dialog package com.lukouguoji.gjj.dialog
import android.content.Context import android.content.Context
import android.text.InputType
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import com.lukouguoji.gjj.R import com.lukouguoji.gjj.R
import com.lukouguoji.gjj.databinding.DialogIntImpInStorageBinding 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.http.net.NetApply
import com.lukouguoji.module_base.ktx.launchCollect import com.lukouguoji.module_base.ktx.launchCollect
import com.lukouguoji.module_base.ktx.showToast import com.lukouguoji.module_base.ktx.showToast
import com.lukouguoji.module_base.ktx.toPlainText
import com.lukouguoji.module_base.ktx.verifyNullOrEmpty import com.lukouguoji.module_base.ktx.verifyNullOrEmpty
import dev.utils.app.info.KeyValue import dev.utils.app.info.KeyValue
/** /**
* 国际进港仓库 - 入库操作对话框 * 国际进港仓库 - 入库操作对话框
* @param showPcWeight 是否显示件数/重量输入(仓库页入库显示,装机单入库不显示)
* @param defaultPc 默认件数(选中运单的件数)
* @param defaultWeight 默认重量(选中运单的重量)
*/ */
class IntImpInStorageDialogModel( class IntImpInStorageDialogModel(
val showPcWeight: Boolean = false,
defaultPc: Long? = null,
defaultWeight: Double? = null,
private val callback: (IntImpInStorageDialogModel) -> Unit private val callback: (IntImpInStorageDialogModel) -> Unit
) : BaseDialogModel<DialogIntImpInStorageBinding>(DIALOG_TYPE_CENTER) { ) : BaseDialogModel<DialogIntImpInStorageBinding>(DIALOG_TYPE_CENTER) {
@@ -30,12 +38,20 @@ class IntImpInStorageDialogModel(
// 库位名称 (后端需要的name) // 库位名称 (后端需要的name)
var locationName: String = "" var locationName: String = ""
// 入库件数
val pc = MutableLiveData(defaultPc?.toString() ?: "")
// 入库重量
val weight = MutableLiveData(defaultWeight?.toPlainText() ?: "")
override fun layoutId(): Int { override fun layoutId(): Int {
return R.layout.dialog_int_imp_in_storage return R.layout.dialog_int_imp_in_storage
} }
override fun onDialogCreated(context: Context) { override fun onDialogCreated(context: Context) {
binding.model = this 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() loadLocationList()
// 监听选择变化,更新locationId和locationName // 监听选择变化,更新locationId和locationName
@@ -68,6 +84,16 @@ class IntImpInStorageDialogModel(
if (selectedLocationCode.value.verifyNullOrEmpty("请选择库位")) { if (selectedLocationCode.value.verifyNullOrEmpty("请选择库位")) {
return return
} }
if (showPcWeight) {
if (pc.value?.toLongOrNull() == null) {
showToast("请输入正确的件数")
return
}
if (weight.value?.toDoubleOrNull() == null) {
showToast("请输入正确的重量")
return
}
}
dismiss() dismiss()
callback(this) callback(this)
} }

View File

@@ -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<DialogIntImpOutStorageBinding>(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)
}
}

View File

@@ -192,14 +192,20 @@ class IntImpStorageUseViewModel : BasePageViewModel() {
/** /**
* 执行出库操作 * 执行出库操作
* @param pc 出库件数
* @param weight 出库重量
*/ */
fun performOutStorage(storageUseList: List<GjcStorageUse>) { fun performOutStorage(pc: Long?, weight: Double?, storageUseList: List<GjcStorageUse>) {
if (storageUseList.isEmpty()) { if (storageUseList.isEmpty()) {
showToast("请选择要出库的库位") showToast("请选择要出库的库位")
return return
} }
val params = storageUseList.toRequestBody() val params = mapOf(
"pc" to pc,
"weight" to weight,
"storageUseList" to storageUseList
).toRequestBody()
launchLoadingCollect({ NetApply.api.outIntImpStorage(params) }) { launchLoadingCollect({ NetApply.api.outIntImpStorage(params) }) {
onSuccess = { onSuccess = {
@@ -221,10 +227,14 @@ class IntImpStorageUseViewModel : BasePageViewModel() {
/** /**
* 执行入库操作 * 执行入库操作
* @param pc 入库件数
* @param weight 入库重量
*/ */
fun performInStorage( fun performInStorage(
locationName: String, locationName: String,
locationId: String, locationId: String,
pc: Long?,
weight: Double?,
maWbListForInStorage: List<GjcMaWb> maWbListForInStorage: List<GjcMaWb>
) { ) {
if (maWbListForInStorage.isEmpty()) { if (maWbListForInStorage.isEmpty()) {
@@ -240,6 +250,8 @@ class IntImpStorageUseViewModel : BasePageViewModel() {
val body = mapOf( val body = mapOf(
"location" to locationName, "location" to locationName,
"locationId" to locationId.toLongOrNull(), "locationId" to locationId.toLongOrNull(),
"pc" to pc,
"weight" to weight,
"warehouseList" to maWbListForInStorage "warehouseList" to maWbListForInStorage
).toRequestBody() ).toRequestBody()

View File

@@ -62,6 +62,69 @@
</LinearLayout> </LinearLayout>
<!-- 件数/重量(仅仓库页入库显示) -->
<LinearLayout
visible="@{model.showPcWeight}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- 件数 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{5}"
android:text="件数:"
android:textColor="@color/text_normal"
android:textSize="16sp" />
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
android:id="@+id/pc_input"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
type="@{SearchLayoutType.INPUT}"
hint='@{"请输入件数"}'
value="@={model.pc}" />
</LinearLayout>
<!-- 重量 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{5}"
android:text="重量:"
android:textColor="@color/text_normal"
android:textSize="16sp" />
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
android:id="@+id/weight_input"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
type="@{SearchLayoutType.INPUT}"
hint='@{"请输入重量"}'
value="@={model.weight}" />
</LinearLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>
<!-- 底部按钮 --> <!-- 底部按钮 -->

View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<import type="com.lukouguoji.module_base.ui.weight.search.layout.SearchLayoutType"/>
<variable
name="model"
type="com.lukouguoji.gjj.dialog.IntImpOutStorageDialogModel" />
</data>
<LinearLayout
android:layout_width="480dp"
android:layout_height="wrap_content"
android:background="@drawable/bg_dialog_f2_radius_10"
android:gravity="center_horizontal"
android:orientation="vertical">
<!-- 标题栏 -->
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/bg_primary_radius_top_10"
android:gravity="center"
android:text="出库操作"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
<!-- 表单内容 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="30dp"
android:layout_marginTop="30dp"
android:orientation="vertical">
<!-- 提示 -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{model.tip}"
android:textColor="@color/text_normal"
android:textSize="16sp" />
<!-- 件数 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{5}"
android:text="件数:"
android:textColor="@color/text_normal"
android:textSize="16sp" />
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
android:id="@+id/pc_input"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
type="@{SearchLayoutType.INPUT}"
hint='@{"请输入件数"}'
value="@={model.pc}" />
</LinearLayout>
<!-- 重量 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{5}"
android:text="重量:"
android:textColor="@color/text_normal"
android:textSize="16sp" />
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
android:id="@+id/weight_input"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
type="@{SearchLayoutType.INPUT}"
hint='@{"请输入重量"}'
value="@={model.weight}" />
</LinearLayout>
</LinearLayout>
<!-- 底部按钮 -->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_marginBottom="20dp">
<TextView
style="@style/tv_bottom_btn"
android:onClick="@{()->model.dismiss()}"
android:text="取消" />
<TextView
style="@style/tv_bottom_btn"
android:onClick="@{()->model.onSaveClick()}"
android:text="确定" />
</LinearLayout>
</LinearLayout>
</layout>

View File

@@ -415,6 +415,26 @@
android:textSize="14sp" android:textSize="14sp"
android:textStyle="bold" /> android:textStyle="bold" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:gravity="center"
android:text="入库件数"
android:textColor="@color/text_normal"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:gravity="center"
android:text="入库重量"
android:textColor="@color/text_normal"
android:textSize="14sp"
android:textStyle="bold" />
<TextView <TextView
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -435,6 +455,26 @@
android:textSize="14sp" android:textSize="14sp"
android:textStyle="bold" /> android:textStyle="bold" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:gravity="center"
android:text="出库件数"
android:textColor="@color/text_normal"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:gravity="center"
android:text="出库重量"
android:textColor="@color/text_normal"
android:textSize="14sp"
android:textStyle="bold" />
<TextView <TextView
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@@ -47,6 +47,28 @@
android:textColor="@color/text_normal" android:textColor="@color/text_normal"
android:textSize="14sp" /> android:textSize="14sp" />
<!-- 入库件数 -->
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="0.8"
android:gravity="center"
android:text="@{bean.inPcText}"
android:textColor="@color/text_normal"
android:textSize="14sp" />
<!-- 入库重量 -->
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="0.8"
android:gravity="center"
android:text="@{bean.inWeightText}"
android:textColor="@color/text_normal"
android:textSize="14sp" />
<!-- 入库人 --> <!-- 入库人 -->
<TextView <TextView
android:layout_width="0dp" android:layout_width="0dp"
@@ -69,6 +91,28 @@
android:textColor="@color/text_normal" android:textColor="@color/text_normal"
android:textSize="14sp" /> android:textSize="14sp" />
<!-- 出库件数 -->
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="0.8"
android:gravity="center"
android:text="@{bean.outPcText}"
android:textColor="@color/text_normal"
android:textSize="14sp" />
<!-- 出库重量 -->
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="0.8"
android:gravity="center"
android:text="@{bean.outWeightText}"
android:textColor="@color/text_normal"
android:textSize="14sp" />
<!-- 出库人 --> <!-- 出库人 -->
<TextView <TextView
android:layout_width="0dp" android:layout_width="0dp"