贴标申请,仓储转运

This commit is contained in:
2026-09-20 15:06:17 +08:00
parent a7d458cddd
commit 02844da360
56 changed files with 2121 additions and 111 deletions
@@ -118,13 +118,20 @@ public class WarehouseResourceService {
@Transactional
public WarehousePalletResolveResponse ensureRelabelPallet(long warehouseId, String businessId) {
return ensureRelabelPallet(warehouseId, businessId, null);
}
@Transactional
public WarehousePalletResolveResponse ensureRelabelPallet(long warehouseId, String businessId,
String fbaWarehouseCode) {
String normalizedBusinessId = businessId == null ? null : businessId.trim();
String normalizedFbaWarehouseCode = StringUtils.hasText(fbaWarehouseCode) ? fbaWarehouseCode.trim() : null;
WarehousePalletBindingEntity existing = repository.findPalletBinding(PUBLIC_RESOURCE_SCOPE, warehouseId,
"RELABEL_PDA_NEW", normalizedBusinessId);
if (existing != null) return resolvePublicPallet(existing.getPalletId());
if (existing != null) return requireRelabelPalletDestination(existing.getPalletId(), normalizedFbaWarehouseCode);
Long palletId = createPallet(PUBLIC_RESOURCE_SCOPE, warehouseId,
new PalletRequests.SaveRequest(null, "STANDARD", null, java.math.BigDecimal.ZERO, "IDLE", null,
"PDA换标拆托新托盘"));
"PDA换标拆托新托盘", normalizedFbaWarehouseCode));
WarehousePalletBindingEntity binding = new WarehousePalletBindingEntity();
binding.setId(IdWorker.getId()); binding.setCustomerId(PUBLIC_RESOURCE_SCOPE); binding.setWarehouseId(warehouseId);
binding.setBusinessType("RELABEL_PDA_NEW"); binding.setBusinessId(normalizedBusinessId); binding.setPalletId(palletId);
@@ -136,10 +143,19 @@ public class WarehouseResourceService {
WarehousePalletBindingEntity winner = repository.findPalletBinding(PUBLIC_RESOURCE_SCOPE, warehouseId,
"RELABEL_PDA_NEW", normalizedBusinessId);
if (winner == null) throw duplicate;
return resolvePublicPallet(winner.getPalletId());
return requireRelabelPalletDestination(winner.getPalletId(), normalizedFbaWarehouseCode);
}
}
private WarehousePalletResolveResponse requireRelabelPalletDestination(long palletId, String fbaWarehouseCode) {
WarehousePalletResolveResponse pallet = resolvePublicPallet(palletId);
if (fbaWarehouseCode != null && !fbaWarehouseCode.equalsIgnoreCase(
java.util.Objects.toString(pallet.fbaWarehouseCode(), ""))) {
throw new BizException(ResultCode.CONFLICT, "换标新托盘的 FBA 目的仓与当前申请不一致");
}
return pallet;
}
/**
* Returns the warehouse-scoped virtual location used only as a pallet/inventory reference.
* It is deliberately never made IDLE/OCCUPIED by resource locking.