| | |
| | | CommandInfoLogService commandInfoLogService = SpringUtils.getBean(CommandInfoLogService.class); |
| | | CommandInfoService commandInfoService = SpringUtils.getBean(CommandInfoService.class); |
| | | CommandInfo commandInfo = commandInfoService.selectById(command.getCommandId()); |
| | | CommandInfoLog commandInfoLog = new CommandInfoLog(); |
| | | if (commandInfo != null) { |
| | | commandInfoLog = JSON.parseObject(JSON.toJSONString(commandInfo), CommandInfoLog.class); |
| | | commandInfoLog.setId(null); |
| | | }else { |
| | | Date now = new Date(); |
| | | commandInfoLog.setCommand(JSON.toJSONString(command)); |
| | | commandInfoLog.setCommandStatus(3); |
| | | commandInfoLog.setStartTime(now); |
| | | commandInfoLog.setExecuteTime(now); |
| | | commandInfoLog.setCompleteTime(now); |
| | | commandInfoLog.setDevice(SlaveType.Devp.toString()); |
| | | commandInfoLog.setWrkNo(9999); |
| | | commandInfoLog.setTaskNo("9999"); |
| | | commandInfoLog.setCommandDesc("手动命令"); |
| | | } |
| | | CommandInfoLog commandInfoLog = JSON.parseObject(JSON.toJSONString(commandInfo), CommandInfoLog.class); |
| | | commandInfoLog.setId(null); |
| | | // CommandInfoLog commandInfoLog = new CommandInfoLog(); |
| | | // if (commandInfo != null) { |
| | | // commandInfoLog = JSON.parseObject(JSON.toJSONString(commandInfo), CommandInfoLog.class); |
| | | // commandInfoLog.setId(null); |
| | | // }else { |
| | | // Date now = new Date(); |
| | | // commandInfoLog.setCommand(JSON.toJSONString(command)); |
| | | // commandInfoLog.setCommandStatus(3); |
| | | // commandInfoLog.setStartTime(now); |
| | | // commandInfoLog.setExecuteTime(now); |
| | | // commandInfoLog.setCompleteTime(now); |
| | | // commandInfoLog.setDevice(SlaveType.Devp.toString()); |
| | | // commandInfoLog.setWrkNo(9999); |
| | | // commandInfoLog.setTaskNo("9999"); |
| | | // commandInfoLog.setCommandDesc("手动命令"); |
| | | // } |
| | | |
| | | |
| | | if (result.IsSuccess) { |
| | |
| | | commandInfoLog.setDeviceLog("指令下发成功"); |
| | | commandInfoLogService.insert(commandInfoLog); |
| | | |
| | | //线程暂存指令ID |
| | | crnProtocol.setCommandId(command.getCommandId()); |
| | | |
| | | //更新指令状态 |
| | | commandInfo.setCommandStatus(CommandStatusType.EXECUTE.id);//执行中 |
| | | commandInfoService.updateById(commandInfo); |
| | | |
| | | //更新任务步序 |
| | | TaskWrkService taskWrkService = SpringUtils.getBean(TaskWrkService.class); |
| | | TaskWrk taskWrk = taskWrkService.selectByWrkNo(command.getTaskNo().intValue()); |