| | |
| | | import HslCommunication.Profinet.Siemens.SiemensPLCS; |
| | | import HslCommunication.Profinet.Siemens.SiemensS7Net; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.core.common.Arith; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.asrs.entity.BasCrnOpt; |
| | | import com.zy.asrs.entity.BasCrnp; |
| | | import com.zy.asrs.service.BasCrnOptService; |
| | | import com.zy.asrs.service.BasCrnpService; |
| | | import com.zy.core.CrnThread; |
| | | import com.zy.core.cache.MessageQueue; |
| | |
| | | crnProtocol.setError4(siemensNet.getByteTransform().TransBool(result.Content, 28, 2)); |
| | | crnProtocol.setError5(siemensNet.getByteTransform().TransBool(result.Content, 30, 2)); |
| | | crnProtocol.setError6(siemensNet.getByteTransform().TransBool(result.Content, 32, 2)); |
| | | crnProtocol.setXSpeed(siemensNet.getByteTransform().TransSingle(result.Content, 34)); |
| | | float xSpeed = siemensNet.getByteTransform().TransSingle(result.Content, 34); |
| | | crnProtocol.setXSpeed((float) Arith.multiplys(3, xSpeed, 1.15)); |
| | | crnProtocol.setYSpeed(siemensNet.getByteTransform().TransSingle(result.Content, 38)); |
| | | crnProtocol.setZSpeed(siemensNet.getByteTransform().TransSingle(result.Content, 42)); |
| | | float zSpeed = siemensNet.getByteTransform().TransSingle(result.Content, 42); |
| | | crnProtocol.setZSpeed((float) Arith.multiplys(3, zSpeed, 5)); |
| | | crnProtocol.setXDistance(siemensNet.getByteTransform().TransSingle(result.Content, 46)); |
| | | crnProtocol.setYDistance(siemensNet.getByteTransform().TransSingle(result.Content, 50)); |
| | | crnProtocol.setXDuration(siemensNet.getByteTransform().TransSingle(result.Content, 54)); |
| | |
| | | array[8] = command.getDestinationPosZ(); |
| | | OperateResult result = siemensNet.Write("DB8.0", array); |
| | | if (result.IsSuccess) { |
| | | |
| | | try { |
| | | // 日志记录 |
| | | BasCrnOptService bean = SpringUtils.getBean(BasCrnOptService.class); |
| | | BasCrnOpt basCrnOpt = new BasCrnOpt( |
| | | command.getTaskNo().intValue(), // 任务号 |
| | | command.getCrnNo(), // 堆垛机[非空] |
| | | new Date(), // 下发时间 |
| | | command.getTaskModeType().toString(), // 模式 |
| | | command.getSourcePosX().intValue(), // 源排 |
| | | command.getSourcePosY().intValue(), // 源列 |
| | | command.getSourcePosZ().intValue(), // 源层 |
| | | null, // 源站 |
| | | command.getDestinationPosX().intValue(), // 目标排 |
| | | command.getDestinationPosY().intValue(), // 目标列 |
| | | command.getDestinationPosZ().intValue(), // 目标层 |
| | | null, // 目标站 |
| | | null, // 响应结果 |
| | | null, // 修改时间 |
| | | null // 修改人员 |
| | | ); |
| | | bean.insert(basCrnOpt); |
| | | } catch (Exception ignore) {} |
| | | |
| | | log.info("堆垛机命令下发[id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command)); |
| | | OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command))); |
| | | return true; |