fix: converge inbound pallets and retries
This commit is contained in:
+7
@@ -130,6 +130,13 @@ public class WarehouseResourceRepository {
|
||||
.orderByAsc(WarehousePalletEntity::getId));
|
||||
}
|
||||
|
||||
public WarehousePalletEntity findPublicPalletByCode(long warehouseId, String palletCode) {
|
||||
return pallets.selectOne(new LambdaQueryWrapper<WarehousePalletEntity>()
|
||||
.eq(WarehousePalletEntity::getCustomerId, 0L)
|
||||
.eq(WarehousePalletEntity::getWarehouseId, warehouseId)
|
||||
.eq(WarehousePalletEntity::getPalletCode, palletCode));
|
||||
}
|
||||
|
||||
public WarehousePalletEntity findPublicPallet(long palletId) {
|
||||
return pallets.selectOne(new LambdaQueryWrapper<WarehousePalletEntity>()
|
||||
.eq(WarehousePalletEntity::getCustomerId, 0L).eq(WarehousePalletEntity::getId, palletId));
|
||||
|
||||
+10
-6
@@ -88,12 +88,16 @@ public class WarehousePalletBatchService {
|
||||
SharedReservation shared = isDropshipPallet(requested.palletCode())
|
||||
? sharedDropship.get(requested.palletCode()) : null;
|
||||
if (shared == null) {
|
||||
Long palletId = resources.createPallet(WarehouseResourceService.PUBLIC_RESOURCE_SCOPE,
|
||||
normalized.warehouseId(), new PalletRequests.SaveRequest(requested.palletCode(), "WOOD",
|
||||
AUTO_PALLET_CAPACITY_CBM, AUTO_PALLET_UNIT_PRICE_USD, "IDLE", null, AUTO_PALLET_REMARK,
|
||||
requested.fbaWarehouseCode()));
|
||||
WarehousePalletEntity createdPallet = resources.pallet(WarehouseResourceService.PUBLIC_RESOURCE_SCOPE,
|
||||
normalized.warehouseId(), palletId);
|
||||
WarehousePalletEntity createdPallet = resources.reusablePublicPallet(
|
||||
normalized.warehouseId(), requested.palletCode());
|
||||
if (createdPallet == null) {
|
||||
Long palletId = resources.createPallet(WarehouseResourceService.PUBLIC_RESOURCE_SCOPE,
|
||||
normalized.warehouseId(), new PalletRequests.SaveRequest(requested.palletCode(), "WOOD",
|
||||
AUTO_PALLET_CAPACITY_CBM, AUTO_PALLET_UNIT_PRICE_USD, "IDLE", null, AUTO_PALLET_REMARK,
|
||||
requested.fbaWarehouseCode()));
|
||||
createdPallet = resources.pallet(WarehouseResourceService.PUBLIC_RESOURCE_SCOPE,
|
||||
normalized.warehouseId(), palletId);
|
||||
}
|
||||
WarehouseResourceLockResponse lock = locks.reserve(new WarehouseResourceLockRequests.ReserveRequest(
|
||||
requested.customerId(), normalized.warehouseId(), createdPallet.getId(), createdPallet.getLocationId(),
|
||||
BUSINESS_TYPE, requested.businessKey(), reservationKey(batch, requested.sequenceNo())));
|
||||
|
||||
+6
@@ -191,6 +191,12 @@ public class WarehouseResourceService {
|
||||
return palletReference(pallet);
|
||||
}
|
||||
|
||||
public WarehousePalletEntity reusablePublicPallet(long warehouseId, String palletCode) {
|
||||
if (!StringUtils.hasText(palletCode)) return null;
|
||||
requireWarehouseReference(warehouseId);
|
||||
return repository.findPublicPalletByCode(warehouseId, palletCode.trim());
|
||||
}
|
||||
|
||||
public WarehousePalletResolveResponse resolvePublicPallet(long palletId) {
|
||||
WarehousePalletEntity pallet = repository.findPublicPallet(palletId);
|
||||
if (pallet == null) throw new BizException(ResultCode.NOT_FOUND, "托盘不存在");
|
||||
|
||||
Reference in New Issue
Block a user