| | |
| | | @Autowired |
| | | private BasShuttleErrLogService basShuttleErrLogService; |
| | | @Autowired |
| | | private BasLiftErrLogService basLiftErrLogService; |
| | | @Autowired |
| | | private BasShuttleErrService basShuttleErrService; |
| | | @Autowired |
| | | private BasCrnErrorMapper basCrnErrorMapper; |
| | |
| | | public void recErr() { |
| | | try { |
| | | this.recShuttleErr(); |
| | | this.recLiftErr(); |
| | | } catch (Exception e) { |
| | | News.error("recErr fail", e); |
| | | } |
| | |
| | | null, // 添加人员 |
| | | now, // 修改时间 |
| | | null, // 修改人员 |
| | | "任务中异常" // 备注 |
| | | "任务中异常", // 备注 |
| | | JSON.toJSONString(shuttleProtocol) // 系统状态数据 |
| | | ); |
| | | if (!basShuttleErrLogService.insert(basShuttleErrLog)) { |
| | | News.error("四向穿梭车plc异常记录失败 ===>> [id:{}] [error:{}]", shuttleSlave.getId(), errName); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 提升机异常信息记录 |
| | | */ |
| | | private void recLiftErr() { |
| | | Date now = new Date(); |
| | | for (LiftSlave liftSlave : slaveProperties.getLift()) { |
| | | // 获取提升机信息 |
| | | LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, liftSlave.getId()); |
| | | if (liftThread == null) { |
| | | continue; |
| | | } |
| | | LiftProtocol liftProtocol = liftThread.getLiftProtocol(); |
| | | if (liftProtocol == null) { |
| | | continue; |
| | | } |
| | | |
| | | if (liftProtocol.getTaskNo() != 0) { |
| | | //有任务 |
| | | BasLiftErrLog latest = basLiftErrLogService.findLatestByTaskNo(liftSlave.getId(), liftProtocol.getTaskNo().intValue()); |
| | | // 有异常 |
| | | if (latest == null) { |
| | | if (liftProtocol.getDeviceError() != null && liftProtocol.getDeviceError()) { |
| | | WrkMast wrkMast = wrkMastMapper.selectById(liftProtocol.getTaskNo()); |
| | | if (wrkMast == null) { |
| | | continue; |
| | | } |
| | | |
| | | String errName = ""; |
| | | if (liftProtocol.getFrontOverrun()) { |
| | | errName = "前超限"; |
| | | } else if (liftProtocol.getBackOverrun()) { |
| | | errName = "后超限"; |
| | | } else if (liftProtocol.getLeftOverrun()) { |
| | | errName = "左超限"; |
| | | } else if (liftProtocol.getRightOverrun()) { |
| | | errName = "右超限"; |
| | | } else if (liftProtocol.getOverHeight()) { |
| | | errName = "超高"; |
| | | } else if (liftProtocol.getOverWeight()) { |
| | | errName = "超重"; |
| | | } |
| | | |
| | | BasLiftErrLog basLiftErrLog = new BasLiftErrLog( |
| | | null, // 编号 |
| | | wrkMast.getWrkNo(), // 工作号 |
| | | now, // 发生时间 |
| | | null, // 结束时间 |
| | | wrkMast.getWrkSts(), // 工作状态 |
| | | wrkMast.getIoType(), // 入出库类型 |
| | | liftSlave.getId(), // 提升机 |
| | | null, // plc |
| | | wrkMast.getLocNo(), // 目标库位 |
| | | wrkMast.getStaNo(), // 目标站 |
| | | wrkMast.getSourceStaNo(), // 源站 |
| | | wrkMast.getSourceLocNo(), // 源库位 |
| | | wrkMast.getBarcode(), // 条码 |
| | | null, // 异常码 |
| | | errName, // 异常 |
| | | 1, // 异常情况 |
| | | now, // 添加时间 |
| | | null, // 添加人员 |
| | | now, // 修改时间 |
| | | null, // 修改人员 |
| | | "任务中异常", // 备注 |
| | | JSON.toJSONString(liftProtocol) // 系统状态数据 |
| | | ); |
| | | if (!basLiftErrLogService.insert(basLiftErrLog)) { |
| | | News.error("提升机plc异常记录失败 ===>> [id:{}] [error:{}]", liftSlave.getId(), errName); |
| | | } |
| | | } |
| | | } else { |
| | | // 异常修复 |
| | | if (liftProtocol.getDeviceError() == null || !liftProtocol.getDeviceError()) { |
| | | latest.setEndTime(now); |
| | | latest.setUpdateTime(now); |
| | | latest.setStatus(2); |
| | | if (!basLiftErrLogService.updateById(latest)) { |
| | | News.error("提升机plc异常记录修复失败 ===>> [id:{}] [errLogId:{}]", liftSlave.getId(), latest.getId()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // ------------------------------------------------------------------------------- |
| | | |
| | | /** |