fix(lastleg): accept cabinet pallet identities

This commit is contained in:
2026-09-18 14:14:10 +08:00
parent 2d902308b5
commit 895d0f7639
9 changed files with 49 additions and 15 deletions
@@ -255,7 +255,7 @@ public class ContainerInboundPlanConversionCoordinator {
String fbaCode = trimToNull(order.fbaWarehouseCode());
if (fbaCode != null && !"ONE_CLICK_DROPSHIP".equals(order.orderType())) {
for (String palletCode : sourcePalletNos) {
PalletCodeParts parts = palletCodeParts(preview.containerNo(), palletCode);
PalletCodeParts parts = palletCodeParts(palletCode);
String previousPrefix = prefixByFba.putIfAbsent(fbaCode, parts.prefix());
if (previousPrefix != null && !previousPrefix.equals(parts.prefix())) {
throw new ResponseStatusException(HttpStatus.CONFLICT, "同一 FBA 仓的头程托盘码内部编码不一致");
@@ -487,17 +487,16 @@ public class ContainerInboundPlanConversionCoordinator {
int localSequenceNo, int globalSequenceNo, String businessKey,
String fbaWarehouseCode, String palletCode) { }
private static PalletCodeParts palletCodeParts(String containerNo, String palletCode) {
String stableContainerNo = trimToNull(containerNo);
private static PalletCodeParts palletCodeParts(String palletCode) {
String stablePalletCode = trimToNull(palletCode);
if (stableContainerNo == null || stablePalletCode == null) {
throw new ResponseStatusException(HttpStatus.CONFLICT, "集装箱号或头程托盘码缺失");
if (stablePalletCode == null) {
throw new ResponseStatusException(HttpStatus.CONFLICT, "头程托盘码缺失");
}
Matcher matcher = Pattern.compile("^(" + Pattern.quote(stableContainerNo) + "-.+)-(\\d{3})$")
Matcher matcher = Pattern.compile("^(D\\d{4,}-.+)-(\\d{3})$")
.matcher(stablePalletCode);
if (!matcher.matches()) {
throw new ResponseStatusException(HttpStatus.CONFLICT,
"头程托盘码不符合‘集装箱号-FBA内部编码-下标’规则");
"头程托盘码不符合‘柜次号-FBA内部编码-下标’规则");
}
return new PalletCodeParts(matcher.group(1), Integer.parseInt(matcher.group(2)));
}