贴标申请,仓储转运
This commit is contained in:
+7
-1
@@ -758,10 +758,16 @@ public class WarehouseTransferService {
|
||||
&& pallet.getPalletNo().equals(request.palletCode().trim())) return detail(transfer.getCustomerId(), transferNo);
|
||||
if (!"GENERATED".equals(pallet.getStatus())) throw conflict("Only a generated pallet can be scan-bound");
|
||||
if (!pallet.getPalletNo().equals(request.palletCode().trim())) throw conflict("Scanned pallet code does not match this generated pallet");
|
||||
var physical = warehouseResources.resolvePallet(request.palletCode().trim());
|
||||
// Generation already persisted the warehouse pallet's immutable physical id.
|
||||
// Resolve by that id during binding instead of relying on the warehouse code
|
||||
// index, which can lag immediately after a new pallet is confirmed.
|
||||
var physical = warehouseResources.resolvePallet(pallet.getWarehousePalletId());
|
||||
if (physical.palletId() != pallet.getWarehousePalletId() || physical.warehouseId() != warehouseId) {
|
||||
throw conflict("Scanned pallet does not belong to this transfer and warehouse");
|
||||
}
|
||||
if (!pallet.getPalletNo().equals(physical.palletNo())) {
|
||||
throw conflict("Generated pallet identity does not match the warehouse pallet");
|
||||
}
|
||||
pallet.setStatus("BOUND"); pallet.setBindIdempotencyKey(request.idempotencyKey());
|
||||
pallet.setBoundAt(LocalDateTime.now()); pallet.setUpdatedAt(LocalDateTime.now()); transferPallets.updateById(pallet);
|
||||
return detail(transfer.getCustomerId(), transferNo);
|
||||
|
||||
Reference in New Issue
Block a user