| | |
| | | crnCommand.setSourcePosX(sourceSta.getRow1().shortValue()); // 源库位排 |
| | | crnCommand.setSourcePosY(sourceSta.getBay1().shortValue()); // 源库位列 |
| | | crnCommand.setSourcePosZ(sourceSta.getLev1().shortValue()); // 源库位层 |
| | | crnCommand.setDestinationPosX(crnStn.getRow().shortValue()); // 目标库位排 |
| | | crnCommand.setDestinationPosY(crnStn.getBay().shortValue()); // 目标库位列 |
| | | crnCommand.setDestinationPosZ(crnStn.getLev().shortValue()); // 目标库位层 |
| | | crnCommand.setDestinationPosX((short)0); // 目标库位排 |
| | | crnCommand.setDestinationPosY((short)0); // 目标库位列 |
| | | crnCommand.setDestinationPosZ((short)0); // 目标库位层 |
| | | if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(crnStation==1? 2:5, crnCommand))) { |
| | | log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | } else { |
| | |
| | | MOVING(9, "走行中"), |
| | | WAITING(10, "任务完成等待WCS确认"), |
| | | PAUSE(11, "任务暂停"), |
| | | SEPARATE_IDLE(20, "有物待作业"), |
| | | SEPARATE_WAITING(21, "取货完成等待确认"), |
| | | SOS(99, "报警"), |
| | | UNKNOW(100, "其他"), |
| | | UNKNOW(100, "其他100"), |
| | | ; |
| | | |
| | | public Integer id; |
| | |
| | | |
| | | //堆垛机任务写入后,回读一次,看是否成功 |
| | | Thread.sleep(200); |
| | | int writeCount1 = 1; |
| | | int writeCount = 1; |
| | | do { |
| | | try{ |
| | | if(!result.IsSuccess){ |
| | | log.error("写入堆垛机plc数据失败,重新下发任务 写入直接失败 ===>> [id:{}],{},[写入次数:{}]", slave.getId(), JSON.toJSON(command),writeCount1); |
| | | // MessageQueue.offer(SlaveType.Crn, slave.getId(), new Task(2, command)); |
| | | log.error("写入堆垛机plc数据失败,重新下发任务 写入直接失败 ===>> [id:{}],{},[写入次数:{}]", slave.getId(), JSON.toJSON(command),writeCount); |
| | | result = siemensNet.Write("DB100.0", array); |
| | | Thread.sleep(100); |
| | | writeCount1++; |
| | | writeCount++; |
| | | continue; |
| | | } |
| | | OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 24); |
| | |
| | | log.error("日志打印失败:===>> [id:{}],{}", slave.getId(), JSON.toJSON(command)); |
| | | } |
| | | } |
| | | |
| | | try{ |
| | | Thread.sleep(100); |
| | | }catch (Exception e){ |
| | | |
| | | } |
| | | |
| | | // News.error("堆垛机命令回读失败后,重新添加任务到队列 ===>> [id:{}],{},resetFlag={}", slave.getId(), JSON.toJSON(command),resetFlag); |
| | | // MessageQueue.offer(SlaveType.Crn, slave.getId(), new Task(2, command)); |
| | | log.error("写入堆垛机plc数据失败,重新下发任务 回读不一致 ===>> [id:{}],{},[写入次数:{}]", slave.getId(), JSON.toJSON(command),writeCount1); |
| | | log.error("写入堆垛机plc数据失败,重新下发任务 回读不一致 ===>> [id:{}],{},[写入次数:{}]", slave.getId(), JSON.toJSON(command),writeCount); |
| | | result = siemensNet.Write("DB100.0", array); |
| | | writeCount1++; |
| | | writeCount++; |
| | | continue; |
| | | |
| | | } else { |
| | | log.info("堆垛机命令地址写入后回读成功[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one)); |
| | | break; |
| | |
| | | }catch (Exception e){ |
| | | log.error("堆垛机命令地址写入后回读出错,异常:"+e); |
| | | } |
| | | writeCount1++; |
| | | } while (writeCount1<6); |
| | | writeCount++; |
| | | } while (writeCount<6); |
| | | |
| | | if (command.getAckFinish() == 0) { |
| | | short commandFinish = 1; |
| | |
| | | log.info("下发DB100.18" + "array:"+ JSON.toJSONString(array)); |
| | | break; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |