| | |
| | | import com.zy.core.thread.SiemensDevpThread; |
| | | import com.zy.system.entity.Config; |
| | | import com.zy.system.service.ConfigService; |
| | | import lombok.Synchronized; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | @Autowired |
| | | private SiteController siteController; |
| | | //出库站点至112循环站点 |
| | | public synchronized void shiftTargetToCyclePoint() throws IOException, InterruptedException{ |
| | | @Synchronized |
| | | public void shiftTargetToCyclePoint() throws IOException, InterruptedException{ |
| | | try{ |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | for (DevpSlave.Sta outSta : devp.getOutSta()) { |
| | |
| | | StaProtocol staProtocol2 = devpThread.getStation().get(1002); |
| | | StaProtocol staProtocol3 = devpThread.getStation().get(1003); |
| | | StaProtocol staProtocol4 = devpThread.getStation().get(1004); |
| | | StaProtocol staProtocol6 = devpThread.getStation().get(111); |
| | | if (staProtocol == null) { |
| | | continue; |
| | | } else { |
| | |
| | | } else { |
| | | staProtocol4 = staProtocol4.clone(); |
| | | } |
| | | if (staProtocol6 == null) { |
| | | continue; |
| | | } else { |
| | | staProtocol6 = staProtocol6.clone(); |
| | | } |
| | | boolean result = false; |
| | | switch(outSta.getStaNo()){ |
| | | case 105: if (staProtocol1.isLoading()){ |
| | | case 105: if (staProtocol1.isLoading() && staProtocol.isLoading() && staProtocol.getStaNo() == 105){ |
| | | result = true; |
| | | } |
| | | case 107: if (staProtocol2.isLoading()){ |
| | |
| | | case 109: if (staProtocol3.isLoading()){ |
| | | result = true; |
| | | } |
| | | case 110: if (staProtocol4.isLoading()){ |
| | | case 110: if ((staProtocol4.isLoading() && staProtocol.isLoading() && staProtocol.getStaNo() == 110) || ((staProtocol6.isLoading() && staProtocol.isLoading() && staProtocol.getStaNo() == 111))){ |
| | | result = true; |
| | | } |
| | | default: break; |
| | | |
| | | } |
| | | if(result){ |
| | | staProtocol.setStaNo((short) 112); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | if(staProtocol.getSiteId() == 107 || staProtocol.getSiteId() == 109){ |
| | | StaProtocol staProtocol5 = devpThread.getStation().get(staProtocol.getSiteId() - 1); |
| | | if (staProtocol5== null) { |
| | | continue; |
| | | } else { |
| | | staProtocol5 = staProtocol5.clone(); |
| | | } |
| | | if((staProtocol5.isLoading() && staProtocol5.getStaNo() == 107) || ((staProtocol5.isLoading() && staProtocol5.getStaNo() == 109))){ |
| | | staProtocol5.setStaNo((short) 112); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol5)); |
| | | } |
| | | }else{ |
| | | staProtocol.setStaNo((short) 112); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | WrkMast wrkMast = wrkMastMapper.selectById(staProtocol.getWorkNo()); |
| | | if(wrkMast != null && wrkMast.getWrkNo() < 9000 && wrkMast.getWrkNo() > 7000){ |
| | | staProtocol.setStaNo(wrkMast.getStaNo().shortValue()); |
| | | TaskWrk taskWrk = taskWrkMapper.selectById(staProtocol.getWorkNo()); |
| | | if(taskWrk != null && taskWrk.getWrkNo() < 9001 && taskWrk.getWrkNo() > 6000){ |
| | | staProtocol.setStaNo(Short.valueOf(taskWrk.getTargetPoint())); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | } |
| | | } |