| | |
| | | import freemarker.template.Version; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Resource |
| | | RedisUtil redisUtil; |
| | | |
| | | @Value("${mes.glassGap}") |
| | | private Integer glassGap; |
| | | |
| | | @Value("${mes.carWidth}") |
| | | private Integer carWidth; |
| | | |
| | | private static final int ID_RATIO = 10; |
| | | |
| | |
| | | .queryOutGlassList(request.getFlowCardId(), request.getCell()); |
| | | int isPairCount = glassInfo.getTotalLayer() * request.getTotalPairQuantity(); |
| | | List<HollowGlassQueueInfo> hollowQueues = new ArrayList<>(); |
| | | loop: |
| | | for (HollowBigStorageCageDetails queue : hollowBigStorageCageDetailsList) { |
| | | HollowGlassQueueInfo queueInfo = new HollowGlassQueueInfo(); |
| | | BeanUtils.copyProperties(queue, queueInfo); |
| | | queueInfo.setRelationId(info.getId()); |
| | | queueInfo.setState(Const.TEMPERING_NEW); |
| | | queueInfo.setCell(request.getCell()); |
| | | queueInfo.setCreateTime(new Date()); |
| | | queueInfo.setUpdateTime(new Date()); |
| | | hollowQueues.add(queueInfo); |
| | | if (queue.getIsPair() == 1) { |
| | | isPairCount -= 1; |
| | | if (isPairCount == 0) { |
| | | break loop; |
| | | |
| | | if (930 == request.getCell()) { |
| | | Map<Integer, List<HollowBigStorageCageDetails>> listMap = hollowBigStorageCageDetailsList.stream() |
| | | .collect(Collectors.groupingBy(HollowBigStorageCageDetails::getHollowSequence)); |
| | | for (Map.Entry<Integer, List<HollowBigStorageCageDetails>> entry : listMap.entrySet()) { |
| | | //创建队列接收不满足成对情况下:一对玻璃分几次上车的次序问题 |
| | | List<HollowGlassQueueInfo> tempList = new ArrayList<>(); |
| | | //先将玻璃按照正常顺序排列,计算一车最多放几块,算好块数之后将一车的玻璃按照倒序存储 |
| | | List<HollowBigStorageCageDetails> reverse = CollectionUtil.reverse(entry.getValue()); |
| | | int remainWidth = carWidth; |
| | | for (HollowBigStorageCageDetails item : reverse) { |
| | | remainWidth = remainWidth - (int) Math.max(item.getWidth(), item.getHeight()); |
| | | if (remainWidth < 0) { |
| | | tempList = CollectionUtil.reverse(tempList); |
| | | remainWidth = carWidth - (int) Math.max(item.getWidth(), item.getHeight()); |
| | | } |
| | | HollowGlassQueueInfo queueInfo = HollowBDetailToQueue(item, info.getId(), request.getCell()); |
| | | tempList.add(queueInfo); |
| | | remainWidth = remainWidth - glassGap; |
| | | } |
| | | hollowQueues.addAll(tempList); |
| | | HollowBigStorageCageDetails cageDetails = entry.getValue().get(0); |
| | | if (cageDetails.getIsPair() == 1) { |
| | | isPairCount = isPairCount - cageDetails.getTotalLayer(); |
| | | if (isPairCount == 0) { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | loop: |
| | | for (HollowBigStorageCageDetails item : hollowBigStorageCageDetailsList) { |
| | | HollowGlassQueueInfo queueInfo = HollowBDetailToQueue(item, info.getId(), request.getCell()); |
| | | hollowQueues.add(queueInfo); |
| | | if (item.getIsPair() == 1) { |
| | | isPairCount = isPairCount - 1; |
| | | if (isPairCount == 0) { |
| | | break loop; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | return info; |
| | | } |
| | | |
| | | private HollowGlassQueueInfo HollowBDetailToQueue(HollowBigStorageCageDetails details, Long taskId, int targetCell) { |
| | | HollowGlassQueueInfo queueInfo = new HollowGlassQueueInfo(); |
| | | BeanUtils.copyProperties(details, queueInfo); |
| | | queueInfo.setRelationId(taskId); |
| | | queueInfo.setState(Const.TEMPERING_NEW); |
| | | queueInfo.setCell(targetCell); |
| | | queueInfo.setCreateTime(new Date()); |
| | | queueInfo.setUpdateTime(new Date()); |
| | | return queueInfo; |
| | | } |
| | | } |
| | | |