| | |
| | | import com.zy.asrs.entity.BasCrnp; |
| | | import com.zy.asrs.service.BasCrnOptService; |
| | | import com.zy.asrs.service.BasCrnpService; |
| | | import com.zy.asrs.service.DeviceErrorService; |
| | | import com.zy.core.CrnThread; |
| | | import com.zy.core.cache.CrnErrCache; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.OutputQueue; |
| | | import com.zy.core.enums.CrnStatusType; |
| | |
| | | * 堆垛机是否在回原点运动中标记 |
| | | */ |
| | | private boolean backHpFlag = false; |
| | | public Long currentTimeMilliConnectCrn= 0L; |
| | | |
| | | public SiemensCrnThread(CrnSlave slave) { |
| | | this.slave = slave; |
| | |
| | | initCrn(); |
| | | OutputQueue.CRN.offer(MessageFormat.format("【{0}】读取堆垛机plc状态信息失败 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); |
| | | log.error("读取堆垛机plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); |
| | | if (System.currentTimeMillis()-currentTimeMilliConnectCrn>1000*60*10){ |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.addDeviceError("Crn", slave.getId(), "读取堆垛机plc状态信息失败"); |
| | | } catch (Exception e2){ |
| | | Thread.sleep(1000); |
| | | // log.error("e2:"+e2.getMessage()); |
| | | } |
| | | if (currentTimeMilliConnectCrn == 0){ |
| | | currentTimeMilliConnectCrn = System.currentTimeMillis()-1000*60*10-1; |
| | | } else { |
| | | currentTimeMilliConnectCrn = System.currentTimeMillis(); |
| | | |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | log.error("堆垛机写入命令为空"); |
| | | return false; |
| | | } |
| | | CrnErrCache.updateCrnErr(slave.getId(), "-"); |
| | | |
| | | // convertRow(command); |
| | | command.setCrnNo(slave.getId()); |
| | | short[] array = new short[10]; |
| | |
| | | if (!command.getTaskNo().equals(one.getTaskNo()) |
| | | ){ |
| | | i++; |
| | | CrnErrCache.updateCrnErr(slave.getId(), "堆垛机命令地址写入后回读失败"); |
| | | |
| | | log.error("堆垛机命令地址写入后回读失败[id:{}]>>>>重写[{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), i,JSON.toJSON(command),JSON.toJSON(one)); |
| | | result = siemensNet.Write("DB100.0", array); |
| | | }else{ |
| | |
| | | if (transInt16 != commandFinish){ |
| | | log.info("下发DB100.18 回读失败" + "commandFinish:"+commandFinish); |
| | | log.info("下发DB100.18 回读失败" + "array:"+ JSON.toJSONString(array)); |
| | | CrnErrCache.updateCrnErr(slave.getId(), "下发DB100.18 回读失败"); |
| | | |
| | | result = siemensNet.Write("DB100.18", commandFinish); |
| | | signFinish++; |
| | | }else { |
| | |
| | | } else { |
| | | OutputQueue.CRN.offer(MessageFormat.format("【{0}】写入堆垛机plc数据失败 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); |
| | | log.error("写入堆垛机plc数据失败 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | CrnErrCache.updateCrnErr(slave.getId(), "写入堆垛机plc数据失败"); |
| | | |
| | | return false; |
| | | } |
| | | } |