|
@@ -170,18 +170,6 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
}
|
|
|
log.info("C端起跺吊运单信息:" + JSON.toJSON(billetLiftingBillList));
|
|
|
saveBatchBilletLiftingBills(billetLiftingBillList);
|
|
|
-
|
|
|
- // 验证垛位容器是否被占位
|
|
|
- LambdaQueryWrapper<StackingAndLoadingVehicles> queryWrapperCheck = new LambdaQueryWrapper<>();
|
|
|
- queryWrapperCheck.eq(StackingAndLoadingVehicles::getCcmNo, ccmNo)
|
|
|
- .eq(StackingAndLoadingVehicles::getLayer, jsonObject.getString("layer")).eq(StackingAndLoadingVehicles::getAddress, jsonObject.getString("address"));
|
|
|
- // 查询垛位容器信息
|
|
|
- StackingAndLoadingVehicles stackingAndLoadingVehiclesCheck = stackingAndLoadingVehiclesMapper.selectOne(queryWrapperCheck);
|
|
|
- if (oConvertUtils.isNotEmpty(stackingAndLoadingVehiclesCheck) && oConvertUtils.isNotEmpty(stackingAndLoadingVehiclesCheck.getBilletNos())) {
|
|
|
- log.info("{}{}", "该垛位容器位置已被占用,自动化新增堆垛失败!", jsonObject.toJSONString());
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
// 根据billetHotsendTypeConfigId 查询基础垛位信息
|
|
|
BilletHotsendTypeConfig billetHotsendTypeConfig = billetHotsendTypeConfigService.getById(billetHotsendTypeConfigId);
|
|
|
loadingParams.setBelongTable(billetHotsendTypeConfig.getBelongTable());
|
|
@@ -198,90 +186,6 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
stackingAndLoadingVehicles.setAddress(billetNoItem.getString("address"));
|
|
|
return stackingAndLoadingVehicles;
|
|
|
}).collect(Collectors.toList());
|
|
|
-
|
|
|
-//
|
|
|
-// LambdaQueryWrapper<StackingAndLoadingVehicles> queryWrapper3 = new LambdaQueryWrapper<>();
|
|
|
-// queryWrapper3.eq(StackingAndLoadingVehicles::getCcmNo, ccmNo)
|
|
|
-// .eq(StackingAndLoadingVehicles::getTypeConfigId, billetHotsendTypeConfigId);
|
|
|
-// List<StackingAndLoadingVehicles> stackingAndLoadingVehiclesListInfo = stackingAndLoadingVehiclesMapper.selectList(queryWrapper3);
|
|
|
-// // 检查 layer=20, address=9 的数据是否已被占用
|
|
|
-// boolean isTopRightOccupied = stackingAndLoadingVehiclesListInfo.stream()
|
|
|
-// .anyMatch(vehicle -> Integer.parseInt(vehicle.getLayer()) == 20
|
|
|
-// && Integer.parseInt(vehicle.getAddress()) == 9
|
|
|
-// && vehicle.getBilletNos() != null
|
|
|
-// && !vehicle.getBilletNos().isEmpty());
|
|
|
-//
|
|
|
-// if (isTopRightOccupied) {
|
|
|
-// log.info("{}{}", "该垛位容器位置已占满,自动化新增堆垛失败!", jsonObject.toJSONString());
|
|
|
-// return;
|
|
|
-// }
|
|
|
-//
|
|
|
-// // 过滤出 billet_nos 不为空的记录,并按优先级排序(layer 降序,address 降序)
|
|
|
-// List<StackingAndLoadingVehicles> nonEmptyBillets = stackingAndLoadingVehiclesListInfo.stream()
|
|
|
-// .filter(vehicle -> vehicle.getBilletNos() != null && !vehicle.getBilletNos().isEmpty())
|
|
|
-// .sorted(Comparator.comparing((StackingAndLoadingVehicles v) -> Integer.parseInt(v.getLayer())).reversed()
|
|
|
-// .thenComparing(v -> Integer.parseInt(v.getAddress()), Comparator.reverseOrder()))
|
|
|
-// .collect(Collectors.toList());
|
|
|
-//
|
|
|
-// // 获取所有 billet_nos 为空的记录,并按优先级排序(layer 升序,address 升序)
|
|
|
-// List<StackingAndLoadingVehicles> emptySlots = stackingAndLoadingVehiclesListInfo.stream()
|
|
|
-// .filter(vehicle -> vehicle.getBilletNos() == null || vehicle.getBilletNos().isEmpty())
|
|
|
-// .sorted(Comparator.comparing((StackingAndLoadingVehicles v) -> Integer.parseInt(v.getLayer())) // Layer 升序
|
|
|
-// .thenComparing(v -> Integer.parseInt(v.getAddress()))) // Address 也升序
|
|
|
-// .collect(Collectors.toList());
|
|
|
-//
|
|
|
-//
|
|
|
-// if (oConvertUtils.listIsEmpty(emptySlots)){
|
|
|
-// // 如果该垛位所有为空的记录为空,则返回
|
|
|
-// log.info("{}{}", "该垛位容器位置已占满,自动化新增堆垛失败!", jsonObject.toJSONString());
|
|
|
-// return;
|
|
|
-// }
|
|
|
-//
|
|
|
-// // 确定填充起点
|
|
|
-// int startIndex;
|
|
|
-// if (!nonEmptyBillets.isEmpty()) {
|
|
|
-// // 已有数据,从最高优先级位置开始
|
|
|
-// StackingAndLoadingVehicles highestPriorityVehicle = nonEmptyBillets.get(0);
|
|
|
-// int startLayer = Integer.parseInt(highestPriorityVehicle.getLayer());
|
|
|
-// int startAddress = Integer.parseInt(highestPriorityVehicle.getAddress());
|
|
|
-//
|
|
|
-// // 处理 address 进位
|
|
|
-// if (startAddress == 9) {
|
|
|
-// startLayer += 1;
|
|
|
-// startAddress = 1;
|
|
|
-// } else {
|
|
|
-// startAddress += 1;
|
|
|
-// }
|
|
|
-//
|
|
|
-// // 找到第一个符合 startLayer & startAddress 以上的空位
|
|
|
-// int finalStartLayer = startLayer;
|
|
|
-// int finalStartAddress = startAddress;
|
|
|
-// Optional<StackingAndLoadingVehicles> startingPoint = emptySlots.stream()
|
|
|
-// .filter(vehicle -> Integer.parseInt(vehicle.getLayer()) == finalStartLayer && Integer.parseInt(vehicle.getAddress()) == finalStartAddress)
|
|
|
-// .findFirst();
|
|
|
-//
|
|
|
-// startIndex = emptySlots.indexOf(startingPoint.orElse(null));
|
|
|
-// } else {
|
|
|
-// // 没有已有数据,从 layer=1, address=1 开始填充
|
|
|
-// startIndex = 0;
|
|
|
-// }
|
|
|
-//
|
|
|
-// if (startIndex == -1) {
|
|
|
-// log.info("未找到合适的填充起点");
|
|
|
-// return;
|
|
|
-// }
|
|
|
-//
|
|
|
-// List<StackingAndLoadingVehicles> newList = new ArrayList<>();
|
|
|
-// // 按顺序填充数据
|
|
|
-// for (int i = 0; i < stackingAndLoadingVehiclesLists.size() && startIndex + i < emptySlots.size(); i++) {
|
|
|
-// emptySlots.get(startIndex + i).setBilletNos(stackingAndLoadingVehiclesLists.get(i).getBilletNos());
|
|
|
-// emptySlots.get(startIndex + i).setCcmNo(stackingAndLoadingVehiclesLists.get(i).getCcmNo());
|
|
|
-// emptySlots.get(startIndex + i).setTypeConfigId(stackingAndLoadingVehiclesLists.get(i).getTypeConfigId());
|
|
|
-// emptySlots.get(startIndex + i).setStackAddr(stackingAndLoadingVehiclesLists.get(i).getStackAddr());
|
|
|
-// emptySlots.get(startIndex + i).setCreateTime(stackingAndLoadingVehiclesLists.get(i).getCreateTime());
|
|
|
-// newList.add(emptySlots.get(startIndex + i));
|
|
|
-// }
|
|
|
-//
|
|
|
loadingParams.setStackingAndLoadingVehiclesList(stackingAndLoadingVehiclesLists);
|
|
|
|
|
|
List<StackingAndLoadingVehicles> stackingAndLoadingVehiclesList = loadingParams.getStackingAndLoadingVehiclesList();
|
|
@@ -1157,6 +1061,20 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
|
|
|
private void handleAddStackInfo(BilletHotsend billetHotsend, List<StackingAndLoadingVehicles> stackingAndLoadingVehiclesList, LoadingParams loadingParams, BilletHotsendTypeConfig billetHotsendTypeConfig){
|
|
|
// 2 发车后,动态更新容器中的垛位信息 初始化
|
|
|
stackingAndLoadingVehiclesList.forEach(x ->{
|
|
|
+
|
|
|
+ LambdaQueryWrapper<StackingAndLoadingVehicles> queryWrapperCheck = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapperCheck.eq(StackingAndLoadingVehicles::getCcmNo, x.getCcmNo())
|
|
|
+ .eq(StackingAndLoadingVehicles::getLayer, x.getLayer())
|
|
|
+ .eq(StackingAndLoadingVehicles::getAddress, x.getAddress())
|
|
|
+ .eq(StackingAndLoadingVehicles::getTypeConfigId, loadingParams.getBilletHotsendTypeConfigId())
|
|
|
+ .isNotNull(StackingAndLoadingVehicles::getBilletNos);
|
|
|
+ // 查询垛位容器信息
|
|
|
+ StackingAndLoadingVehicles stackingAndLoadingVehiclesCheck = stackingAndLoadingVehiclesMapper.selectOne(queryWrapperCheck);
|
|
|
+ if (oConvertUtils.isNotEmpty(stackingAndLoadingVehiclesCheck) && oConvertUtils.isNotEmpty(stackingAndLoadingVehiclesCheck.getBilletNos())) {
|
|
|
+ log.info("{}{}", "C端自动化起垛失败,该垛位容器位置已被占用!", x.getBilletNos());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
LambdaUpdateWrapper<StackingAndLoadingVehicles> queryWrapperSA = new LambdaUpdateWrapper<>();
|
|
|
queryWrapperSA.eq(StackingAndLoadingVehicles::getCcmNo, x.getCcmNo())
|
|
|
.eq(StackingAndLoadingVehicles::getLayer, x.getLayer())
|