| | |
| | | import com.zy.asrs.mapper.*; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.model.LocTypeDto; |
| | | import com.zy.common.model.MatDto; |
| | | import com.zy.common.model.SearchLocParam; |
| | | import com.zy.common.model.StartupDto; |
| | | import com.zy.common.model.*; |
| | | import com.zy.common.model.enums.WrkChargeType; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.service.erp.ErpService; |
| | | import com.zy.common.utils.CollectionUtils; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.common.utils.*; |
| | | import com.zy.core.CrnThread; |
| | | import com.zy.core.DevpThread; |
| | | import com.zy.core.News; |
| | |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.*; |
| | | import com.zy.core.model.*; |
| | | import com.zy.core.model.command.CrnCommand; |
| | | import com.zy.core.model.command.LedCommand; |
| | | import com.zy.core.model.command.SteCommand; |
| | | import com.zy.core.model.command.*; |
| | | import com.zy.core.model.protocol.CrnProtocol; |
| | | import com.zy.core.model.protocol.ShuttleProtocol; |
| | | import com.zy.core.model.protocol.StaProtocol; |
| | | import com.zy.core.model.protocol.SteProtocol; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.thread.BarcodeThread; |
| | | import com.zy.core.thread.LedThread; |
| | | import com.zy.core.thread.SiemensDevpThread; |
| | | import com.zy.core.thread.SteThread; |
| | | import com.zy.core.thread.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | private OrderMapper orderMapper; |
| | | @Autowired |
| | | private OrderDetlMapper orderDetlMapper; |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | /** |
| | | * 组托 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 入出库 ===>> 四向穿梭车入出库作业下发 |
| | | */ |
| | | public synchronized void shuttleIoExecute() { |
| | | for (ShuttleSlave shuttle : slaveProperties.getShuttle()) { |
| | | //获取四向穿梭车信息 |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttle.getId()); |
| | | ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); |
| | | if (shuttleProtocol == null) { |
| | | continue; |
| | | } |
| | | |
| | | // 只有当四向穿梭车空闲 并且无任务时才继续执行 |
| | | if (shuttleProtocol.getBusyStatusType() == ShuttleStatusType.IDLE && shuttleProtocol.getTaskNo() == 0) { |
| | | //入出库逻辑 |
| | | for (WrkMast wrkSts : wrkMastMapper.selectList(new EntityWrapper<WrkMast>().eq("wrk_sts", 2))) { |
| | | //分配任务号 |
| | | shuttleProtocol.setTaskNo(wrkSts.getWrkNo().shortValue()); |
| | | //分配源库位 |
| | | shuttleProtocol.setSourceLocNo(wrkSts.getSourceLocNo()); |
| | | //分配目标库位 |
| | | shuttleProtocol.setLocNo(wrkSts.getLocNo()); |
| | | |
| | | |
| | | ShuttleAssignCommand assignCommand = new ShuttleAssignCommand(); |
| | | //四向穿梭车号 |
| | | assignCommand.setShuttleNo(shuttleProtocol.getShuttleNo()); |
| | | //任务号 |
| | | assignCommand.setTaskNo(wrkSts.getWrkNo().shortValue()); |
| | | //入出库模式 |
| | | assignCommand.setTaskMode((short) 0); |
| | | //源库位 |
| | | assignCommand.setSourceLocNo(wrkSts.getSourceLocNo()); |
| | | //目标库位 |
| | | assignCommand.setDistLocNo(wrkSts.getLocNo()); |
| | | |
| | | //下发任务 |
| | | MessageQueue.offer(SlaveType.Shuttle, assignCommand.getShuttleNo().intValue(), new Task(3, assignCommand)); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 四向穿梭车任务完成 |
| | | */ |
| | | public synchronized void shuttleFinished() { |
| | | for (ShuttleSlave shuttle : slaveProperties.getShuttle()) { |
| | | //获取四向穿梭车信息 |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttle.getId()); |
| | | ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); |
| | | if (shuttleProtocol == null) { |
| | | continue; |
| | | } |
| | | |
| | | //四向穿梭车状态为等待确认 |
| | | if (shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.WAITING.id && shuttleProtocol.getTaskNo() != 0) { |
| | | //将任务档标记为完成 |
| | | WrkMast wrkMast = wrkMastMapper.selectByWorkNo(shuttleProtocol.getTaskNo().intValue()); |
| | | if (wrkMast != null) { |
| | | wrkMast.setWrkSts(8L); |
| | | if (wrkMastMapper.updateById(wrkMast) > 0) { |
| | | //设置四向穿梭车为空闲状态 |
| | | shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE); |
| | | //任务号清零 |
| | | shuttleProtocol.setTaskNo((short) 0); |
| | | News.error("四向穿梭车处于等待确认且任务完成状态,复位。堆垛机号={},工作号={}", shuttleProtocol.getShuttleNo(), shuttleProtocol.getTaskNo()); |
| | | } else { |
| | | News.error("四向穿梭车处于等待确认且任务完成状态,复位失败,但未找到工作档。四向穿梭车号={},工作号={}", shuttleProtocol.getShuttleNo(), shuttleProtocol.getTaskNo()); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 入出库 ===>> 堆垛机入出库作业下发 |
| | | */ |
| | | public synchronized void crnIoExecute(){ |