| | |
| | | OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功", DateUtils.convert(new Date()), slave.getId())); |
| | | |
| | | // 复位信号 |
| | | if (!Cools.isEmpty(crnProtocol.getStatusType()) && crnProtocol.getStatusType().equals(CrnStatusType.WAITING)) { |
| | | if (!Cools.isEmpty(crnProtocol.getStatusType()) && crnProtocol.getStatusType().equals(CrnStatusType.WAITING) && crnProtocol.getTaskNo()!=null&&crnProtocol.getTaskNo() == 0) { |
| | | // if (crnProtocol.getTaskNo() == 0){ |
| | | // News.error("堆垛机工位1工作号为0,不予确认,工位1{}",crnProtocol.getLoaded() == 1 ? "有物" : "无物"); |
| | | // return; |
| | |
| | | } |
| | | |
| | | // 复位信号 |
| | | if (!Cools.isEmpty(crnProtocol.getStatusType()) && crnProtocol.getStatusTypeTwo().equals(CrnStatusType.WAITING)) { |
| | | else if (!Cools.isEmpty(crnProtocol.getStatusType()) && crnProtocol.getStatusTypeTwo().equals(CrnStatusType.WAITING)&& crnProtocol.getTaskNoTwo()!=null&&crnProtocol.getTaskNoTwo() == 0) { |
| | | // if (crnProtocol.getTaskNoTwo() == 0){ |
| | | // News.error("堆垛机工位2工作号为0,不予确认,工位2{}",crnProtocol.getLoadedTwo() == 1 ? "有物" : "无物"); |
| | | // return; |
| | |
| | | // convertRow(command); |
| | | command.setCrnNo(slave.getId()); |
| | | // short[] array = new short[10]; |
| | | short[] array = new short[9]; |
| | | //array[0] = command.getAckFinish(); // 任务完成确认位 |
| | | short[] array = new short[10]; |
| | | // array[0] = command.getAckFinish(); // 任务完成确认位 |
| | | array[0] = command.getTaskNo(); // 任务号 |
| | | array[1] = command.getTaskMode(); // 模式 |
| | | array[2] = command.getSourcePosX(); // 源位置排号 |
| | |
| | | |
| | | short[] array2 = new short[1]; |
| | | array2[0] = command.getAckFinish(); |
| | | OperateResult result = siemensNet.Write("DB100.20", array); |
| | | OperateResult result2 = siemensNet.Write("DB100.0", array2); |
| | | try { |
| | | Thread.sleep(100); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | OperateResult result = siemensNet.Write("DB100.20", array); |
| | | News.info("堆垛机工位2命令下发[id:{}] >>>>> {}", slave.getId(), array); |
| | | News.info("堆垛机工位2任务完成确认位下发[id:{}] >>>>> {}", slave.getId(), array2); |
| | | |
| | | int writeCount1 = 1; |
| | | do { |
| | |
| | | if (!result.IsSuccess || !result2.IsSuccess) { |
| | | // if (!resetFlag){ |
| | | News.error("写入堆垛机工位2plc数据失败,重新下发任务 写入直接失败 ===>> [id:{}],{},[写入次数:{}]", slave.getId(), JSON.toJSON(command), writeCount1); |
| | | result = siemensNet.Write("DB100.0", array); |
| | | result = siemensNet.Write("DB100.20", array); |
| | | // } |
| | | Thread.sleep(100); |
| | | writeCount1++; |
| | |
| | | } |
| | | // if (!resetFlag){ |
| | | News.error("写入堆垛机工位2plc数据失败,重新下发任务 回读不一致 ===>> [id:{}],{},[写入次数:{}]", slave.getId(), JSON.toJSON(command), writeCount1); |
| | | result = siemensNet.Write("DB100.0", array); |
| | | result = siemensNet.Write("DB100.20", array); |
| | | try { |
| | | Thread.sleep(100); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | result2 = siemensNet.Write("DB100.0", array2); |
| | | // } |
| | | writeCount1++; |
| | | continue; |