File was renamed from JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/PLCScanQR.java |
| | |
| | | package com.mes.job; |
| | | import cn.hutool.json.JSONObject; |
| | | import com.mes.common.S7object; |
| | | import com.mes.md.entity.Machine; |
| | | import com.mes.md.entity.Tasking; |
| | | import com.mes.md.mapper.MachineMapper; |
| | | import com.mes.md.service.TaskingService; |
| | | import com.mes.tools.WebSocketServer; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import com.mes.device.PlcParameterObject; |
| | | |
| | |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class PLCScanQR { |
| | | public class PLCScanQrCodesReport { |
| | | |
| | | PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; |
| | | @Autowired |
| | | TaskingService taskingService; |
| | | @Autowired |
| | | MachineMapper machineMapper; |
| | | //@Scheduled(fixedDelay = 500) |
| | | public void pLCScanQR() { |
| | | //获取当前任务表最新的一块任务状态 |
| | |
| | | } |
| | | |
| | | } |
| | | //@Scheduled(fixedDelay = 1000) |
| | | // @Scheduled(fixedDelay = 1000) |
| | | public void scanQrCode() { |
| | | //获取当前任务表最新的一块任务状态 |
| | | //获取报警状态 |
| | | String warning = plcParameterObject.getPlcParameter("warning").getValue(); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | if (!Objects.equals(warning, "0")) { |
| | | //log.info("报警信息:"+warning); |
| | | jsonObject.append("warning", warning); |
| | | } |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("scanQrCode"); |
| | | //获取报警状态 |
| | | // String warning = plcParameterObject.getPlcParameter("warning").getValue(); |
| | | |
| | | // if (!Objects.equals(warning, "0")) { |
| | | // //log.info("报警信息:"+warning); |
| | | // jsonObject.append("warning", warning); |
| | | // } |
| | | Machine machine=machineMapper.selectById(25L); |
| | | List<Tasking> taskingList=taskingService.findMachineTask(machine); |
| | | jsonObject.append("taskingList", taskingList); |
| | | jsonObject.append("machine", machine); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("scanQrCodesReport"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |