| | |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | String confirmationWrodValue = plcParameterObject.getPlcParameter("confirmationWord").getValue(); |
| | | String confirmationWrodAddress = plcParameterObject.getPlcParameter("confirmationWord").getAddress(); |
| | | String currentSlot = plcParameterObject.getPlcParameter("currentCell").getValue(); |
| | | |
| | | |
| | | |
| | | log.info("1、获取到的请求字为:{},获取到的扫描ID为:{},获取到的确认字为:{},获取到的出片状态分别为:g06:{}、g08:{}、g11:{}、g13:{},当前格子号为:{}", |
| | |
| | | endLoop: |
| | | for (DownGlassInfoDTO e : downGlassInfoDTOList) { |
| | | List<GlassInfo> glassInfoList = e.getGlassInfoList(); |
| | | for (GlassInfo item : glassInfoList) { |
| | | if (item.getWidth() == glassInfo.getWidth() && item.getHeight() == glassInfo.getHeight() |
| | | && item.getThickness() == glassInfo.getThickness() && item.getFilmsid().equals(glassInfo.getFilmsid())) { |
| | | //玻璃是否为多层 |
| | | checkFlag = multilayerCheck(item, Boolean.FALSE); |
| | | if (checkFlag) { |
| | | //玻璃替换 仅替换流程卡id及层数 |
| | | String tempFlowCardId = item.getFlowCardId(); |
| | | Integer tempLayer = item.getLayer(); |
| | | String flowCardId = glassInfo.getFlowCardId(); |
| | | Integer layer = glassInfo.getLayer(); |
| | | log.info("替换流程卡信息,当前玻璃信息:{}的流程卡号{}及层数{},替换后玻璃信息:{}的流程卡号{}及层数{}", |
| | | item, glassInfo, flowCardId, layer, tempFlowCardId, tempLayer); |
| | | glassInfo.setFlowCardId(tempFlowCardId); |
| | | glassInfo.setLayer(tempLayer); |
| | | glassInfoService.updateById(glassInfo); |
| | | item.setFlowCardId(flowCardId); |
| | | item.setLayer(layer); |
| | | glassInfoService.updateById(item); |
| | | break endLoop; |
| | | } |
| | | Optional<GlassInfo> glassInfoTempOptional = glassInfoList.stream().filter(item -> item.getWidth() == glassInfo.getWidth() && item.getHeight() == glassInfo.getHeight() |
| | | && item.getThickness() == glassInfo.getThickness() && item.getFilmsid().equals(glassInfo.getFilmsid())) |
| | | .findFirst(); |
| | | if (glassInfoTempOptional.isPresent()) { |
| | | GlassInfo item = glassInfoTempOptional.get(); |
| | | //玻璃是否为多层 |
| | | checkFlag = multilayerCheck(item, Boolean.FALSE); |
| | | if (checkFlag) { |
| | | //玻璃替换 仅替换流程卡id及层数 |
| | | String tempFlowCardId = item.getFlowCardId(); |
| | | Integer tempLayer = item.getLayer(); |
| | | String flowCardId = glassInfo.getFlowCardId(); |
| | | Integer layer = glassInfo.getLayer(); |
| | | log.info("替换流程卡信息,当前玻璃信息:{}的流程卡号{}及层数{},替换后玻璃信息:{}的流程卡号{}及层数{}", |
| | | item, glassInfo, flowCardId, layer, tempFlowCardId, tempLayer); |
| | | glassInfo.setFlowCardId(tempFlowCardId); |
| | | glassInfo.setLayer(tempLayer); |
| | | glassInfoService.updateById(glassInfo); |
| | | item.setFlowCardId(flowCardId); |
| | | item.setLayer(layer); |
| | | glassInfoService.updateById(item); |
| | | break endLoop; |
| | | } |
| | | } |
| | | } |
| | |
| | | downStorageCageDetails.setState(Const.GLASS_STATE_IN); |
| | | downStorageCageDetails.setSlot(nearestEmpty.getSlot()); |
| | | downStorageCageDetailsService.save(downStorageCageDetails); |
| | | // 生成进片任务 |
| | | |
| | | // 生成进片任务 |
| | | initDownGlassTask(glassInfo, 0, nearestEmpty.getSlot(), Const.GLASS_CACHE_TYPE_IN); |
| | | } |
| | | |
| | | public Boolean outTo(String glassStatus06, String out08Glassstate, String glassStatus11, String glassStatus13, String glassId, String currentSlot) { |
| | | public Boolean outTo(String glassStatus06, String out08Glassstate, String glassStatus11, String |
| | | glassStatus13, String glassId, String currentSlot) { |
| | | if ("2".equals(glassStatus06) && "2".equals(glassStatus11) && "2".equals(glassStatus13)) { |
| | | log.info("G06、G11、G13分别为{},{}、{}非自动状态,无法出片", glassStatus06, glassStatus11, glassStatus13); |
| | | return Boolean.FALSE; |
| | |
| | | } |
| | | } |
| | | |
| | | private Boolean generateTaskByShelf(String glassStatus06, String glassStatus11, Boolean flag08, String glassStatus13, List<DownStorageCageDetails> tempList, DownStorageCageDetails cageDetails, String glassId) { |
| | | private Boolean generateTaskByShelf(String glassStatus06, String glassStatus11, Boolean flag08, String |
| | | glassStatus13, List<DownStorageCageDetails> tempList, DownStorageCageDetails cageDetails, String glassId) { |
| | | //获取2个机械臂范围内的架子绑定的流程卡信息 |
| | | List<Integer> workList = new ArrayList(); |
| | | |
| | |
| | | if (CollectionUtils.isNotEmpty(workList)) { |
| | | List<DownWorkstation> downWorkstationList = downWorkstationService.list(new LambdaQueryWrapper<DownWorkstation>() |
| | | .eq(DownWorkstation::getEnableState, Const.SLOT_ON).in(DownWorkstation::getWorkstationId, workList)); |
| | | log.info("架子被禁用,无法出片落架"); |
| | | // log.info("架子被禁用,无法出片落架"); |
| | | if (CollectionUtils.isEmpty(downWorkstationList)) { |
| | | log.info("笼子被禁用,无法走机械臂下片"); |
| | | //走人工下片 |
| | |
| | | } |
| | | } |
| | | |
| | | public Boolean generateDownGlassOutTask(String glassId, Integer taskType, Boolean isBind, DownStorageCageDetails cageDetails) { |
| | | public Boolean generateDownGlassOutTask(String glassId, Integer taskType, Boolean |
| | | isBind, DownStorageCageDetails cageDetails) { |
| | | //按玻璃id获取玻璃信息 |
| | | DownStorageCageDetails downStorageCageDetails = null; |
| | | if (glassId.equals(cageDetails.getGlassId())) { |
| | |
| | | taskType = 3; |
| | | } else { |
| | | downStorageCageDetails = downStorageCageDetailsService.getOne(new LambdaQueryWrapper<DownStorageCageDetails>() |
| | | .eq(DownStorageCageDetails::getGlassId, glassId)); |
| | | .eq(DownStorageCageDetails::getGlassId, glassId).eq(DownStorageCageDetails::getState, Const.GLASS_STATE_IN)); |
| | | } |
| | | |
| | | Integer endCell = null; |
| | | if (isBind) { |
| | | if (!isBind) { |
| | | //获取空架子信息,将空架子信息绑定流程卡 |
| | | DownWorkstation emptyDownWorkstation = downWorkstationService.getOne(new LambdaQueryWrapper<DownWorkstation>() |
| | | .isNull(DownWorkstation::getFlowCardId).orderByDesc(DownWorkstation::getWorkstationId).last("limit 1")); |
| | |
| | | //生成任务信息 |
| | | DownGlassInfo downGlassInfo = new DownGlassInfo(); |
| | | BeanUtils.copyProperties(downStorageCageDetails, downGlassInfo); |
| | | //todo:落架片序 |
| | | downGlassInfo.setSequence(downGlassInfoService.queryMaxSequence(downGlassInfo.getFlowCardId(), downGlassInfo.getLayer())); |
| | | downGlassInfoService.save(downGlassInfo); |
| | | //生成任务信息 |
| | | GlassInfo glassInfo = new GlassInfo(); |
| | |
| | | startCell, endCell, taskType); |
| | | } |
| | | |
| | | private Boolean sendMessageToPlc(int width, int height, int thickness, int startCell, int endCell, int taskType) { |
| | | private Boolean sendMessageToPlc(int width, int height, int thickness, int startCell, int endCell, |
| | | int taskType) { |
| | | S7control s7control = S7object.getinstance().plccontrol; |
| | | PlcParameterObject plcMesObject = S7object.getinstance().PlcMesObject; |
| | | s7control.writeWord(plcMesObject.getPlcParameter("Glass_width").getAddress(), width); |