优化
This commit is contained in:
+16
@@ -5,6 +5,7 @@ import com.baiyue.common.core.api.ResultCode;
|
||||
import com.baiyue.common.core.exception.BizException;
|
||||
import com.baiyue.warehouse.dto.LocationRequests;
|
||||
import com.baiyue.warehouse.dto.PalletRequests;
|
||||
import com.baiyue.warehouse.dto.WarehousePalletResolveResponse;
|
||||
import com.baiyue.warehouse.entity.WarehouseLocationEntity;
|
||||
import com.baiyue.warehouse.entity.WarehousePalletEntity;
|
||||
import com.baiyue.warehouse.entity.WarehouseEntity;
|
||||
@@ -175,6 +176,21 @@ public class WarehouseResourceService {
|
||||
return requirePallet(customerId, warehouseId, id);
|
||||
}
|
||||
|
||||
public WarehousePalletResolveResponse resolvePublicPallet(String palletCode) {
|
||||
if (!StringUtils.hasText(palletCode)) {
|
||||
throw new BizException(ResultCode.BAD_REQUEST, "托盘码不能为空");
|
||||
}
|
||||
var matches = repository.findPublicPalletsByCode(palletCode.trim());
|
||||
if (matches.isEmpty()) throw new BizException(ResultCode.NOT_FOUND, "托盘码不存在");
|
||||
if (matches.size() != 1) throw new BizException(ResultCode.CONFLICT, "托盘码在多个仓库重复,无法解析");
|
||||
WarehousePalletEntity pallet = matches.get(0);
|
||||
if (pallet.getLocationId() == null) throw new BizException(ResultCode.CONFLICT, "托盘未绑定库位");
|
||||
if ("SCRAPPED".equals(pallet.getStatus())) throw new BizException(ResultCode.CONFLICT, "托盘已报废");
|
||||
return new WarehousePalletResolveResponse(pallet.getId(), pallet.getPalletCode(), pallet.getWarehouseId(),
|
||||
pallet.getLocationId(), pallet.getStatus(), pallet.getFbaWarehouseCode(),
|
||||
pallet.getVersion() == null ? 0 : pallet.getVersion());
|
||||
}
|
||||
|
||||
public PageResult<WarehousePalletEntity> pallets(long customerId, long warehouseId,
|
||||
PalletRequests.QueryRequest query) {
|
||||
requireWarehouse(customerId, warehouseId);
|
||||
|
||||
Reference in New Issue
Block a user