| | |
| | | import com.zy.common.utils.News; |
| | | import com.zy.core.CrnThread; |
| | | import com.zy.core.DevpThread; |
| | | import com.zy.core.ThreadHandler; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.*; |
| | |
| | | WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode); |
| | | if (wrkMast == null) { |
| | | // 无拣料数据 |
| | | log.info("无拣料数据,托盘码:{}",barcode); |
| | | continue; |
| | | } |
| | | if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107) || Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo())) { |
| | | log.info("工作档入出库类型不符合,入出库类型:{},工作档目标站{},工作档源站{}",wrkMast.getIoType(),wrkMast.getStaNo(),wrkMast.getSourceStaNo()); |
| | | continue; |
| | | } |
| | | // 获取目标站 |
| | |
| | | if (crnProtocol.modeType == CrnModeType.AUTO && crnProtocol.getTaskNo().equals(wrkMast.getWrkNo().shortValue()) && crnProtocol.statusType == CrnStatusType.WAITING && crnProtocol.forkPosType == CrnForkPosType.HOME) { |
| | | log.info("堆垛机出库完成 - 开始执行"); |
| | | |
| | | Date date = new Date(); |
| | | long diffInMillis = date.getTime() - wrkMast.getCrnStrTime().getTime(); |
| | | if (!(diffInMillis >= 30000)){ |
| | | continue; |
| | | } |
| | | |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | |
| | | // 下发站点信息 |
| | |
| | | public synchronized void crnIoExecute(Integer mark) { |
| | | |
| | | for (CrnSlave crn : slaveProperties.getCrn()) { |
| | | //获取堆垛机出库站的下一站信息 |
| | | SiemensDevpThread devpThread =(SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, crn.getId()); |
| | | StaProtocol staProtocol = devpThread.getStation().get(1002); |
| | | // 获取堆垛机信息 |
| | | CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crn.getId()); |
| | | CrnProtocol crnProtocol = crnThread.getCrnProtocol(); |
| | |
| | | if (crnProtocol.getStatusType() == CrnStatusType.IDLE && crnProtocol.getModeType() == CrnModeType.AUTO && crnProtocol.getForkPos() == 0 && crnProtocol.getTaskNo() == 0 && crnProtocol.getTaskNoTwo() == 0) { |
| | | News.warnNoLog("" + mark + " - 0" + " - 开始执行堆垛机入出库作业下发"); |
| | | if (crnProtocol.getLoaded() == 0 && crnProtocol.getLoadedTwo() == 0) { |
| | | News.error("工位1无物,工位2无物"); |
| | | //News.error("工位1无物,工位2无物"); |
| | | //堆垛机没有物料 |
| | | // 如果最近一次是入库模式 |
| | | if (crnProtocol.getLastIo().equals("I")) { |
| | |
| | | } |
| | | |
| | | } else if (crnProtocol.getLoaded() == 1 && crnProtocol.getLoadedTwo() == 1) { |
| | | News.error("工位1有物,工位2有物"); |
| | | //News.error("工位1有物,工位2有物"); |
| | | // 堆垛机有物料 |
| | | WrkMast wrkMast = wrkMastMapper.selectByPltType(crn.getId(), 1); |
| | | if (wrkMast != null) { |
| | |
| | | log.error("" + mark + " - 1" + " - 有物料无工作档 ===》异常"); |
| | | } |
| | | } else if (crnProtocol.getLoaded() == 1 && crnProtocol.getLoadedTwo() == 0) { |
| | | News.error("工位1有物,工位2无物"); |
| | | //News.error("工位1有物,工位2无物"); |
| | | // 堆垛机工位1有物料 |
| | | WrkMast wrkMast = wrkMastMapper.selectByPltType(crn.getId(), 1); |
| | | if (wrkMast != null) { |
| | |
| | | if (wrkMast.getIoType() >= 100) { |
| | | WrkMast wrkMast1 = wrkMastMapper.selectPakOutStep1(crn.getId(), wrkMast.getSourceStaNo()); |
| | | if (wrkMast1 != null) { |
| | | if (Integer.parseInt(wrkMast1.getSourceLocNo().substring(2,5)) == 1){ |
| | | if (Integer.parseInt(wrkMast1.getSourceLocNo().substring(2,5)) == 1 || (staProtocol.isAutoing()&&staProtocol.isLoading())){ |
| | | this.outPut(crn, crnProtocol, mark); |
| | | continue; |
| | | } |
| | |
| | | log.error("" + mark + " - 1" + " - 有物料无工作档 ===》异常"); |
| | | } |
| | | } else if (crnProtocol.getLoaded() == 0 && crnProtocol.getLoadedTwo() == 1) { |
| | | News.error("工位1无物,工位2有物"); |
| | | //News.error("工位1无物,工位2有物"); |
| | | // 堆垛机工位2有物料 |
| | | WrkMast wrkMast = wrkMastMapper.selectByPltType(crn.getId(), 2); |
| | | if (wrkMast != null) { |
| | |
| | | if (wrkMast.getIoType() >= 100) { |
| | | WrkMast wrkMast1 = wrkMastMapper.selectPakOutStep1(crn.getId(), wrkMast.getSourceStaNo()); |
| | | if (wrkMast1 != null) { |
| | | if (Integer.parseInt(wrkMast1.getSourceLocNo().substring(2,5)) == 29){ |
| | | if (Integer.parseInt(wrkMast1.getSourceLocNo().substring(2,5)) == 29 || (staProtocol.isAutoing()&&staProtocol.isLoading())){ |
| | | this.outPut(crn, crnProtocol, mark); |
| | | continue; |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | private Integer getCrnStation(String locNo) { |
| | | String bay = locNo.substring(2, 5); |
| | | String bay = locNo.substring(2, 5);//0100203 |
| | | if (Integer.parseInt(bay) == 1) { |
| | | return 1; |
| | | } else if (Integer.parseInt(bay) == 29) { |
| | | return 2; |
| | | } |
| | | if (Integer.parseInt(locNo.substring(0, 2)) >= 14) { |
| | | return 1; |
| | | } else { |
| | | // if (Integer.parseInt(locNo.substring(0, 2)) >= 14) { |
| | | if (Integer.parseInt(bay) >= 14) { |
| | | return 2; |
| | | } else { |
| | | return 1; |
| | | } |
| | | } |
| | | |
| | |
| | | // 获取堆垛机出库站信息 |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, crnStn.getDevpPlcId()); |
| | | StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo()); |
| | | //堆垛机出库站点的下一站 |
| | | StaProtocol staProtocol1 = devpThread.getStation().get(1002); |
| | | if (staProtocol == null) { |
| | | News.infoNoLog("" + mark + " - 2" + " - 3" + " - 堆垛机出库站信息(staProtocol!=null继续执行,否则循环终止):staProtocol=" + staProtocol); |
| | | break; |
| | |
| | | break; |
| | | } |
| | | // 判断堆垛机出库站状态 |
| | | if (staProtocol.isAutoing() && !staProtocol.isLoading() && staDetl.getCanouting() != null && staDetl.getCanouting().equals("Y") && staProtocol.getWorkNo() == 0 && staProtocol.isOutEnable()) { |
| | | if (staProtocol.isAutoing() && !staProtocol.isLoading() && staDetl.getCanouting() != null && staDetl.getCanouting().equals("Y") && staProtocol.getWorkNo() == 0 && staProtocol.isOutEnable()&&staProtocol1.isAutoing()&&!staProtocol1.isLoading()) { |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | |
| | | // 堆垛机控制过滤 |
| | |
| | | WrkMast wrkMast = wrkMastMapper.selectPakInStep3(crnProtocol.getTaskNo().intValue()); |
| | | if (wrkMast == null) { |
| | | News.error("" + mark + " - 1" + " - 堆垛机处于等待确认且任务完成状态,但未找到工作档。堆垛机号={},工作号={}", crn.getId(), crnProtocol.getTaskNo()); |
| | | continue; |
| | | } |
| | | Date date = new Date(); |
| | | long diffInMillis = date.getTime() - wrkMast.getCrnStrTime().getTime(); |
| | | if (!(diffInMillis >= 30000)){ |
| | | continue; |
| | | } |
| | | // 入库 + 库位转移 ==> 4.入库完成 |
| | |
| | | // 获取工作状态为11(生成出库ID)的出库工作档 |
| | | List<WrkMast> wrkMasts = wrkMastMapper.selectPakOutStep107(slave.getId(), crnStn.getStaNo()); |
| | | for (WrkMast wrkMast : wrkMasts) { |
| | | if (wrkMast == null || wrkMast.getPltType() == 2) { |
| | | // if (wrkMast == null || wrkMast.getPltType() == 2) { |
| | | // continue; |
| | | // } |
| | | if (wrkMast == null){ |
| | | continue; |
| | | } |
| | | // 工作档状态判断 |