| | |
| | | import com.zy.asrs.service.StaDescService; |
| | | import com.zy.asrs.service.WrkDetlService; |
| | | import com.zy.common.model.StartupDto; |
| | | import com.zy.core.Slave; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.CrnStatusType; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.model.DevpSlave; |
| | | import com.zy.core.model.Task; |
| | | import com.zy.core.model.protocol.CrnProtocol; |
| | | import com.zy.core.model.protocol.StaProtocol; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.thread.BarcodeThread; |
| | | import com.zy.core.thread.CrnThread; |
| | | import com.zy.core.thread.DevpThread; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 堆垛机站出库到出库站 |
| | | */ |
| | | public void crnStnToOutStn() { |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | // 遍历拣料入库口 |
| | | for (DevpSlave.Sta outSta : devp.getOutSta()) { |
| | | // 获取堆垛机出库站信息 |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | StaProtocol staProtocol = devpThread.getStation().get(outSta.getStaNo()); |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.getWorkNo() == 0 || staProtocol.getStaNo() == null)) { |
| | | // 查询工作档 |
| | | WrkMast wrkMast = wrkMastMapper.selectPakOutStep1(staProtocol.getSiteId()); |
| | | if (wrkMast == null) { |
| | | continue; |
| | | } |
| | | // 判断工作档条件 |
| | | if (wrkMast.getIoType() < 100 || wrkMast.getStaNo() == null || wrkMast.getSourceStaNo() == null) { |
| | | continue; |
| | | } |
| | | // 判断吊车是否实际已完成,且电脑状态在move中,以备电脑进行更新工作档 |
| | | CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, wrkMast.getCrnNo()); |
| | | CrnProtocol crnProtocol = crnThread.getCrnProtocol(); |
| | | if (crnProtocol.statusType == CrnStatusType.FETCHING || crnProtocol.statusType == CrnStatusType.PUTTING) { |
| | | // 移动中 |
| | | continue; |
| | | } |
| | | // 更新工作档状态为14失败 todo:luxiaotao |
| | | if (crnProtocol.mode == 3 && crnProtocol.getTaskNo() == wrkMast.getWrkNo() |
| | | && crnProtocol.statusType == CrnStatusType.IDLE |
| | | && crnProtocol.forkPos==0) { |
| | | wrkMast.setWrkSts(14L); |
| | | wrkMast.setCrnEndTime(new Date()); |
| | | if (wrkMastMapper.updateById(wrkMast) == 0) { |
| | | throw new CoolException("更新工作档的工作状态为14失败,工作号"+wrkMast.getWrkNo()); |
| | | } |
| | | } |
| | | |
| | | // 更新堆垛机信息 且 下发plc命令 todo:luxiaotao |
| | | crnProtocol.setStatus(CrnStatusType.IDLE); |
| | | crnProtocol.setTaskNo((short)0); |
| | | boolean result = MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task<>(4, crnProtocol)); |
| | | if (!result) { |
| | | throw new CoolException("更新堆垛机信息失败"); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 执行对工作档的入库完成 |
| | | */ |
| | | public void storeFinished() { |
| | | for (Slave crn : slaveProperties.getCrn()) { |
| | | // 获取堆垛机信息 |
| | | CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crn.getId()); |
| | | CrnProtocol crnProtocol = crnThread.getCrnProtocol(); |
| | | |
| | | } |
| | | } |
| | | |
| | | } |