| | |
| | | import com.zy.asrs.entity.BasRgvOpt; |
| | | import com.zy.asrs.service.BasRgvOptService; |
| | | import com.zy.asrs.service.BasRgvService; |
| | | import com.zy.asrs.utils.NumUtils; |
| | | import com.zy.asrs.utils.RouteUtils; |
| | | import com.zy.core.ThreadHandler; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.OutputQueue; |
| | | import com.zy.core.enums.RgvStatusType; |
| | | import com.zy.core.enums.RgvTaskModeType; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.model.RgvSlave; |
| | |
| | | private void readStatus(){ |
| | | try { |
| | | OperateResultExOne<byte[]> result = siemensNet.Read("DB100.0", (short) 20); |
| | | OperateResultExOne<byte[]> resultV = siemensNet.Read("DB20.16", (short) 2); |
| | | // OperateResultExOne<byte[]> resultV = siemensNet.Read("DB20.16", (short) 2); |
| | | // OperateResultExOne<byte[]> resultE = siemensNet.Read("DB20.26", (short) 2); |
| | | if (result.IsSuccess) { |
| | | if (null == rgvProtocol) { |
| | | rgvProtocol = new RgvProtocol(); |
| | |
| | | rgvProtocol.setStatus(siemensNet.getByteTransform().TransInt16(result.Content, 12)); |
| | | rgvProtocol.setxSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 14)); |
| | | rgvProtocol.setRgvPos(siemensNet.getByteTransform().TransUInt32(result.Content, 16)); |
| | | rgvProtocol.setInstantaneousSpeed(Double.valueOf(siemensNet.getByteTransform().TransInt16(resultV.Content, 0))); |
| | | // rgvProtocol.setInstantaneousSpeed((double) siemensNet.getByteTransform().TransInt16(resultV.Content, 0)); |
| | | // rgvProtocol.setEndStaM(siemensNet.getByteTransform().TransInt16(resultE.Content, 0)); |
| | | // rgvProtocol.setRgvPos((long)NumUtils.GetRandomIntInRange(1737000)); |
| | | OutputQueue.RGV.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId())); |
| | | |
| | |
| | | array[4] = command.getTaskNo1(); |
| | | |
| | | OperateResult result = siemensNet.Write("DB24.0", array); |
| | | |
| | | if (command.getAckFinish1().equals((short)0)) { |
| | | Thread.sleep(100L); |
| | | result = siemensNet.Write("DB24.10.0", true); |
| | | } else { |
| | | siemensNet.Write("DB24.10.1", true); |
| | |
| | | } catch (Exception ignore) {} |
| | | |
| | | if (result != null && result.IsSuccess) { |
| | | Thread.sleep(200); |
| | | Thread.sleep(400); |
| | | this.readStatus(); |
| | | log.info("RGV 工位1命令下发[id:{}] >>>>> {}", slave.getId(), JSON.toJSONString(command)); |
| | | OutputQueue.RGV.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 工位1命令下发: {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSONString(command))); |
| | |
| | | result = siemensNet.Write("DB24.10.0", true); |
| | | } else { |
| | | siemensNet.Write("DB24.10.1", true); |
| | | log.info("任务完成后复位清除rgv信息:小车号:{},ack:{}", command.getRgvNo(),command.getAckFinish1()); |
| | | } |
| | | |
| | | try { |