| | |
| | | package com.zy.acs.common.domain.protocol; |
| | | |
| | | import com.zy.acs.framework.common.RadixTools; |
| | | import com.zy.acs.common.domain.AgvActionItem; |
| | | import com.zy.acs.common.utils.QrCodeCodecSupport; |
| | | import com.zy.acs.common.utils.Utils; |
| | | import lombok.Data; |
| | | |
| | |
| | | |
| | | byte[] pathBytes = new byte[0]; |
| | | for (AgvActionItem<? extends IActionBody> item : actionItems) { |
| | | byte[] bytes = RadixTools.intToBytes(Integer.parseInt(item.getQrCode())); |
| | | byte[] qrCodeBytes = Utils.reverse(bytes); |
| | | byte[] qrCodeBytes = QrCodeCodecSupport.encode(item.getQrCode()); |
| | | byte actionCodeByte = (byte) item.getActionCmdType().actionCode; |
| | | byte valByte = (byte) item.getVal(); |
| | | byte[] actionBodyBytes = item.getActionBody().writeToBytes(); |
| | |
| | | package com.zy.acs.common.domain.protocol; |
| | | |
| | | import com.zy.acs.common.constant.CommonConstant; |
| | | import com.zy.acs.framework.common.RadixTools; |
| | | import com.zy.acs.common.utils.QrCodeCodecSupport; |
| | | import com.zy.acs.common.utils.Utils; |
| | | import lombok.Data; |
| | | |
| | |
| | | , (byte) this.faultLevel |
| | | , Utils.reverse(RadixTools.intToBytes(this.data1)) |
| | | , Utils.reverse(RadixTools.intToBytes(this.data2)) |
| | | , Utils.reverse(RadixTools.intToBytes(Integer.parseInt(this.qrCode))) |
| | | , QrCodeCodecSupport.encode(this.qrCode) |
| | | ); |
| | | } |
| | | |
| | |
| | | // //故障标志位 |
| | | // this.flag = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, 12, 4)); |
| | | //地面码ID |
| | | this.qrCode = Utils.zeroFill(String.valueOf(RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, 12, 4))), CommonConstant.QR_CODE_LEN);; |
| | | this.qrCode = QrCodeCodecSupport.decode(bytes, 12); |
| | | |
| | | } |
| | | |
| | |
| | | package com.zy.acs.common.domain.protocol; |
| | | |
| | | import com.zy.acs.common.constant.CommonConstant; |
| | | import com.zy.acs.common.utils.QrCodeCodecSupport; |
| | | import com.zy.acs.common.utils.Utils; |
| | | import com.zy.acs.framework.common.RadixTools; |
| | | import lombok.Data; |
| | |
| | | |
| | | @Override |
| | | public void readFromBytes(byte[] bytes) { |
| | | int qrCodeBytes = QrCodeCodecSupport.qrCodeBytes(); |
| | | int qrCodePos = 16; |
| | | int actionCodePos = qrCodePos + qrCodeBytes; |
| | | // 流水号 |
| | | this.serialNo = new String(Utils.sliceWithReverse(bytes, 0, 16)); |
| | | // 地面码ID |
| | | this.qrCode = Utils.zeroFill(String.valueOf(RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, 16, 4))), CommonConstant.QR_CODE_LEN); |
| | | this.qrCode = QrCodeCodecSupport.decode(bytes, qrCodePos); |
| | | // 动作码 |
| | | this.actionCode = Utils.slice(bytes, 20, 1)[0]; |
| | | this.actionCode = Utils.slice(bytes, actionCodePos, 1)[0]; |
| | | // 属性值 |
| | | this.val = Utils.slice(bytes, 21, 1)[0]; |
| | | this.val = Utils.slice(bytes, actionCodePos + 1, 1)[0]; |
| | | // 动作参数 |
| | | byte[] actionBodyBytes = Utils.sliceWithReverse(bytes, 22, 2); |
| | | byte[] actionBodyBytes = Utils.sliceWithReverse(bytes, actionCodePos + 2, 2); |
| | | this.actionBody = RadixTools.byteToShort(actionBodyBytes); |
| | | //预留字段 |
| | | this.reservedField = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, 24, 4)); |
| | | this.reservedField = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, actionCodePos + 4, 4)); |
| | | } |
| | | |
| | | // 流水号 - 16 |
| | |
| | | import com.zy.acs.framework.common.RadixTools; |
| | | import com.zy.acs.common.constant.CommonConstant; |
| | | import com.zy.acs.common.enums.AgvCompleteType; |
| | | import com.zy.acs.common.utils.QrCodeCodecSupport; |
| | | import com.zy.acs.common.utils.Utils; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | |
| | | @Override |
| | | public void readFromBytes(byte[] bytes) { |
| | | int qrCodeBytes = QrCodeCodecSupport.qrCodeBytes(); |
| | | int qrCodePos = 17; |
| | | int directionPos = qrCodePos + qrCodeBytes; |
| | | int locCodePos = directionPos + 2; |
| | | int boxCodePos = locCodePos + 16; |
| | | // try { |
| | | this.serialNo = new String(Utils.sliceWithReverse(bytes, 0, 16)); |
| | | // } catch (UnsupportedEncodingException e) { |
| | |
| | | // } |
| | | this.completeCode = Utils.slice(bytes, 16, 1)[0]; |
| | | this.completeType = AgvCompleteType.query(this.completeCode); |
| | | this.qrCode = Utils.zeroFill(String.valueOf(RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, 17, 4))), CommonConstant.QR_CODE_LEN); |
| | | this.direction = RadixTools.byteToShort(Utils.sliceWithReverse(bytes, 21,2)); |
| | | this.qrCode = QrCodeCodecSupport.decode(bytes, qrCodePos); |
| | | this.direction = RadixTools.byteToShort(Utils.sliceWithReverse(bytes, directionPos, 2)); |
| | | // this.locCode = new String(Utils.sliceWithReverse(bytes, 23, 16)).replaceAll("\\u0000", ""); |
| | | // this.boxCode = new String(Utils.sliceWithReverse(bytes, 39, 16)).replaceAll("\\u0000", ""); |
| | | this.locCode = Utils.zeroFill(String.valueOf(RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, 23, 4))), CommonConstant.QR_CODE_LEN); |
| | | this.boxCode = Utils.zeroFill(String.valueOf(RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, 39, 4))), CommonConstant.QR_CODE_LEN); |
| | | this.locCode = Utils.zeroFill(String.valueOf(RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, locCodePos, 4))), CommonConstant.QR_CODE_LEN); |
| | | this.boxCode = Utils.zeroFill(String.valueOf(RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, boxCodePos, 4))), CommonConstant.QR_CODE_LEN); |
| | | } |
| | | |
| | | private String serialNo; |
| | |
| | | package com.zy.acs.common.domain.protocol; |
| | | |
| | | import com.zy.acs.framework.common.RadixTools; |
| | | import com.zy.acs.common.constant.CommonConstant; |
| | | import com.zy.acs.common.utils.QrCodeCodecSupport; |
| | | import com.zy.acs.common.utils.Utils; |
| | | import lombok.Data; |
| | | |
| | |
| | | |
| | | @Override |
| | | public void readFromBytes(byte[] bytes) { |
| | | int qrCodeBytes = QrCodeCodecSupport.qrCodeBytes(); |
| | | int offsetXPos = qrCodeBytes; |
| | | int offsetYPos = offsetXPos + 2; |
| | | int groundCodeOffsetPos = offsetYPos + 2; |
| | | int statusPos = groundCodeOffsetPos + 4; |
| | | int straightDirectionPos = statusPos + 1; |
| | | int currentAnglePos = straightDirectionPos + 4; |
| | | int gyroAnglePos = currentAnglePos + 4; |
| | | int encoderAnglePos = gyroAnglePos + 4; |
| | | int currentAltitudePos = encoderAnglePos + 4; |
| | | int forkLengthPos = currentAltitudePos + 2; |
| | | int loaderThetaPos = forkLengthPos + 2; |
| | | int sensorStatusPos = loaderThetaPos + 2; |
| | | //地面码ID |
| | | this.qrCode = Utils.zeroFill(String.valueOf(RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, 0, 4))), CommonConstant.QR_CODE_LEN);; |
| | | this.qrCode = QrCodeCodecSupport.decode(bytes, 0); |
| | | //地面码偏移x |
| | | this.offsetX = RadixTools.byteToShort(Utils.sliceWithReverse(bytes, 4 , 2)); |
| | | this.offsetX = RadixTools.byteToShort(Utils.sliceWithReverse(bytes, offsetXPos , 2)); |
| | | //地面码偏移y |
| | | this.offsetY = RadixTools.byteToShort(Utils.sliceWithReverse(bytes, 6, 2)); |
| | | this.offsetY = RadixTools.byteToShort(Utils.sliceWithReverse(bytes, offsetYPos, 2)); |
| | | //地面码偏移θ |
| | | this.groundCodeOffset0 = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, 8, 4)); |
| | | this.groundCodeOffset0 = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, groundCodeOffsetPos, 4)); |
| | | //当前状态 |
| | | this.status = Utils.slice(bytes, 12, 1)[0]; |
| | | this.status = Utils.slice(bytes, statusPos, 1)[0]; |
| | | //直行方向坐标 |
| | | this.straightDirectionPosition = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, 13, 4)); |
| | | this.straightDirectionPosition = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, straightDirectionPos, 4)); |
| | | //AGV当前角度 |
| | | // this.AGVCurrentAngle = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, 17, 4)); |
| | | this.AGVCurrentAngle = ByteBuffer.wrap(Utils.sliceWithReverse(bytes, 17, 4)).getFloat(); |
| | | // this.AGVCurrentAngle = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, currentAnglePos, 4)); |
| | | this.AGVCurrentAngle = ByteBuffer.wrap(Utils.sliceWithReverse(bytes, currentAnglePos, 4)).getFloat(); |
| | | //陀螺仪角度 |
| | | this.gyroAngle = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, 21, 4)); |
| | | this.gyroAngle = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, gyroAnglePos, 4)); |
| | | //编码器角度 |
| | | this.encoderAngle = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, 25, 4)); |
| | | this.encoderAngle = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, encoderAnglePos, 4)); |
| | | //当前高度 |
| | | this.currentAltitude = RadixTools.byteToShort(Utils.sliceWithReverse(bytes, 29, 2)); |
| | | this.currentAltitude = RadixTools.byteToShort(Utils.sliceWithReverse(bytes, currentAltitudePos, 2)); |
| | | //货叉伸出距离 |
| | | this.forkLength = RadixTools.byteToShort(Utils.sliceWithReverse(bytes, 31, 2)); |
| | | this.forkLength = RadixTools.byteToShort(Utils.sliceWithReverse(bytes, forkLengthPos, 2)); |
| | | //载货台旋转角度 |
| | | this.loaderTheta = RadixTools.byteToShort(Utils.sliceWithReverse(bytes, 33, 2)); |
| | | this.loaderTheta = RadixTools.byteToShort(Utils.sliceWithReverse(bytes, loaderThetaPos, 2)); |
| | | //传感器状态标志 |
| | | // this.sensorStatusFlags = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, 35, 4)); |
| | | // this.sensorStatusFlags = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, sensorStatusPos, 4)); |
| | | |
| | | byte[] sensorStatusBytes = Utils.slice(bytes, 35, 4); |
| | | byte[] sensorStatusBytes = Utils.slice(bytes, sensorStatusPos, 4); |
| | | parseSensorStatue(sensorStatusBytes); |
| | | } |
| | | |
| | |
| | | package com.zy.acs.common.domain.protocol; |
| | | |
| | | import com.zy.acs.framework.common.RadixTools; |
| | | import com.zy.acs.common.constant.CommonConstant; |
| | | import com.zy.acs.common.utils.QrCodeCodecSupport; |
| | | import com.zy.acs.common.utils.Utils; |
| | | import lombok.Data; |
| | | |
| | |
| | | |
| | | @Override |
| | | public void readFromBytes(byte[] bytes) { |
| | | int qrCodeBytes = QrCodeCodecSupport.qrCodeBytes(); |
| | | int statusPos = qrCodeBytes; |
| | | int straightDirectionPos = statusPos + 1; |
| | | int currentAnglePos = straightDirectionPos + 4; |
| | | int gyroAnglePos = currentAnglePos + 4; |
| | | int encoderAnglePos = gyroAnglePos + 4; |
| | | int currentAltitudePos = encoderAnglePos + 4; |
| | | int forkLengthPos = currentAltitudePos + 2; |
| | | int loaderThetaPos = forkLengthPos + 2; |
| | | int sensorStatusPos = loaderThetaPos + 2; |
| | | //地面码ID |
| | | this.qrCode = Utils.zeroFill(String.valueOf(RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, 0, 4))), CommonConstant.QR_CODE_LEN);; |
| | | this.qrCode = QrCodeCodecSupport.decode(bytes, 0); |
| | | //当前状态 |
| | | this.status = Utils.slice(bytes, 4, 1)[0]; |
| | | this.status = Utils.slice(bytes, statusPos, 1)[0]; |
| | | //直行方向坐标 |
| | | this.straightDirectionPosition = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, 5, 4)); |
| | | this.straightDirectionPosition = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, straightDirectionPos, 4)); |
| | | //AGV当前角度 |
| | | // this.AGVCurrentAngle = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, 9, 4)); |
| | | this.AGVCurrentAngle = ByteBuffer.wrap(Utils.sliceWithReverse(bytes, 9, 4)).getFloat(); |
| | | // this.AGVCurrentAngle = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, currentAnglePos, 4)); |
| | | this.AGVCurrentAngle = ByteBuffer.wrap(Utils.sliceWithReverse(bytes, currentAnglePos, 4)).getFloat(); |
| | | //陀螺仪角度 |
| | | this.gyroAngle = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, 13, 4)); |
| | | this.gyroAngle = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, gyroAnglePos, 4)); |
| | | //编码器角度 |
| | | this.encoderAngle = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, 17, 4)); |
| | | this.encoderAngle = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, encoderAnglePos, 4)); |
| | | //当前高度 |
| | | this.currentAltitude = RadixTools.byteToShort(Utils.sliceWithReverse(bytes, 21, 2)); |
| | | this.currentAltitude = RadixTools.byteToShort(Utils.sliceWithReverse(bytes, currentAltitudePos, 2)); |
| | | //货叉伸出距离 |
| | | this.forkLength = RadixTools.byteToShort(Utils.sliceWithReverse(bytes, 23, 2)); |
| | | this.forkLength = RadixTools.byteToShort(Utils.sliceWithReverse(bytes, forkLengthPos, 2)); |
| | | //载货台旋转角度 |
| | | this.loaderTheta = RadixTools.byteToShort(Utils.sliceWithReverse(bytes, 25, 2)); |
| | | this.loaderTheta = RadixTools.byteToShort(Utils.sliceWithReverse(bytes, loaderThetaPos, 2)); |
| | | //传感器状态标志 |
| | | // this.sensorStatusFlags = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, 27, 4)); |
| | | // this.sensorStatusFlags = RadixTools.bytesToInt(Utils.sliceWithReverse(bytes, sensorStatusPos, 4)); |
| | | |
| | | byte[] sensorStatusBytes = Utils.slice(bytes, 27, 4); |
| | | byte[] sensorStatusBytes = Utils.slice(bytes, sensorStatusPos, 4); |
| | | parseSensorStatue(sensorStatusBytes); |
| | | } |
| | | |
| New file |
| | |
| | | package com.zy.acs.common.utils; |
| | | |
| | | import java.math.BigInteger; |
| | | import java.nio.charset.Charset; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.Arrays; |
| | | import java.util.Locale; |
| | | |
| | | /** |
| | | * 地码编解码规则,按进程级配置生效。 |
| | | */ |
| | | public final class QrCodeCodecSupport { |
| | | |
| | | private static volatile CodecConfig config = CodecConfig.defaultConfig(); |
| | | |
| | | private QrCodeCodecSupport() { |
| | | } |
| | | |
| | | public static void configure(String mode, Integer bytes, Integer displayLength, String charsetName) { |
| | | config = CodecConfig.of(mode, bytes, displayLength, charsetName); |
| | | } |
| | | |
| | | public static int qrCodeBytes() { |
| | | return config.bytes; |
| | | } |
| | | |
| | | public static String decode(byte[] bytes, int pos) { |
| | | byte[] qrCodeBytes = Utils.sliceWithReverse(bytes, pos, config.bytes); |
| | | if (config.mode == Mode.NUMERIC) { |
| | | return Utils.zeroFill(unsignedValue(qrCodeBytes).toString(), config.displayLength); |
| | | } |
| | | return stripPadding(new String(qrCodeBytes, config.charset)); |
| | | } |
| | | |
| | | public static byte[] encode(String qrCode) { |
| | | if (config.mode == Mode.NUMERIC) { |
| | | return Utils.reverse(toFixedNumericBytes(qrCode, config.bytes)); |
| | | } |
| | | return Utils.reverse(toFixedStringBytes(qrCode, config.bytes, config.charset)); |
| | | } |
| | | |
| | | private static BigInteger unsignedValue(byte[] bytes) { |
| | | return bytes.length == 0 ? BigInteger.ZERO : new BigInteger(1, bytes); |
| | | } |
| | | |
| | | private static byte[] toFixedNumericBytes(String qrCode, int size) { |
| | | String value = qrCode == null ? "" : qrCode.trim(); |
| | | if (value.isEmpty()) { |
| | | value = "0"; |
| | | } |
| | | BigInteger numeric = new BigInteger(value); |
| | | if (numeric.signum() < 0) { |
| | | throw new IllegalArgumentException("qrCode must not be negative: " + qrCode); |
| | | } |
| | | byte[] raw = numeric.toByteArray(); |
| | | if (raw.length > 1 && raw[0] == 0) { |
| | | raw = Arrays.copyOfRange(raw, 1, raw.length); |
| | | } |
| | | if (raw.length > size) { |
| | | throw new IllegalArgumentException("qrCode exceeds configured byte size: " + qrCode); |
| | | } |
| | | byte[] result = new byte[size]; |
| | | System.arraycopy(raw, 0, result, size - raw.length, raw.length); |
| | | return result; |
| | | } |
| | | |
| | | private static byte[] toFixedStringBytes(String qrCode, int size, Charset charset) { |
| | | String value = qrCode == null ? "" : qrCode; |
| | | byte[] raw = value.getBytes(charset); |
| | | if (raw.length > size) { |
| | | throw new IllegalArgumentException("qrCode exceeds configured byte size: " + qrCode); |
| | | } |
| | | byte[] result = new byte[size]; |
| | | Arrays.fill(result, (byte) '0'); |
| | | System.arraycopy(raw, 0, result, size - raw.length, raw.length); |
| | | return result; |
| | | } |
| | | |
| | | private static String stripPadding(String value) { |
| | | int end = value.length(); |
| | | while (end > 0 && value.charAt(end - 1) == '\u0000') { |
| | | end--; |
| | | } |
| | | return value.substring(0, end); |
| | | } |
| | | |
| | | private enum Mode { |
| | | NUMERIC, |
| | | STRING; |
| | | |
| | | static Mode of(String value) { |
| | | if (value == null) { |
| | | return NUMERIC; |
| | | } |
| | | String normalized = value.trim().toUpperCase(Locale.ROOT); |
| | | if ("STRING".equals(normalized)) { |
| | | return STRING; |
| | | } |
| | | return NUMERIC; |
| | | } |
| | | } |
| | | |
| | | private static final class CodecConfig { |
| | | private final Mode mode; |
| | | private final int bytes; |
| | | private final int displayLength; |
| | | private final Charset charset; |
| | | |
| | | private CodecConfig(Mode mode, int bytes, int displayLength, Charset charset) { |
| | | this.mode = mode; |
| | | this.bytes = bytes; |
| | | this.displayLength = displayLength; |
| | | this.charset = charset; |
| | | } |
| | | |
| | | static CodecConfig defaultConfig() { |
| | | return new CodecConfig(Mode.NUMERIC, 4, 8, StandardCharsets.US_ASCII); |
| | | } |
| | | |
| | | static CodecConfig of(String mode, Integer bytes, Integer displayLength, String charsetName) { |
| | | Mode resolvedMode = Mode.of(mode); |
| | | int resolvedBytes = bytes == null || bytes <= 0 ? 4 : bytes; |
| | | int resolvedDisplayLength = displayLength == null || displayLength <= 0 ? 8 : displayLength; |
| | | Charset resolvedCharset = charsetName == null || charsetName.trim().isEmpty() |
| | | ? StandardCharsets.US_ASCII |
| | | : Charset.forName(charsetName.trim()); |
| | | return new CodecConfig(resolvedMode, resolvedBytes, resolvedDisplayLength, resolvedCharset); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | package com.zy.acs.gateway.config; |
| | | |
| | | import com.zy.acs.common.utils.QrCodeCodecSupport; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | |
| | | @Configuration |
| | | @ConfigurationProperties(prefix = "agv-codec") |
| | | public class AgvCodecProperties { |
| | | |
| | | private String qrCodeMode = "numeric"; |
| | | |
| | | private Integer qrCodeBytes = 4; |
| | | |
| | | private Integer qrCodeDisplayLength = 8; |
| | | |
| | | private String qrCodeCharset = "ASCII"; |
| | | |
| | | @PostConstruct |
| | | public void init() { |
| | | QrCodeCodecSupport.configure(qrCodeMode, qrCodeBytes, qrCodeDisplayLength, qrCodeCharset); |
| | | } |
| | | |
| | | public String getQrCodeMode() { |
| | | return qrCodeMode; |
| | | } |
| | | |
| | | public void setQrCodeMode(String qrCodeMode) { |
| | | this.qrCodeMode = qrCodeMode; |
| | | } |
| | | |
| | | public Integer getQrCodeBytes() { |
| | | return qrCodeBytes; |
| | | } |
| | | |
| | | public void setQrCodeBytes(Integer qrCodeBytes) { |
| | | this.qrCodeBytes = qrCodeBytes; |
| | | } |
| | | |
| | | public Integer getQrCodeDisplayLength() { |
| | | return qrCodeDisplayLength; |
| | | } |
| | | |
| | | public void setQrCodeDisplayLength(Integer qrCodeDisplayLength) { |
| | | this.qrCodeDisplayLength = qrCodeDisplayLength; |
| | | } |
| | | |
| | | public String getQrCodeCharset() { |
| | | return qrCodeCharset; |
| | | } |
| | | |
| | | public void setQrCodeCharset(String qrCodeCharset) { |
| | | this.qrCodeCharset = qrCodeCharset; |
| | | } |
| | | } |
| | |
| | | file: |
| | | path: stock/out/rcs-gateway/logs |
| | | |
| | | agv-codec: |
| | | qr-code-mode: numeric |
| | | qr-code-bytes: 4 |
| | | qr-code-display-length: 8 |
| | | qr-code-charset: ASCII |
| | | |
| | | agv-tcp: |
| | | #tcp/ip协议端口 |
| | | port: 8899 |
| New file |
| | |
| | | package com.zy.acs.manager.common.config; |
| | | |
| | | import com.zy.acs.common.utils.QrCodeCodecSupport; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | |
| | | @Configuration |
| | | @ConfigurationProperties(prefix = "agv-codec") |
| | | public class AgvCodecProperties { |
| | | |
| | | private String qrCodeMode = "numeric"; |
| | | |
| | | private Integer qrCodeBytes = 4; |
| | | |
| | | private Integer qrCodeDisplayLength = 8; |
| | | |
| | | private String qrCodeCharset = "ASCII"; |
| | | |
| | | @PostConstruct |
| | | public void init() { |
| | | QrCodeCodecSupport.configure(qrCodeMode, qrCodeBytes, qrCodeDisplayLength, qrCodeCharset); |
| | | } |
| | | |
| | | public String getQrCodeMode() { |
| | | return qrCodeMode; |
| | | } |
| | | |
| | | public void setQrCodeMode(String qrCodeMode) { |
| | | this.qrCodeMode = qrCodeMode; |
| | | } |
| | | |
| | | public Integer getQrCodeBytes() { |
| | | return qrCodeBytes; |
| | | } |
| | | |
| | | public void setQrCodeBytes(Integer qrCodeBytes) { |
| | | this.qrCodeBytes = qrCodeBytes; |
| | | } |
| | | |
| | | public Integer getQrCodeDisplayLength() { |
| | | return qrCodeDisplayLength; |
| | | } |
| | | |
| | | public void setQrCodeDisplayLength(Integer qrCodeDisplayLength) { |
| | | this.qrCodeDisplayLength = qrCodeDisplayLength; |
| | | } |
| | | |
| | | public String getQrCodeCharset() { |
| | | return qrCodeCharset; |
| | | } |
| | | |
| | | public void setQrCodeCharset(String qrCodeCharset) { |
| | | this.qrCodeCharset = qrCodeCharset; |
| | | } |
| | | } |
| | |
| | | file: |
| | | path: stock/out/rcs-manager/logs |
| | | |
| | | agv-codec: |
| | | qr-code-mode: numeric |
| | | qr-code-bytes: 4 |
| | | qr-code-display-length: 8 |
| | | qr-code-charset: ASCII |
| | | |
| | | config: |
| | | system-name: @pom.artifactId@ |
| | | system-version: @pom.version@ |