| | |
| | | package com.mes.downstorage.service.impl; |
| | | |
| | | import com.github.yulichang.query.MPJQueryWrapper; |
| | | import com.mes.common.PLCAutoMes; |
| | | import com.mes.common.S7control; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.downglassinfo.entity.DownGlassTask; |
| | | import com.mes.downglassinfo.service.DownGlassTaskService; |
| | | import com.mes.downstorage.entity.DownStorageCage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.downstorage.entity.DownStorageCageDetails; |
| | | import com.mes.downstorage.mapper.DownStorageCageDetailsMapper; |
| | | import com.mes.downstorage.mapper.DownStorageCageMapper; |
| | | import com.mes.downstorage.service.DownStorageCageService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.tools.WebSocketServer; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | public class DownStorageCageServiceImpl extends ServiceImpl<DownStorageCageMapper, DownStorageCage> implements DownStorageCageService { |
| | | @Autowired |
| | | private DownStorageCageMapper downStorageCageMapper; |
| | | |
| | | @Autowired |
| | | private GlassInfoService glassInfoService; |
| | | @Autowired |
| | | private DownStorageCageService downStorageCageService; |
| | | @Autowired |
| | | private DownGlassTaskService downGlassTaskService; |
| | | @Override |
| | | public List<Map> gettask(){ |
| | | downStorageCageMapper.selectList(null); |
| | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public boolean processInto(String Number) { |
| | | glassInfoService = WebSocketServer.applicationContext.getBean(GlassInfoService.class); |
| | | downStorageCageService = WebSocketServer.applicationContext.getBean(DownStorageCageService.class); |
| | | |
| | | //按id查询玻璃信息表里的玻璃 |
| | | GlassInfo GlassInfo = glassInfoService.selectGlassId(Number); |
| | | PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; |
| | | //存在此玻璃编号 |
| | | if (GlassInfo != null) { |
| | | //同找到同流程卡附近空格 |
| | | List<DownStorageCageDetails> list = downStorageCageService.getIsExistIntoCacheByflowcardid(GlassInfo.getFlowcardId(), GlassInfo.getWidth()); |
| | | if (list.size() > 0) { |
| | | //存在空格 |
| | | //1.生成任务: 起始位置0 结束位置this.slot 任务类型 1 (进片任务) |
| | | //2.回复 1进片 |
| | | DownStorageCageDetails item = list.get(0); |
| | | |
| | | //selectInfo.insertCacheTask(GlassInfo.getId() + "", "0", item.getSlot() + "", "1", GlassInfo.getWidth(), GlassInfo.getHeight(), GlassInfo.getFilmsid(), GlassInfo.getThickness(), GlassInfo.getFlowcardId()); |
| | | |
| | | DownGlassTask downGlassTask = new DownGlassTask(); |
| | | downGlassTask.setId(GlassInfo.getId()); // 设置玻璃ID |
| | | downGlassTask.setStartCell("0"); |
| | | downGlassTask.setTaskType("1"); |
| | | downGlassTask.setEndCell(item.getSlot()+""); |
| | | downGlassTask.setWidth(GlassInfo.getWidth()); // 设置玻璃宽度 |
| | | downGlassTask.setHeight(GlassInfo.getHeight()); // 设置玻璃高度 |
| | | downGlassTask.setFilmsid(GlassInfo.getFilmsid()+""); // 设置膜ID |
| | | downGlassTask.setThickness(GlassInfo.getThickness()); // 设置玻璃厚度 |
| | | downGlassTask.setFlowCardId(GlassInfo.getFlowcardId()); // 设置流程卡号 |
| | | downGlassTaskService.insertCacheTask(downGlassTask); |
| | | |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1); |
| | | |
| | | |
| | | //完成后插入小片数据到缓存表 |
| | | return true; |
| | | } |
| | | |
| | | } else { |
| | | // ID编号不存在 不处理/回复PLC 进行报警提示 |
| | | } |
| | | //返回结果 |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 理片 出 |
| | | * @return |
| | | */ |
| | | // |
| | | @Override |
| | | public boolean processOut() { |
| | | // 查询任务 |
| | | |
| | | |
| | | PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; |
| | | |
| | | List<DownStorageCageDetails> list = downStorageCageService.getCacheOut(1, 5); |
| | | List<DownStorageCageDetails> list2 = downStorageCageService.getCacheOut(6, 10); |
| | | List<DownStorageCageDetails> list3 = downStorageCageService.getCacheOut(1, 10); |
| | | //自动绑定架子 |
| | | |
| | | |
| | | |
| | | // 优先 超出尺寸优先人工出片 人工处理 |
| | | |
| | | if (!list3.isEmpty()) { |
| | | DownStorageCageDetails item3 = list3.get(0); |
| | | if (item3.getHeight() >= 1 && item3.getWidth() >= 1) { |
| | | |
| | | String endcell = "13"; |
| | | String SendEndcell = "1"; |
| | | |
| | | // selectInfo.insertCacheTask(item3.getGlassId() + "", "0", endcell, "2", item3.getWidth(), item3.getHeight(), item3.getFilmsid(), item3.getThickness(), item3.getFlowCardId()); |
| | | |
| | | DownGlassTask downGlassTask = new DownGlassTask(); |
| | | downGlassTask.setId(item3.getId()); // 设置玻璃ID |
| | | downGlassTask.setStartCell("0"); |
| | | downGlassTask.setEndCell(endcell); |
| | | downGlassTask.setTaskType("2"); |
| | | downGlassTask.setWidth(item3.getWidth()); // 设置玻璃宽度 |
| | | downGlassTask.setHeight(item3.getHeight()); // 设置玻璃高度 |
| | | downGlassTask.setFilmsid(item3.getFilmsid()+""); // 设置膜ID |
| | | downGlassTask.setThickness(item3.getThickness()); // 设置玻璃厚度 |
| | | downGlassTask.setFlowCardId(item3.getFlowCardId()); // 设置流程卡号 |
| | | downGlassTaskService.insertCacheTask(downGlassTask); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), SendEndcell); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | |
| | | //同时请求 优先后端出片 |
| | | else if (!list3.isEmpty()) { |
| | | DownStorageCageDetails item3 = list3.get(0); |
| | | String endcell = "11"; |
| | | String SendEndcell = "1"; |
| | | // selectInfo.insertCacheTask(item3.getGlassId() + "", "0", endcell, "2", item3.getWidth(), item3.getHeight(), item3.getFilmsid(), item3.getThickness(), item3.getFlowCardId()); |
| | | DownGlassTask downGlassTask = new DownGlassTask(); |
| | | downGlassTask.setId(item3.getId()); // 设置玻璃ID |
| | | downGlassTask.setStartCell("0"); |
| | | downGlassTask.setEndCell(endcell); |
| | | downGlassTask.setTaskType("2"); |
| | | downGlassTask.setWidth(item3.getWidth()); // 设置玻璃宽度 |
| | | downGlassTask.setHeight(item3.getHeight()); // 设置玻璃高度 |
| | | downGlassTask.setFilmsid(item3.getFilmsid()+""); // 设置膜ID |
| | | downGlassTask.setThickness(item3.getThickness()); // 设置玻璃厚度 |
| | | downGlassTask.setFlowCardId(item3.getFlowCardId()); // 设置流程卡号 |
| | | downGlassTaskService.insertCacheTask(downGlassTask); |
| | | |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), SendEndcell); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); |
| | | return true; |
| | | |
| | | } |
| | | // 按照大小符合前端出片 |
| | | else if (!list.isEmpty()) { |
| | | DownStorageCageDetails item = list.get(0); |
| | | |
| | | // 出到 G06 |
| | | //selectInfo.insertCacheTask(item.getGlassId() + "", "0", "06", "2", item.getWidth(), item.getHeight(), item.getFilmsid(), item.getThickness(), item.getFlowCardId()); |
| | | DownGlassTask downGlassTask = new DownGlassTask(); |
| | | downGlassTask.setId(item.getId()); // 设置玻璃ID |
| | | downGlassTask.setStartCell("0"); |
| | | downGlassTask.setEndCell("06"); |
| | | downGlassTask.setTaskType("2"); |
| | | downGlassTask.setWidth(item.getWidth()); // 设置玻璃宽度 |
| | | downGlassTask.setHeight(item.getHeight()); // 设置玻璃高度 |
| | | downGlassTask.setFilmsid(item.getFilmsid()+""); // 设置膜ID |
| | | downGlassTask.setThickness(item.getThickness()); // 设置玻璃厚度 |
| | | downGlassTask.setFlowCardId(item.getFlowCardId()); // 设置流程卡号 |
| | | downGlassTaskService.insertCacheTask(downGlassTask); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), "1"); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); |
| | | return true; |
| | | |
| | | // 按照顺序符合后端出片 |
| | | } else if (!list2.isEmpty()) { |
| | | DownStorageCageDetails item2 = list2.get(0); |
| | | |
| | | // 出到 G11 |
| | | // selectInfo.insertCacheTask(item2.getGlassId() + "", "0", "11", "2", item2.getWidth(), item2.getHeight(), item2.getFilmsid(), item2.getThickness(), item2.getFlowCardId()); |
| | | DownGlassTask downGlassTask = new DownGlassTask(); |
| | | downGlassTask.setId(item2.getId()); // 设置玻璃ID |
| | | downGlassTask.setStartCell("0"); |
| | | downGlassTask.setEndCell("11"); |
| | | downGlassTask.setTaskType("2"); |
| | | downGlassTask.setWidth(item2.getWidth()); // 设置玻璃宽度 |
| | | downGlassTask.setHeight(item2.getHeight()); // 设置玻璃高度 |
| | | downGlassTask.setFilmsid(item2.getFilmsid()+""); // 设置膜ID |
| | | downGlassTask.setThickness(item2.getThickness()); // 设置玻璃厚度 |
| | | downGlassTask.setFlowCardId(item2.getFlowCardId()); // 设置流程卡号 |
| | | downGlassTaskService.insertCacheTask(downGlassTask); |
| | | |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), "2"); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); |
| | | return true; |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | // 返回结果 |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | |