| | |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.service.BasDualCrnpOptService; |
| | | import com.zy.asrs.service.BasDualCrnpService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.utils.RedisUtil; |
| | | import com.zy.core.News; |
| | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import com.zy.asrs.entity.BasDualCrnpErrLog; |
| | | import com.zy.asrs.service.BasDualCrnpErrLogService; |
| | | |
| | | /** |
| | | * 双工位堆垛机线程 |
| | |
| | | //更新采集时间 |
| | | crnProtocol.setDeviceDataLog(System.currentTimeMillis()); |
| | | } |
| | | |
| | | try { |
| | | BasDualCrnpErrLogService errLogService = SpringUtils.getBean(BasDualCrnpErrLogService.class); |
| | | if (errLogService != null) { |
| | | String errFlagKey = RedisKeyType.DEVICE_ERR_ACTIVE_DUAL_CRN.key + crnProtocol.getCrnNo(); |
| | | Object active = redisUtil.get(errFlagKey); |
| | | if (crnProtocol.getAlarm() != null && crnProtocol.getAlarm() > 0) { |
| | | if (active == null) { |
| | | BasDualCrnpErrLog log = new BasDualCrnpErrLog(); |
| | | Integer wrkNo = (crnProtocol.getTaskNo() != null && crnProtocol.getTaskNo() > 0) ? crnProtocol.getTaskNo() : crnProtocol.getTaskNoTwo(); |
| | | log.setWrkNo(wrkNo); |
| | | log.setStartTime(new Date()); |
| | | log.setCrnNo(crnProtocol.getCrnNo()); |
| | | log.setBarcode(crnProtocol.getBarcode()); |
| | | log.setErrCode(crnProtocol.getAlarm()); |
| | | log.setStatus(1); |
| | | log.setCreateTime(new Date()); |
| | | log.setSystemStatus(JSON.toJSONString(crnProtocol)); |
| | | errLogService.insert(log); |
| | | if (log.getId() != null) { |
| | | redisUtil.set(errFlagKey, log.getId(), 60 * 60 * 24); |
| | | } |
| | | } |
| | | } else { |
| | | if (active != null) { |
| | | Long id = Long.valueOf(String.valueOf(active)); |
| | | BasDualCrnpErrLog update = new BasDualCrnpErrLog(); |
| | | update.setId(id); |
| | | update.setEndTime(new Date()); |
| | | update.setStatus(2); |
| | | update.setUpdateTime(new Date()); |
| | | errLogService.updateById(update); |
| | | redisUtil.del(errFlagKey); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception ignore) {} |
| | | } |
| | | |
| | | @Override |