| | |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import com.mes.common.S7object; |
| | | import com.mes.common.WebSocketServer; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.engineering.service.EngineeringService; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | import com.mes.pp.service.OptimizeProjectService; |
| | | import com.mes.tools.WebSocketServer; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.uppattenusage.service.UpPattenUsageService; |
| | | import com.mes.workstation.entity.UpWorkstation; |
| | |
| | | * fixedDelay : 上一个调用结束后再次调用的延时 |
| | | */ |
| | | |
| | | @Scheduled(fixedDelay = 30000000) |
| | | @Scheduled(fixedDelay = 300) |
| | | public void plcLoadGlassTask() throws InterruptedException { |
| | | try { |
| | | //获取是否有上片请求 |
| | |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 30000000) |
| | | @Scheduled(fixedDelay = 300) |
| | | public void plcLoadGlassReport(){ |
| | | //获取是否有汇报 |
| | | String loadStatus = plcParameterObject.getPlcParameter("PlcStatus").getValue(); |
| | |
| | | } |
| | | } |
| | | |
| | | // @Scheduled(fixedDelay = 300) |
| | | // public void loadGlassHome(){ |
| | | // JSONObject jsonObject = new JSONObject(); |
| | | // //正在进行的任务 |
| | | // List<UpPattenUsage> upPattenUsages = upPattenUsageService.prioritylist(); |
| | | // jsonObject.append("prioritylist", upPattenUsages); |
| | | // //工位信息 |
| | | // List<UpWorkstation> upWorkstations = upWorkstationService.list(); |
| | | // jsonObject.append("list", upWorkstations); |
| | | // ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("returns"); |
| | | // if (sendwServer != null) { |
| | | // for (WebSocketServer webserver : sendwServer) { |
| | | // if (webserver != null) { |
| | | // webserver.sendMessage(jsonObject.toString()); |
| | | // List<String> messages = webserver.getMessages(); |
| | | // if (!messages.isEmpty()) { |
| | | // // // 将最后一个消息转换为整数类型的列表 |
| | | // webserver.clearMessages(); |
| | | // } |
| | | // } else { |
| | | // log.info("Home is closed"); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | @Scheduled(fixedDelay = 300) |
| | | public void loadGlassHome(){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //正在进行的任务 |
| | | List<UpPattenUsage> upPattenUsages = upPattenUsageService.prioritylist(); |
| | | jsonObject.append("prioritylist", upPattenUsages); |
| | | //工位信息 |
| | | List<UpWorkstation> upWorkstations = upWorkstationService.list(); |
| | | jsonObject.append("list", upWorkstations); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("loadGlass"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | List<String> messages = webserver.getMessages(); |
| | | if (!messages.isEmpty()) { |
| | | // // 将最后一个消息转换为整数类型的列表 |
| | | webserver.clearMessages(); |
| | | } |
| | | } else { |
| | | log.info("Home is closed"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void overTask(String loadStatus, int state) { |
| | | |