feat: 国际进港舱单分单编辑页主分校验功能

将主分校验从接口查询改为本地实时计算,显示"分单之和/主单"格式,
超出主单时红色提示并禁止保存,品名(中)优先取goodsCn兜底取goods。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-22 18:23:02 +08:00
parent 5e1ccc9e8a
commit 78238907b0
4 changed files with 101 additions and 17 deletions

View File

@@ -31,15 +31,28 @@ class IntImpManifestSubEditActivity :
}
companion object {
const val KEY_MAIN_PC = "mainPc"
const val KEY_MAIN_WEIGHT = "mainWeight"
const val KEY_OTHER_SUB_PC = "otherSubPc"
const val KEY_OTHER_SUB_WEIGHT = "otherSubWeight"
/**
* 新增分单
*/
@JvmStatic
fun startForAdd(context: Context, manifest: GjjManifest) {
// 新增模式:其他分单之和 = 所有已有分单之和
val otherSubPc = manifest.haWbList?.sumOf { it.pc } ?: 0L
val otherSubWeight = manifest.haWbList?.sumOf { it.weight } ?: 0.0
context.startActivity(
Intent(context, IntImpManifestSubEditActivity::class.java)
.putExtra(Constant.Key.PAGE_TYPE, DetailsPageType.Add.name)
.putExtra(Constant.Key.BEAN, manifest)
.putExtra(KEY_MAIN_PC, manifest.pc)
.putExtra(KEY_MAIN_WEIGHT, manifest.weight)
.putExtra(KEY_OTHER_SUB_PC, otherSubPc)
.putExtra(KEY_OTHER_SUB_WEIGHT, otherSubWeight)
)
}
@@ -48,11 +61,19 @@ class IntImpManifestSubEditActivity :
*/
@JvmStatic
fun startForModify(context: Context, manifest: GjjManifest, haWb: GjjHaWb) {
// 修改模式:其他分单之和 = 所有分单之和 - 当前编辑的分单
val otherSubPc = (manifest.haWbList?.sumOf { it.pc } ?: 0L) - haWb.pc
val otherSubWeight = (manifest.haWbList?.sumOf { it.weight } ?: 0.0) - haWb.weight
context.startActivity(
Intent(context, IntImpManifestSubEditActivity::class.java)
.putExtra(Constant.Key.PAGE_TYPE, DetailsPageType.Modify.name)
.putExtra(Constant.Key.BEAN, manifest)
.putExtra("haWb", haWb)
.putExtra(KEY_MAIN_PC, manifest.pc)
.putExtra(KEY_MAIN_WEIGHT, manifest.weight)
.putExtra(KEY_OTHER_SUB_PC, otherSubPc)
.putExtra(KEY_OTHER_SUB_WEIGHT, otherSubWeight)
)
}
}