| | |
| | | |
| | | WrkMast selectAllC(); |
| | | |
| | | List<WrkMast> selectWorkWaiting(Integer workNo); |
| | | WrkMast selectByWorkNo(Integer workNo); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 四向穿梭车任务完成 |
| | | */ |
| | | 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(){ |
| | |
| | | mainService.crnIoExecute(); |
| | | // 入出库 ===>> 四向穿梭车入出库作业下发 |
| | | mainService.shuttleIoExecute(); |
| | | //四向穿梭车任务完成 |
| | | mainService.shuttleFinished(); |
| | | // 入库 ===>> 执行堆垛机对工作档的完成操作 |
| | | mainService.storeFinished(); |
| | | // 入库 ===>> 执行穿梭车对工作档的完成操作 |
New file |
| | |
| | | package com.zy.core.enums; |
| | | |
| | | /** |
| | | * 四向穿梭车内部状态枚举 |
| | | */ |
| | | public enum ShuttleProtocolStatusType { |
| | | |
| | | IDLE(1, "空闲"), |
| | | WORKING(2, "作业中"), |
| | | WAITING(3, "等待确认"), |
| | | ; |
| | | |
| | | public Integer id; |
| | | public String desc; |
| | | |
| | | ShuttleProtocolStatusType(Integer id, String desc) { |
| | | this.id = id; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public static ShuttleProtocolStatusType get(Integer id) { |
| | | if (null == id) { |
| | | return null; |
| | | } |
| | | for (ShuttleProtocolStatusType type : ShuttleProtocolStatusType.values()) { |
| | | if (type.id.equals(id.intValue())) { |
| | | return type; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static ShuttleProtocolStatusType get(ShuttleProtocolStatusType type) { |
| | | if (null == type) { |
| | | return null; |
| | | } |
| | | for (ShuttleProtocolStatusType type2 : ShuttleProtocolStatusType.values()) { |
| | | if (type2 == type) { |
| | | return type2; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.zy.core.model.protocol; |
| | | |
| | | import com.zy.core.enums.ShuttleProtocolStatusType; |
| | | import com.zy.core.enums.ShuttleStatusType; |
| | | import com.zy.core.model.command.ShuttleAssignCommand; |
| | | import lombok.Data; |
| | |
| | | * 任务指令 |
| | | */ |
| | | private ShuttleAssignCommand assignCommand; |
| | | |
| | | /** |
| | | * 当前小车状态(内部自我维护) |
| | | */ |
| | | private Integer protocolStatus; |
| | | |
| | | /** |
| | | * 当前小车状态枚举 |
| | | */ |
| | | private ShuttleProtocolStatusType protocolStatusType; |
| | | |
| | | /** |
| | | * 源库位 |
| | |
| | | return (short) (this.batteryPower * 0.1); |
| | | } |
| | | |
| | | /** |
| | | * 设置小车状态 |
| | | */ |
| | | public void setProtocolStatus(Integer status) { |
| | | this.protocolStatus = status; |
| | | this.protocolStatusType = ShuttleProtocolStatusType.get(status); |
| | | } |
| | | |
| | | /** |
| | | * 设置小车状态 |
| | | */ |
| | | public void setProtocolStatus(ShuttleProtocolStatusType status) { |
| | | this.protocolStatus = status.id; |
| | | this.protocolStatusType = status; |
| | | } |
| | | |
| | | } |
| | |
| | | import com.zy.core.ThreadHandler; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.OutputQueue; |
| | | import com.zy.core.enums.ShuttleRunDirection; |
| | | import com.zy.core.enums.ShuttleStatusType; |
| | | import com.zy.core.enums.ShuttleTaskModeType; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.enums.*; |
| | | import com.zy.core.model.ShuttleSlave; |
| | | import com.zy.core.model.Task; |
| | | import com.zy.core.model.command.ShuttleAssignCommand; |
| | |
| | | if (null == shuttleProtocol) { |
| | | shuttleProtocol = new ShuttleProtocol(); |
| | | shuttleProtocol.setShuttleNo(slave.getId().shortValue()); |
| | | shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE); |
| | | } |
| | | |
| | | //----------读取四向穿梭车状态----------- |
| | |
| | | } |
| | | //删除redis |
| | | redisUtil.del("wrk_no_" + map.get("wrk_no").toString()); |
| | | |
| | | //对主线程抛出等待确认状态waiting |
| | | shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.WAITING); |
| | | |
| | | News.info("四向穿梭车任务执行完成等待确认中,穿梭车号={},任务数据={}", shuttleProtocol.getShuttleNo(), JSON.toJSON(command)); |
| | | } |
| | | |
| | | } |
| | |
| | | </foreach> |
| | | </select> |
| | | |
| | | <select id="selectWorkWaiting" resultMap="BaseResultMap"> |
| | | select * |
| | | from dbo.asr_wrk_mast |
| | | where 1=1 |
| | | wrk_no=#{workNo} and wrk_sts in (4,7) |
| | | </select> |
| | | <!-- <select id="selectWorkWaiting" resultMap="BaseResultMap">--> |
| | | <!-- select *--> |
| | | <!-- from dbo.asr_wrk_mast--> |
| | | <!-- where 1=1--> |
| | | <!-- wrk_no=#{workNo} and wrk_sts in (4,7)--> |
| | | <!-- </select>--> |
| | | |
| | | <select id="selectByWorkNo" resultMap="BaseResultMap"> |
| | | select top 1 * from dbo.asr_wrk_mast where wrk_no=#{workNo} |
| | | </select> |
| | | </mapper> |