| | |
| | | .eq(HollowGlassQueueInfo::getState, Const.TEMPERING_NEW) |
| | | .eq(HollowGlassQueueInfo::getRelationId, hollowGlassOutRelationInfo.getId()) |
| | | .orderByAsc(HollowGlassQueueInfo::getHollowSequence)); |
| | | if (CollectionUtil.isNotEmpty(unFinishHollowQueueList)) { |
| | | //按照任务信息过滤筛选需要出片及调度的玻璃队列 |
| | | List<HollowGlassQueueInfo> resultQueue = computeOutHollowQueue(unFinishHollowQueueList, hollowGlassOutRelationInfo); |
| | | log.info("中空出片任务计算后的出片队列为:{}", resultQueue); |
| | | if (CollectionUtil.isNotEmpty(resultQueue)) { |
| | | //直通台有玻璃时将中空出片队列中对应玻璃id的格子号替换未直通台 |
| | | log.info("中空大理片直通台玻璃信息{}", details); |
| | | if (details != null) { |
| | | unFinishHollowQueueList.stream().forEach(e -> { |
| | | resultQueue.stream().forEach(e -> { |
| | | if (e.getGlassId().equals(details.getGlassId())) { |
| | | e.setSlot(THROUGH_SLOT); |
| | | e.setDeviceId(0); |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | List<HollowGlassQueueInfo> infoList = unFinishHollowQueueList.stream().filter(e -> !(e.getSlot() >= 500 && e.getSlot() < 900 && e.getIsPair() != 1)).collect(Collectors.toList()); |
| | | log.info("有正在出片的中空任务"); |
| | | Integer isPair = infoList.get(0).getIsPair(); |
| | | hollowOutGlassByIsPair(infoList, hollowGlassOutRelationInfo.getCell(), isPair, hollowGlassOutRelationInfo.getTotalLayer(), hollowGlassOutRelationInfo.getIsForce()); |
| | | log.info("有正在出片的中空任务:{}", hollowGlassOutRelationInfo); |
| | | Integer isPair = resultQueue.get(0).getIsPair(); |
| | | hollowOutGlassByIsPair(resultQueue, hollowGlassOutRelationInfo.getCell(), isPair, hollowGlassOutRelationInfo.getTotalLayer(), hollowGlassOutRelationInfo.getIsForce()); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | | } |
| | | |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void finishInBigStorageTask() throws Exception { |
| | |
| | | log.info("出片任务-无动作执行完成"); |
| | | } |
| | | |
| | | private List<HollowGlassQueueInfo> computeOutHollowQueue(List<HollowGlassQueueInfo> queueInfoList, HollowGlassOutRelationInfo hollowGlassOutRelationInfo) { |
| | | if (CollectionUtil.isNotEmpty(queueInfoList)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | //任务为强制,只直接返回原有的队列 |
| | | if (hollowGlassOutRelationInfo.getIsForce() == 1) { |
| | | return queueInfoList; |
| | | } |
| | | log.info("领取任务:{}的队列:{}", hollowGlassOutRelationInfo, queueInfoList); |
| | | // 按格子号分组 |
| | | Map<Integer, List<HollowGlassQueueInfo>> gridGroups = queueInfoList.stream() |
| | | .collect(Collectors.groupingBy(HollowGlassQueueInfo::getSlot)); |
| | | List<HollowGlassQueueInfo> resultQueue = new ArrayList<>(); |
| | | |
| | | for (List<HollowGlassQueueInfo> items : gridGroups.values()) { |
| | | // 情况1:格子内只有一个数据且未配对 - 过滤掉 |
| | | if (items.size() == 1 && 0 == items.get(0).getSlot()) { |
| | | continue; |
| | | } |
| | | |
| | | // 情况2:格子内全部为未配对的数据 - 过滤掉 |
| | | boolean allUnpaired = items.stream().noneMatch(e -> e.getIsPair() == 1); |
| | | if (allUnpaired) { |
| | | continue; |
| | | } |
| | | // 否则保留这个格子内的所有数据 |
| | | resultQueue.addAll(items); |
| | | } |
| | | return resultQueue; |
| | | } |
| | | |
| | | private <T extends HollowBigStorageCageBaseInfo> Boolean hollowOutGlassByIsPair(List<T> list, |
| | | int targetSlot, int isPair, int totalLayer, int isForce) throws Exception { |