| | |
| | | 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.setYDistance(0); |
| | | crnProtocol.setXDuration(0); |
| | | crnProtocol.setYDuration(0); |
| | | |
| | | BasDualCrnpService basDualCrnpService = null; |
| | | try { |
| | | basDualCrnpService = SpringUtils.getBean(BasDualCrnpService.class); |
| | | }catch (Exception e){ |
| | | |
| | | } |
| | | if (basDualCrnpService != null) { |
| | | BasDualCrnp basDualCrnp = basDualCrnpService.selectOne(new EntityWrapper<BasDualCrnp>().eq("crn_no", deviceConfig.getDeviceNo())); |
| | | if(basDualCrnp == null) { |
| | | basDualCrnp = new BasDualCrnp(); |
| | | basDualCrnp.setCrnNo(deviceConfig.getDeviceNo()); |
| | | basDualCrnp.setStatus(1); |
| | | basDualCrnp.setInEnable("N"); |
| | | basDualCrnp.setOutEnable("N"); |
| | | basDualCrnp.setMaxInTask(5); |
| | | basDualCrnp.setMaxOutTask(5); |
| | | basDualCrnp.setCreateTime(new Date()); |
| | | basDualCrnpService.insert(basDualCrnp); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | crnProtocol.setYDistance(crnStatus.getYDistance()); |
| | | crnProtocol.setXDuration(crnStatus.getXDuration()); |
| | | crnProtocol.setYDuration(crnStatus.getYDuration()); |
| | | crnProtocol.setGoodsType(crnStatus.getGoodsType()); |
| | | crnProtocol.setBarcode(crnStatus.getBarcode()); |
| | | |
| | | OutputQueue.DUAL_CRN.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), deviceConfig.getDeviceNo())); |
| | | |
| | |
| | | //更新采集时间 |
| | | crnProtocol.setDeviceDataLog(System.currentTimeMillis()); |
| | | } |
| | | |
| | | BasDualCrnpService basDualCrnpService = null; |
| | | |
| | | try { |
| | | basDualCrnpService = SpringUtils.getBean(BasDualCrnpService.class); |
| | | }catch (Exception e){ |
| | | |
| | | } |
| | | if (basDualCrnpService != null) { |
| | | BasDualCrnp basDualCrnp = basDualCrnpService.selectOne(new EntityWrapper<BasDualCrnp>().eq("crn_no", deviceConfig.getDeviceNo())); |
| | | if(basDualCrnp == null) { |
| | | basDualCrnp = new BasDualCrnp(); |
| | | basDualCrnp.setCrnNo(deviceConfig.getDeviceNo()); |
| | | basDualCrnp.setStatus(1); |
| | | basDualCrnp.setInEnable("N"); |
| | | basDualCrnp.setOutEnable("N"); |
| | | basDualCrnp.setMaxInTask(5); |
| | | basDualCrnp.setMaxOutTask(5); |
| | | basDualCrnp.setCreateTime(new Date()); |
| | | basDualCrnpService.insert(basDualCrnp); |
| | | 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 |