| | |
| | | package com.mes.downglassinfo.service.impl; |
| | | |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.smallbun.screw.core.util.CollectionUtils; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | import com.mes.downglassinfo.service.DownGlassInfoService; |
| | | import com.mes.downstorage.entity.DownStorageCageDetails; |
| | | import com.mes.downstorage.service.DownStorageCageDetailsService; |
| | | import com.mes.downworkstation.entity.DownWorkstation; |
| | | import com.mes.downworkstation.entity.dto.DownGlassInfoDTO; |
| | | import com.mes.downworkstation.service.DownWorkstationService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.job.DownLoadCacheGlassTask; |
| | | import com.mes.pp.service.FlowCardService; |
| | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class DownGlassInfoServiceImpl extends ServiceImpl<DownGlassInfoMapper, DownGlassInfo> implements DownGlassInfoService { |
| | |
| | | |
| | | @Autowired |
| | | DownStorageCageDetailsService downStorageCageDetailsService; |
| | | |
| | | |
| | | @Autowired |
| | | DownWorkstationService downWorkstationService; |
| | | |
| | | @Autowired |
| | | RedisUtil redisUtil; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<DownGlassInfoDTO> queryWorkStationIsIn(Boolean isDownload) { |
| | | return baseMapper.queryWorkStationIsIn(isDownload); |
| | | public List<DownGlassInfoDTO> queryWorkStationIsIn(List<Integer> workList, Boolean isDownload) { |
| | | //按照要求获取已落架/未落架的玻璃信息 |
| | | return baseMapper.queryWorkStationIsIn(workList, isDownload); |
| | | } |
| | | |
| | | @Override |
| | | public List<DownGlassInfoDTO> queryWorkStationFlowCard(List<Integer> workList) { |
| | | //获取已绑定流程卡的架子未落玻璃的数据信息 |
| | | return baseMapper.queryWorkStationFlowCard(workList); |
| | | } |
| | | |
| | | @Override |
| | |
| | | BeanUtils.copyProperties(details, downGlassInfo); |
| | | //获取当前流程卡最大片序 |
| | | downGlassInfo.setSequence(this.getMaxSequenceByFlowCardId(details.getFlowCardId(), details.getLayer()) + 1); |
| | | downGlassInfo.setWorkStationId(Const.G13_WORK_STATION); |
| | | this.save(downGlassInfo); |
| | | //生成任务信息 并向plc发送出片任务 |
| | | GlassInfo glassInfo = new GlassInfo(); |
| | |
| | | } |
| | | return "success"; |
| | | } |
| | | |
| | | @Override |
| | | public List<DownWorkstation> queryWorkStationIsFull() { |
| | | //查询可以落架的玻璃信息且已绑定流程卡的工位信息 |
| | | List<DownWorkstation> list = downWorkstationService.list(new LambdaQueryWrapper<DownWorkstation>().eq(DownWorkstation::getEnableState, Const.SLOT_ON) |
| | | .isNotNull(DownWorkstation::getFlowCardId).ne(DownWorkstation::getFlowCardId, "")); |
| | | List<DownWorkstation> workstationFull = new ArrayList<>(); |
| | | if (CollectionUtils.isNotEmpty(list)) { |
| | | //都有玻璃的工位信息(包括绑定流程卡) |
| | | List<Integer> workstationList = list.stream().map(DownWorkstation::getWorkstationId).collect(Collectors.toList()); |
| | | //按照符合条件的工位获取未落架的流程卡玻璃,如果返回为空,则表明所有都已落架完成 |
| | | List<DownGlassInfoDTO> downGlassInfoDTOList = queryWorkStationIsIn(workstationList, Boolean.FALSE); |
| | | //获取工位上的未满的流程卡及层数 |
| | | List<String> flowCardIdList = downGlassInfoDTOList.stream().map(item -> item.getFlowCardId() + ":" + item.getLayer()).collect(Collectors.toList()); |
| | | //可以落架的玻璃信息且已绑定流程卡的所有的工位 - 玻璃未满流程卡及层数的工位 = 已满工位 |
| | | workstationFull = list.stream().filter(item -> !flowCardIdList.contains(item.getFlowCardId() + ":" + item.getLayer())).collect(Collectors.toList()); |
| | | //是否需要将已满的工位置为不可落架 |
| | | if (CollectionUtils.isNotEmpty(workstationFull)) { |
| | | List<Integer> workstationIds = workstationFull.stream().map(DownWorkstation::getWorkstationId).collect(Collectors.toList()); |
| | | downWorkstationService.update(new LambdaUpdateWrapper<DownWorkstation>().set(DownWorkstation::getEnableState, Const.SLOT_OFF) |
| | | .in(DownWorkstation::getWorkstationId, workstationIds)); |
| | | } |
| | | } |
| | | return workstationFull; |
| | | }@Override |
| | | public List<Map<String, List<Map<String, Object>>>> downGlassPrint(DownGlassInfo downGlassInfo){ |
| | | QueryWrapper<DownGlassInfo> queryWrapper = Wrappers.query(); |
| | | queryWrapper.eq("flow_card_id", "NG24080012A001") |
| | |
| | | listMap.add(result); |
| | | return listMap; |
| | | } |
| | | |
| | | } |