| | |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.edgglasstask.entity.EdgGlassTaskInfo; |
| | | import com.mes.edgglasstask.service.EdgGlassTaskInfoService; |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.engineering.mapper.EngineeringMapper; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | |
| | | private TemperingGlassInfoService temperingGlassInfoService; |
| | | @Resource |
| | | private DamageService damageService; |
| | | @Resource |
| | | private EngineeringMapper engineeringMapper; |
| | | |
| | | @Resource |
| | | private RedisUtil redisUtil; |
| | |
| | | String d04ToMES = plcParameterObject.getPlcParameter("D04ToMES").getValue(); |
| | | |
| | | |
| | | // d01Id="P25010108|37|8"; |
| | | // d01Id="P25031806|15|3"; |
| | | // d04ToMES="1"; |
| | | // d01ToMES="1"; |
| | | |
| | |
| | | .isNull(BigStorageCageOutTask::getGlassId) |
| | | .orderBy(Boolean.TRUE, sequenceOrder, TemperingGlassInfo::getTemperingFeedSequence)); |
| | | log.info("查询的出片任务:{}", temperingGlassInfoList); |
| | | List<String> glassIds = temperingGlassInfoList.stream().map(TemperingGlassInfo::getGlassId).collect(Collectors.toList()); |
| | | List<BigStorageCageDetails> bigStorageCageDetailsList = bigStorageCageDetailsService.list( |
| | | new LambdaQueryWrapper<BigStorageCageDetails>() |
| | | .in(BigStorageCageDetails::getGlassId, glassIds) |
| | | .in(BigStorageCageDetails::getState, Const.GLASS_STATE_OUT) |
| | | ); |
| | | if (CollectionUtils.isNotEmpty(temperingGlassInfoList)) { |
| | | List<String> detialGlassIds = bigStorageCageDetailsList.stream().map(BigStorageCageDetails::getGlassId).collect(Collectors.toList()); |
| | | temperingGlassInfoList.removeIf(info -> detialGlassIds.contains(info.getGlassId())); |
| | | log.info("笼内不存在玻璃的钢化任务{}", bigStorageCageDetailsList); |
| | | } |
| | | if (CollectionUtils.isNotEmpty(temperingGlassInfoList)) { |
| | | log.info("有正在出片的钢化任务"); |
| | | computeOutMoreGlassInfo(temperingGlassInfoList, Boolean.TRUE, 1); |
| | |
| | | //到齐,将玻璃小片数据存入钢化小片表,逻辑生成出片任务 结束 |
| | | for (TemperingLayoutDTO item : temperingLayoutDTOList) { |
| | | if (redisUtil.getCacheObject("temperingengineerId").equals(item.getEngineerId())) { |
| | | Engineering engineering = engineeringMapper.selectOne( |
| | | new LambdaQueryWrapper<Engineering>() |
| | | .eq(Engineering::getEngineerId, item.getEngineerId()) |
| | | ); |
| | | if (engineering.getState() == 2) { |
| | | redisUtil.setCacheObject("temperingengineerId", ""); |
| | | Date endDate = new Date(); |
| | | log.info("当前工程被禁止生产,大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | | } |
| | | List<TemperingGlassInfo> temperingGlassInfos = glassInfoService.selectJoinList(TemperingGlassInfo.class, JoinWrappers.lambda(GlassInfo.class) |
| | | .selectAll(GlassInfo.class) |
| | | .select("-1 as state") |
| | |
| | | } |
| | | Assert.isFalse(CollectionUtils.isEmpty(bigStorageCageOutTaskList), "未获取出片数据,结束出片任务"); |
| | | log.info("获取出片任务数据{}条,执行保存", bigStorageCageOutTaskList.size()); |
| | | List<String> outGlassIds = bigStorageCageOutTaskList.stream() |
| | | .map(BigStorageCageOutTask::getGlassId) |
| | | .collect(Collectors.toList()); |
| | | //判断工程变更时修改出片位置 |
| | | List<GlassInfo> glassInfos = glassInfoService.list( |
| | | new LambdaQueryWrapper<GlassInfo>() |
| | | .in(GlassInfo::getGlassId, outGlassIds) |
| | | .eq(GlassInfo::getProductionStatus, 3) |
| | | ); |
| | | if (CollectionUtils.isNotEmpty(glassInfos)) { |
| | | List<String> changeGlassIds = glassInfos.stream() |
| | | .map(GlassInfo::getGlassId) |
| | | .collect(Collectors.toList()); |
| | | bigStorageCageOutTaskList.forEach(task -> { |
| | | if (changeGlassIds.contains(task.getGlassId())) { |
| | | task.setEndSlot(Const.ARTIFICIAL_OUT_TARGET_POSITION); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | bigStorageCageOutTaskService.saveBatch(bigStorageCageOutTaskList); |
| | | List<String> glassIds = bigStorageCageOutTaskList.stream().map(BigStorageCageOutTask::getGlassId).collect(Collectors.toList()); |
| | | log.info("将出片玻璃{}玻璃状态改为已出片", glassIds); |