| | |
| | | |
| | | //计算目标格子 |
| | | List<HollowBigStorageCageHistoryTask> historyTasks = new ArrayList<>(); |
| | | for (BigStorageCageTask task : inTaskList) { |
| | | GlassInfo info = glassListMap.get(task.getGlassId()).get(0); |
| | | HollowBigStorageDTO bigStorageDTO = hollowGlassRelationInfoService.queryHollowTargetSlot(info.getFlowCardId(), |
| | | info.getWidth(), info.getHeight(), info.getTotalLayer(), info.getLayer()); |
| | | try { |
| | | for (BigStorageCageTask task : inTaskList) { |
| | | GlassInfo info = glassListMap.get(task.getGlassId()).get(0); |
| | | HollowBigStorageDTO bigStorageDTO = hollowGlassRelationInfoService.queryHollowTargetSlot(info.getFlowCardId(), |
| | | info.getWidth(), info.getHeight(), info.getTotalLayer(), info.getLayer()); |
| | | // 临时更新格子的剩余尺寸:防止相邻玻璃进同一格子造成剩余尺寸不足,玻璃越界的情况,任务完成后再次更新大理片笼表剩余宽度(按照笼内玻璃数量更新大理片笼剩余尺寸) |
| | | hollowBigStorageCageService.update(new LambdaUpdateWrapper<HollowBigStorageCage>() |
| | | .set(HollowBigStorageCage::getRemainWidth, bigStorageDTO.getRemainWidth() - Math.max(info.getWidth(), info.getHeight()) - glassGap) |
| | | .eq(HollowBigStorageCage::getSlot, bigStorageDTO.getSlot())); |
| | | task.setTargetSlot(bigStorageDTO.getSlot()); |
| | | task.setGlassId(info.getGlassId()); |
| | | bigStorageCageTaskService.updateTaskMessage(BIG_STORAGE_CAGE_IN_TWO_TASK, task); |
| | | //存放历史任务 |
| | | HollowBigStorageCageHistoryTask historyTask = new HollowBigStorageCageHistoryTask(); |
| | | BeanUtils.copyProperties(task, historyTask); |
| | | historyTask.setTaskType(Const.BIG_STORAGE_AFTER_IN); |
| | | historyTask.setGlassCount(glassInfoList.size()); |
| | | historyTask.setTaskState(Const.ENGINEERING_NEW); |
| | | historyTasks.add(historyTask); |
| | | //存放详情数据 |
| | | HollowBigStorageCageDetails cageDetails = new HollowBigStorageCageDetails(); |
| | | BeanUtils.copyProperties(bigStorageDTO, cageDetails); |
| | | BeanUtils.copyProperties(info, cageDetails); |
| | | cageDetails.setState(Const.GLASS_STATE_NEW); |
| | | cageDetails.setSequence(bigStorageDTO.getSlotSequence()); |
| | | cageDetails.setGap(glassGap); |
| | | cageDetails.setId(null); |
| | | hollowBigStorageCageDetailsService.save(cageDetails); |
| | | hollowBigStorageCageService.update(new LambdaUpdateWrapper<HollowBigStorageCage>() |
| | | .set(HollowBigStorageCage::getRemainWidth, bigStorageDTO.getRemainWidth() - Math.max(info.getWidth(), info.getHeight()) - glassGap) |
| | | .eq(HollowBigStorageCage::getSlot, bigStorageDTO.getSlot())); |
| | | task.setTargetSlot(bigStorageDTO.getSlot()); |
| | | task.setGlassId(info.getGlassId()); |
| | | bigStorageCageTaskService.updateTaskMessage(BIG_STORAGE_CAGE_IN_TWO_TASK, task); |
| | | //存放历史任务 |
| | | HollowBigStorageCageHistoryTask historyTask = new HollowBigStorageCageHistoryTask(); |
| | | BeanUtils.copyProperties(task, historyTask); |
| | | historyTask.setTaskType(Const.BIG_STORAGE_AFTER_IN); |
| | | historyTask.setGlassCount(glassInfoList.size()); |
| | | historyTask.setTaskState(Const.ENGINEERING_NEW); |
| | | historyTasks.add(historyTask); |
| | | //存放详情数据 |
| | | HollowBigStorageCageDetails cageDetails = new HollowBigStorageCageDetails(); |
| | | BeanUtils.copyProperties(bigStorageDTO, cageDetails); |
| | | BeanUtils.copyProperties(info, cageDetails); |
| | | cageDetails.setState(Const.GLASS_STATE_NEW); |
| | | cageDetails.setSequence(bigStorageDTO.getSlotSequence()); |
| | | cageDetails.setGap(glassGap); |
| | | cageDetails.setId(null); |
| | | hollowBigStorageCageDetailsService.save(cageDetails); |
| | | hollowGlassRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassRelationInfo>() |
| | | .set(HollowGlassRelationInfo::getGlassId, cageDetails.getGlassId()) |
| | | .set(HollowGlassRelationInfo::getTemperingLayoutId, cageDetails.getTemperingLayoutId()) |
| | | .set(HollowGlassRelationInfo::getTemperingFeedSequence, cageDetails.getTemperingFeedSequence()) |
| | | .set(HollowGlassRelationInfo::getEngineerId, cageDetails.getEngineerId()) |
| | | .set(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_OCCUPY) |
| | | .eq(HollowGlassRelationInfo::getFlowCardId, bigStorageDTO.getFlowCardId()) |
| | | .eq(HollowGlassRelationInfo::getLayer, bigStorageDTO.getLayer()) |
| | | .eq(HollowGlassRelationInfo::getVirtualSlot, bigStorageDTO.getVirtualSlot()) |
| | | .eq(HollowGlassRelationInfo::getSlotSequence, bigStorageDTO.getSlotSequence()) |
| | | .eq(HollowGlassRelationInfo::getHollowSequence, bigStorageDTO.getHollowSequence()) |
| | | ); |
| | | } |
| | | } catch (Exception exception) { |
| | | log.info("进片任务执行中发生异常:{}", exception); |
| | | hollowGlassRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassRelationInfo>() |
| | | .set(HollowGlassRelationInfo::getGlassId, cageDetails.getGlassId()) |
| | | .set(HollowGlassRelationInfo::getTemperingLayoutId, cageDetails.getTemperingLayoutId()) |
| | | .set(HollowGlassRelationInfo::getTemperingFeedSequence, cageDetails.getTemperingFeedSequence()) |
| | | .set(HollowGlassRelationInfo::getEngineerId, cageDetails.getEngineerId()) |
| | | .eq(HollowGlassRelationInfo::getFlowCardId, bigStorageDTO.getFlowCardId()) |
| | | .eq(HollowGlassRelationInfo::getLayer, bigStorageDTO.getLayer()) |
| | | .eq(HollowGlassRelationInfo::getVirtualSlot, bigStorageDTO.getVirtualSlot()) |
| | | .eq(HollowGlassRelationInfo::getSlotSequence, bigStorageDTO.getSlotSequence()) |
| | | .eq(HollowGlassRelationInfo::getHollowSequence, bigStorageDTO.getHollowSequence()) |
| | | .set(HollowGlassRelationInfo::getGlassId, null) |
| | | .set(HollowGlassRelationInfo::getTemperingLayoutId, null) |
| | | .set(HollowGlassRelationInfo::getTemperingFeedSequence, null) |
| | | .set(HollowGlassRelationInfo::getEngineerId, null) |
| | | .set(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_NEW) |
| | | .eq(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_OCCUPY) |
| | | ); |
| | | } |
| | | //历史数据入库 |
| | |
| | | if (CollectionUtil.isNotEmpty(unFinishHollowQueueList)) { |
| | | log.info("有正在出片的中空任务"); |
| | | Integer isPair = unFinishHollowQueueList.get(0).getIsPair(); |
| | | hollowOutGlassByIsPair(unFinishHollowQueueList, hollowGlassOutRelationInfo.getCell(), isPair, hollowGlassOutRelationInfo.getTotalLayer(),hollowGlassOutRelationInfo.getIsForce()); |
| | | hollowOutGlassByIsPair(unFinishHollowQueueList, hollowGlassOutRelationInfo.getCell(), isPair, hollowGlassOutRelationInfo.getTotalLayer(), hollowGlassOutRelationInfo.getIsForce()); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | |
| | | int targetSlot = item.getSlot(); |
| | | list = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>() |
| | | .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN).eq(HollowBigStorageCageDetails::getSlot, startSlot)); |
| | | hollowOutGlassByIsPair(list, targetSlot, 0, 0,0); |
| | | hollowOutGlassByIsPair(list, targetSlot, 0, 0, 0); |
| | | List<Integer> slotList = new ArrayList<>(); |
| | | slotList.add(targetSlot); |
| | | updateSlotRemainBySlots(slotList); |
| | |
| | | hollowBigStorageCageDetailsService.updateBySlot(storageCageDTOList, Const.GLASS_STATE_IN); |
| | | log.info("4、大理片笼进片状态已完成已完成的玻璃信息id:{}", v); |
| | | updateSlotRemainBySlots(inSuccessGlassSlot); |
| | | List<String> glassList = v.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList()); |
| | | hollowGlassRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassRelationInfo>() |
| | | .set(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_SUCCESS) |
| | | .eq(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_OCCUPY) |
| | | .in(HollowGlassRelationInfo::getGlassId, glassList) |
| | | ); |
| | | } else if (e1 == 3) { |
| | | //破损处理 |
| | | dealDamageInTask(v); |
| | | List<String> glassList = v.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList()); |
| | | hollowGlassRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassRelationInfo>() |
| | | .set(HollowGlassRelationInfo::getGlassId, null) |
| | | .set(HollowGlassRelationInfo::getTemperingLayoutId, null) |
| | | .set(HollowGlassRelationInfo::getTemperingFeedSequence, null) |
| | | .set(HollowGlassRelationInfo::getEngineerId, null) |
| | | .set(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_NEW) |
| | | .eq(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_OCCUPY) |
| | | .in(HollowGlassRelationInfo::getGlassId, glassList) |
| | | ); |
| | | } else { |
| | | //清空理片笼空数据 |
| | | noDealInTask(v); |
| | | List<String> glassList = v.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList()); |
| | | hollowGlassRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassRelationInfo>() |
| | | .set(HollowGlassRelationInfo::getGlassId, null) |
| | | .set(HollowGlassRelationInfo::getTemperingLayoutId, null) |
| | | .set(HollowGlassRelationInfo::getTemperingFeedSequence, null) |
| | | .set(HollowGlassRelationInfo::getEngineerId, null) |
| | | .set(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_NEW) |
| | | .eq(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_OCCUPY) |
| | | .in(HollowGlassRelationInfo::getGlassId, glassList) |
| | | ); |
| | | } |
| | | }); |
| | | for (BigStorageCageTask item : inTaskList) { |
| | |
| | | try { |
| | | //更新数量 |
| | | //按照玻璃id获取需要出片对列表中的数据 |
| | | if(finalTaskType.equals(Const.BIG_STORAGE_AFTER_OUT) ){ |
| | | if (finalTaskType.equals(Const.BIG_STORAGE_AFTER_OUT)) { |
| | | HollowGlassQueueInfo hollowGlassQueueInfo = hollowGlassQueueInfoService.getOne(new LambdaQueryWrapper<HollowGlassQueueInfo>() |
| | | .eq(HollowGlassQueueInfo::getGlassId, outTaskList.get(0).getGlassId()) |
| | | .orderByDesc(HollowGlassQueueInfo::getUpdateTime).last("limit 1")); |
| | | List<HollowGlassQueueInfo> list = hollowGlassQueueInfoService.list(new LambdaQueryWrapper<HollowGlassQueueInfo>() |
| | | .eq(HollowGlassQueueInfo::getFlowCardId, hollowGlassQueueInfo.getFlowCardId()) |
| | | .eq(HollowGlassQueueInfo::getCell, hollowGlassQueueInfo.getCell()) |
| | | .eq(HollowGlassQueueInfo::getFlowCardId, hollowGlassQueueInfo.getFlowCardId()) |
| | | .eq(HollowGlassQueueInfo::getCell, hollowGlassQueueInfo.getCell()) |
| | | // .eq(HollowGlassQueueInfo::getIsPair, 1) |
| | | .eq(HollowGlassQueueInfo::getState, Const.TEMPERING_NEW) |
| | | .eq(HollowGlassQueueInfo::getState, Const.TEMPERING_NEW) |
| | | ); |
| | | if (CollectionUtil.isEmpty(list)){ |
| | | if (CollectionUtil.isEmpty(list)) { |
| | | // 任务更新为已完成 |
| | | hollowGlassOutRelationInfoService.update(new UpdateWrapper<HollowGlassOutRelationInfo>() |
| | | .eq("flow_card_id",hollowGlassQueueInfo.getFlowCardId()) |
| | | .eq("cell",hollowGlassQueueInfo.getCell()) |
| | | .eq("flow_card_id", hollowGlassQueueInfo.getFlowCardId()) |
| | | .eq("cell", hollowGlassQueueInfo.getCell()) |
| | | .setSql("pair_quantity = total_pair_quantity") |
| | | .set("state",Const.HOLLOW_FLOW_CARD_SUCCESS) |
| | | .set("state", Const.HOLLOW_FLOW_CARD_SUCCESS) |
| | | ); |
| | | }else{ |
| | | } else { |
| | | // 计算剩余玻璃对数,用任务总队数减剩余对数 |
| | | int remainCount = list.size() / hollowGlassQueueInfo.getTotalLayer(); |
| | | hollowGlassOutRelationInfoService.update(new UpdateWrapper<HollowGlassOutRelationInfo>() |
| | | .eq("flow_card_id",hollowGlassQueueInfo.getFlowCardId()) |
| | | .eq("cell",hollowGlassQueueInfo.getCell()) |
| | | .setSql("pair_quantity = total_pair_quantity -"+remainCount) |
| | | .eq("flow_card_id", hollowGlassQueueInfo.getFlowCardId()) |
| | | .eq("cell", hollowGlassQueueInfo.getCell()) |
| | | .setSql("pair_quantity = total_pair_quantity -" + remainCount) |
| | | ); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | log.info("计算玻璃数量过程中出现错误,错误信息{}",e.getMessage()); |
| | | } catch (Exception e) { |
| | | log.info("计算玻璃数量过程中出现错误,错误信息{}", e.getMessage()); |
| | | } |
| | | |
| | | // hollowGlassOutRelationInfoService.update |
| | |
| | | } |
| | | |
| | | |
| | | private <T extends HollowBigStorageCageBaseInfo> Boolean hollowOutGlassByIsPair(List<T> list, int targetSlot, int isPair, int totalLayer,int isForce) { |
| | | private <T extends HollowBigStorageCageBaseInfo> Boolean hollowOutGlassByIsPair(List<T> list, int targetSlot, int isPair, int totalLayer, int isForce) { |
| | | List<T> resultList = new ArrayList<>(); |
| | | List<T> tempList = new ArrayList<>(); |
| | | int taskType = Const.BIG_STORAGE_AFTER_OUT; |
| | |
| | | for (T t : list) { |
| | | if (isPair == (t.getIsPair() == null ? 0 : t.getIsPair())) { |
| | | tempList.add(t); |
| | | }else{ |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | if (isPair == 0 && isForce!=1) { |
| | | if (isPair == 0 && isForce != 1) { |
| | | taskType = Const.BIG_STORAGE_AFTER_DISPATCH; |
| | | taskState = Const.GLASS_STATE_SCHEDULE_ING; |
| | | resultList.add(list.get(0)); |
| | | //目前调度任务totalLayer为0 出片调度任务有层号,用于区分调度方式 |
| | | if (totalLayer !=0){ |
| | | if (totalLayer != 0) { |
| | | HollowBigStorageCage storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>() |
| | | .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth).last("limit 1")); |
| | | targetSlot = storageCage.getSlot(); |
| | | } |
| | | totalLayer = 0; |
| | | }else{ |
| | | } else { |
| | | resultList = tempList; |
| | | } |
| | | return computeOutGlassInfo(resultList, BIG_STORAGE_CAGE_OUT_TWO_TASK, targetSlot, taskState, taskType, totalLayer,isForce); |
| | | return computeOutGlassInfo(resultList, BIG_STORAGE_CAGE_OUT_TWO_TASK, targetSlot, taskState, taskType, totalLayer, isForce); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param totalLayer |
| | | * @return |
| | | */ |
| | | private <T extends HollowBigStorageCageBaseInfo> Boolean computeOutGlassInfo(List<T> list, String tableName, int targetSlot, int state, int taskType, int totalLayer,int isForce) { |
| | | private <T extends HollowBigStorageCageBaseInfo> Boolean computeOutGlassInfo(List<T> list, String tableName, int targetSlot, int state, int taskType, int totalLayer, int isForce) { |
| | | //任务数据:获取车子存放玻璃最大数量,玻璃间隔 |
| | | List<BigStorageCageTask> tempList = new ArrayList<>(); |
| | | List<T> tempTList = new ArrayList<>(); |
| | |
| | | Assert.isFalse(CollectionUtil.isEmpty(tempList), "未获取出片数据,结束出片任务"); |
| | | log.info("获取出片任务数据{}条,执行保存", tempList.size()); |
| | | List<BigStorageCageTask> bigStorageCageTaskList = tempList; |
| | | if (1!= isForce){ |
| | | if (1 != isForce) { |
| | | if (taskType == Const.BIG_STORAGE_AFTER_OUT) { |
| | | if (tempList.size() <= totalLayer) { |
| | | bigStorageCageTaskList = tempList; |
| | | } else { |
| | | int remainCount = tempList.size() % totalLayer; |
| | | bigStorageCageTaskList = tempList.subList(0,tempList.size() - remainCount); |
| | | bigStorageCageTaskList = tempList.subList(0, tempList.size() - remainCount); |
| | | } |
| | | } |
| | | } |