| | |
| | | */ |
| | | @RequestMapping("/task/sync/v1") |
| | | public R taskSync(@RequestBody TaskReportParam param) { |
| | | if (param == null || param.getSeqNum() == null || param.getQrCode() == null) { |
| | | if (param == null || param.getSeqNum() == null) { |
| | | return R.error("参数为空"); |
| | | } |
| | | if ((param.getQrCode().equals("00001547") || param.getQrCode().equals("1001")) && param.getTaskSts() == 15) { |
| | | if (param.getTaskSts() == 15 && (param.getQrCode().equals("00001547") || param.getQrCode().equals("1001"))) { |
| | | log.info("1001任务状态上报接收:{}", param); |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | Map<Integer, StaProtocol> station = devpThread.getStation(); |
| | |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | if (!staProtocol.isLoading()) { |
| | | return R.error("站点无物"); |
| | | } |
| | | Random rand = new Random(); |
| | | staProtocol.setWorkNo(rand.nextInt(1000)); |
| | | staProtocol.setStaNo((short) 1004); |
| | |
| | | if (result) { |
| | | log.info("下发成功:{},{}", staProtocol.getWorkNo(), 1004); |
| | | } |
| | | } else if (param.getQrCode().equals("00001612") && param.getTaskSts() == 5) { |
| | | } else if (param.getTaskSts() == 5) { |
| | | log.info("1007任务状态上报接收:{}", param); |
| | | |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | Map<Integer, StaProtocol> station = devpThread.getStation(); |
| | | StaProtocol staProtocol = station.get(1007); |
| | | if (staProtocol == null) { |
| | | return R.error("未找到站点"); |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, 1, new Task(3, staProtocol)); |
| | | if (result) { |
| | | log.info("下发成功:{},{}", staProtocol.getWorkNo(), 1007); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |