| | |
| | | StaProtocol staProtocol5 = getClonedStation(devpThread, staProtocol.getSiteId() - 1); |
| | | if (staProtocol5 != null && (staProtocol5.isLoading() && (staProtocol5.getStaNo() == 107 || staProtocol5.getStaNo() == 109))) { |
| | | short workNo = staProtocol5.getWorkNo(); |
| | | |
| | | // **先清零,等待 100ms** |
| | | staProtocol5.setWorkNo((short) 0); |
| | | staProtocol5.setStaNo((short) 0); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol5)); |
| | | Thread.sleep(100); |
| | | |
| | | // **再写入目标值** |
| | | staProtocol5.setWorkNo(workNo); |
| | | staProtocol5.setStaNo((short) 112); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol5)); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(4, staProtocol5)); |
| | | } |
| | | } else { |
| | | short workNo = staProtocol.getWorkNo(); |
| | | |
| | | // **先清零,等待 100ms** |
| | | staProtocol.setWorkNo((short) 0); |
| | | staProtocol.setStaNo((short) 0); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | Thread.sleep(100); |
| | | |
| | | // **再写入目标值** |
| | | staProtocol.setWorkNo(workNo); |
| | | staProtocol.setStaNo((short) 112); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(4, staProtocol)); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | StaProtocol staProtocol = devpThread.getStation().get(112); |
| | | StaProtocol staProtocol2 = devpThread.getStation().get(116); |
| | | StaProtocol staProtocol3 = devpThread.getStation().get(117); |
| | | if(Objects.equals(staProtocol3.getWorkNo(), staProtocol.getWorkNo()) && staProtocol.getWorkNo() != 0){ |
| | | staProtocol.setWorkNo((short) 0); |
| | | staProtocol.setStaNo((short) 0); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | Thread.sleep(100); // 让 PLC 识别变化 |
| | | } |
| | | // StaProtocol staProtocol3 = devpThread.getStation().get(117); |
| | | // if(Objects.equals(staProtocol3.getWorkNo(), staProtocol.getWorkNo()) && staProtocol.getWorkNo() != 0){ |
| | | // staProtocol.setWorkNo((short) 0); |
| | | // staProtocol.setStaNo((short) 0); |
| | | // MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | // Thread.sleep(100); // 让 PLC 识别变化 |
| | | // } |
| | | if (staProtocol == null || staProtocol.getWorkNo() == 0 || !staProtocol.isLoading() ) { |
| | | continue; |
| | | } |
| | |
| | | // 先清零 |
| | | short workNo = staProtocol.getWorkNo(); |
| | | short oldStaNo = staProtocol.getStaNo(); |
| | | staProtocol.setWorkNo((short) 0); |
| | | staProtocol.setStaNo((short) 0); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | Thread.sleep(100); // 让 PLC 识别变化 |
| | | // staProtocol.setWorkNo((short) 0); |
| | | // staProtocol.setStaNo((short) 0); |
| | | // MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | // Thread.sleep(100); // 让 PLC 识别变化 |
| | | |
| | | // 再写入目标站点 |
| | | staProtocol.setWorkNo(workNo); |
| | | staProtocol.setStaNo(Short.valueOf(taskWrk.getTargetPoint())); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(4, staProtocol)); |
| | | Thread.sleep(200); |
| | | |
| | | log.info("Shifted from cycle station 112 to target {}, workNo: {}", taskWrk.getTargetPoint(), workNo); |