|
|
|
@ -262,28 +262,33 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService { |
|
|
|
System.out.println("旧记录已删除,准备扫入新栈板" + palletId); |
|
|
|
} |
|
|
|
|
|
|
|
// 3. 获取栈板类型信息和maxLayer |
|
|
|
// 3. 获取栈板类型信息和maxLayer、wcsSoreType - rqrq |
|
|
|
com.gaotao.modules.warehouse.entity.PalletData palletInfo = wcsIntegrationMapper.getPalletInfoWithTypeDetails(site, palletId); |
|
|
|
String palletType = palletInfo.getPalletType(); |
|
|
|
Integer maxLayer = palletInfo.getMaxLayer() != null ? palletInfo.getMaxLayer() : 0; |
|
|
|
|
|
|
|
// 4. 根据maxLayer进行不同的校验 |
|
|
|
if (maxLayer > 0) { |
|
|
|
// maxLayer > 0:有层数托盘(9宫格、4宫格等) |
|
|
|
// 每个位置每层只能放一个东西 |
|
|
|
|
|
|
|
// 检查该位置该层是否已有东西 暂时注掉 |
|
|
|
// List<Map<String, Object>> existingDetails = wcsIntegrationMapper.getPalletDetails(site, palletId, position, layer); |
|
|
|
// if (!existingDetails.isEmpty()) { |
|
|
|
// throw new Exception("该位置第" + layer + "层已有物料,每层只能放一个物料"); |
|
|
|
// } |
|
|
|
} else { |
|
|
|
// maxLayer = 0:混装托盘 |
|
|
|
// 只能选第1层,但可以放多个东西 |
|
|
|
if (layer != 1) { |
|
|
|
throw new Exception("混装托盘只能使用第1层"); |
|
|
|
Integer wcsSoreType = palletInfo.getWcsSoreType() != null ? palletInfo.getWcsSoreType() : 0; |
|
|
|
if (layer > 1) { |
|
|
|
// 检查该位置的第1层到第layer-1层是否都有物料 - rqrq |
|
|
|
List<Integer> existingLayers = wcsIntegrationMapper.getLayersByPosition(site, palletId, position); |
|
|
|
|
|
|
|
// 检查每一层是否都有物料 - rqrq |
|
|
|
for (int i = 1; i < layer; i++) { |
|
|
|
if (!existingLayers.contains(i)) { |
|
|
|
throw new Exception("该位置第" + i + "层没有物料,不能放置第" + layer + "层,防止物品悬空"); |
|
|
|
} |
|
|
|
} |
|
|
|
// 允许同一位置同一层放多个东西,不做校验 |
|
|
|
} |
|
|
|
// 4. 根据maxLayer和wcsSoreType进行不同的校验 - rqrq |
|
|
|
if(wcsSoreType == 1) { |
|
|
|
// wcsSoreType = 1:气胀轴自动分拣(9宫格、4宫格),每个位置每层只能放一个东西 |
|
|
|
List<Map<String, Object>> existingDetails = wcsIntegrationMapper.getPalletDetails(site, palletId, position, layer); |
|
|
|
if (!existingDetails.isEmpty()) { |
|
|
|
throw new Exception("该位置第" + layer + "层已有物料,气胀轴分拣托盘每层只能放一个物料"); |
|
|
|
} |
|
|
|
} else if (wcsSoreType == 2) { |
|
|
|
// wcsSoreType = 2:抱箱自动分拣(底4箱+上3箱等),每层可以放多个东西 |
|
|
|
} else { |
|
|
|
// wcsSoreType = 0或其他:允许放多个 |
|
|
|
} |
|
|
|
|
|
|
|
// 5. 保存栈板明细 |
|
|
|
@ -404,13 +409,27 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService { |
|
|
|
throw new Exception("标签不在当前栈板中"); |
|
|
|
} |
|
|
|
|
|
|
|
// 获取栈板类型信息和maxLayer |
|
|
|
// 获取栈板类型信息和maxLayer、wcsSoreType - rqrq |
|
|
|
com.gaotao.modules.warehouse.entity.PalletData palletInfo = wcsIntegrationMapper.getPalletInfoWithTypeDetails(site, palletId); |
|
|
|
Integer maxLayer = palletInfo.getMaxLayer() != null ? palletInfo.getMaxLayer() : 0; |
|
|
|
|
|
|
|
// 根据maxLayer进行不同的校验 |
|
|
|
if (maxLayer > 0) { |
|
|
|
// maxLayer > 0:有层数托盘,每个位置每层只能放一个东西 |
|
|
|
Integer wcsSoreType = palletInfo.getWcsSoreType() != null ? palletInfo.getWcsSoreType() : 0; |
|
|
|
|
|
|
|
// 根据maxLayer和wcsSoreType进行不同的校验 - rqrq |
|
|
|
if (maxLayer == 0) { |
|
|
|
// maxLayer = 0:不限高托盘,需要校验下层是否都有物料,防止悬空 - rqrq |
|
|
|
if (newLayer > 1) { |
|
|
|
// 检查目标位置的第1层到第newLayer-1层是否都有物料 - rqrq |
|
|
|
List<Integer> existingLayers = wcsIntegrationMapper.getLayersByPosition(site, palletId, newPosition); |
|
|
|
|
|
|
|
// 检查每一层是否都有物料(排除当前标签原来的层) - rqrq |
|
|
|
for (int i = 1; i < newLayer; i++) { |
|
|
|
if (!existingLayers.contains(i)) { |
|
|
|
throw new Exception("目标位置第" + i + "层没有物料,不能移动到第" + newLayer + "层,防止物品悬空"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (wcsSoreType == 1) { |
|
|
|
// wcsSoreType = 1:气胀轴自动分拣托盘,每个位置每层只能放一个东西 |
|
|
|
// 检查目标位置的目标层是否已有其他东西(排除当前标签) |
|
|
|
List<Map<String, Object>> existingDetails = wcsIntegrationMapper.getPalletDetails(site, palletId, newPosition, newLayer); |
|
|
|
|
|
|
|
@ -421,12 +440,10 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService { |
|
|
|
if (hasOtherItem) { |
|
|
|
throw new Exception("目标位置第" + newLayer + "层已有其他物料,每层只能放一个物料"); |
|
|
|
} |
|
|
|
} else if (wcsSoreType == 2) { |
|
|
|
// wcsSoreType = 2:抱箱自动分拣(底4箱+上3箱等),每层可以放多个东西 |
|
|
|
} else { |
|
|
|
// maxLayer = 0:混装托盘,只能选第1层 |
|
|
|
if (newLayer != 1) { |
|
|
|
throw new Exception("混装托盘只能使用第1层"); |
|
|
|
} |
|
|
|
// 允许同一位置同一层放多个东西,不做校验 |
|
|
|
// wcsSoreType = 0或其他:允许放多个 |
|
|
|
} |
|
|
|
|
|
|
|
// 执行位置更新 |
|
|
|
@ -1031,4 +1048,67 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService { |
|
|
|
|
|
|
|
System.out.println("完成组托完成 - AI制作"); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, Object> getAvailablePositionsForLayer(Map<String, Object> params) throws Exception { |
|
|
|
System.out.println("开始获取指定层数下各位置可用状态 - rqrq,params=" + params); |
|
|
|
|
|
|
|
String site = (String) params.get("site"); |
|
|
|
String palletId = (String) params.get("palletId"); |
|
|
|
Integer layer = params.get("layer") != null ? Integer.valueOf(params.get("layer").toString()) : 1; |
|
|
|
|
|
|
|
if (!StringUtils.hasText(site) || !StringUtils.hasText(palletId)) { |
|
|
|
throw new Exception("参数不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
// 1. 获取栈板类型信息 - rqrq |
|
|
|
com.gaotao.modules.warehouse.entity.PalletData palletInfo = wcsIntegrationMapper.getPalletInfoWithTypeDetails(site, palletId); |
|
|
|
if (palletInfo == null) { |
|
|
|
throw new Exception("栈板不存在"); |
|
|
|
} |
|
|
|
|
|
|
|
Integer maxLayer = palletInfo.getMaxLayer() != null ? palletInfo.getMaxLayer() : 0; |
|
|
|
Integer wcsSoreType = palletInfo.getWcsSoreType() != null ? palletInfo.getWcsSoreType() : 0; |
|
|
|
String palletType = palletInfo.getPalletType(); |
|
|
|
|
|
|
|
// 2. 获取该托盘类型的所有位置 - rqrq |
|
|
|
List<String> allPositions = wcsIntegrationMapper.getPalletTypePositions(site, palletType); |
|
|
|
|
|
|
|
// 3. 判断是否混装托盘 - rqrq |
|
|
|
boolean isMixed = (maxLayer == 0); |
|
|
|
|
|
|
|
// 4. 获取该层已占用的位置 - rqrq |
|
|
|
List<String> occupiedPositions = new ArrayList<>(); |
|
|
|
|
|
|
|
if (wcsSoreType == 1) { |
|
|
|
// 气胀轴自动分拣:每层每个位置只能放一个,查询该层已占用的位置 - rqrq |
|
|
|
occupiedPositions = wcsIntegrationMapper.getOccupiedPositionsByLayer(site, palletId, layer); |
|
|
|
} else if (wcsSoreType == 2 || wcsSoreType == 0) { |
|
|
|
// 抱箱自动分拣或混装:每层可以放多个,所以所有位置都可用 - rqrq |
|
|
|
occupiedPositions = new ArrayList<>(); |
|
|
|
} |
|
|
|
|
|
|
|
// 5. 计算可用位置 - rqrq |
|
|
|
List<String> availablePositions = new ArrayList<>(); |
|
|
|
for (String position : allPositions) { |
|
|
|
if (!occupiedPositions.contains(position)) { |
|
|
|
availablePositions.add(position); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 6. 返回结果 - rqrq |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
result.put("positions", allPositions); // 所有位置 |
|
|
|
result.put("availablePositions", availablePositions); // 可用位置 |
|
|
|
result.put("occupiedPositions", occupiedPositions); // 已占用位置 |
|
|
|
result.put("maxLayer", maxLayer); // 最大层数 |
|
|
|
result.put("isMixed", isMixed); // 是否混装 |
|
|
|
result.put("wcsSoreType", wcsSoreType); // 存储类型 |
|
|
|
|
|
|
|
System.out.println("获取位置可用状态完成 - 总位置数: " + allPositions.size() + |
|
|
|
", 可用: " + availablePositions.size() + |
|
|
|
", 已占用: " + occupiedPositions.size() + " - rqrq"); |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
} |