| | |
| | | if (crnProtocol == null) { |
| | | throw new CoolException("堆垛机不在线"); |
| | | } |
| | | if (crn.getId() == 1) { |
| | | // 只有出现指定异常才进行复位 |
| | | if (crnProtocol.getCrnError3().leftTakeNoneErr |
| | | || crnProtocol.getCrnError3().rightTakeNoneErr |
| | |
| | | throw new CoolException("命令下发失败"); |
| | | } |
| | | } |
| | | } else if (crn.getId() == 2) { |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | | crnCommand.setCrnNo(crn.getId()); // 堆垛机编号 |
| | | crnCommand.setTaskMode(CrnTaskModeType.CANCEL); |
| | | crnCommand.setAckFinish((short) 0); // 任务完成确认位 |
| | | // 延时发送 |
| | | Thread.sleep(1000L); |
| | | if (MessageQueue.offer(SlaveType.Crn, crn.getId(), new Task(2, crnCommand))) { |
| | | return R.ok(); |
| | | } else { |
| | | throw new CoolException("命令下发失败"); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | if (wrkMast == null) { |
| | | continue; |
| | | } |
| | | BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm1()); |
| | | BasCrnError crnError = basCrnErrorMapper.selectById(crn.getId()==2?(crnProtocol.getAlarm1()+1000):crnProtocol.getAlarm1()); |
| | | String errName = crnError==null? String.valueOf(crnProtocol.getAlarm1()):crnError.getErrName(); |
| | | BasErrLog basErrLog = new BasErrLog( |
| | | null, // 编号 |
| | | wrkMast.getWrkNo(), // 工作号 |
| | |
| | | wrkMast.getSourceLocNo(), // 源库位 |
| | | wrkMast.getBarcode(), // 条码 |
| | | crnProtocol.getAlarm1().intValue(), // 异常码 |
| | | crnError.getErrName(), // 异常 |
| | | errName, // 异常 |
| | | 1, // 异常情况 |
| | | now, // 添加时间 |
| | | null, // 添加人员 |
| | |
| | | if (crnProtocol.getAlarm1() != null && crnProtocol.getAlarm1() > 0) { |
| | | // 记录新异常 |
| | | if (latest == null || (latest.getErrCode() != crnProtocol.getAlarm1().intValue())) { |
| | | BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm1()); |
| | | BasCrnError crnError = basCrnErrorMapper.selectById(crn.getId()==2?(crnProtocol.getAlarm1()+1000):crnProtocol.getAlarm1()); |
| | | String errName = crnError==null? String.valueOf(crnProtocol.getAlarm1()):crnError.getErrName(); |
| | | BasErrLog basErrLog = new BasErrLog( |
| | | null, // 编号 |
| | |
| | | GO_ORIGIN(5), // 回原点 |
| | | OFFSET_MOVE(7), // 坐标移行 |
| | | TIMING(90), // 校时 |
| | | CANCEL(99), // 取消当前任务 |
| | | ; |
| | | |
| | | public Integer id; |
| | |
| | | } |
| | | if (command.getAckFinish() == 1) { |
| | | command.setTaskSend((short) 0); |
| | | command.setTaskNo((short) 0); |
| | | } else if (command.getAckFinish() == 0) { |
| | | command.setTaskSend((short) 1); |
| | | } |