自动化立体仓库 - WCS系统
#
zjj
2024-11-05 cdc12aeeb8aca9061796a27ecc2ceb3aa61c3737
src/main/java/com/zy/common/model/LocTypeDto.java
@@ -10,7 +10,7 @@
@Data
public class LocTypeDto {
    // 高低类型{0:未知,1:低库位,2:高库位}
    // 高低类型{0:未知,1:较低库位,2:低库位,3:高库位,4: 特高库位}
    private Short locType1;
    // 宽窄类型{0:未知,1:窄库位,2:宽库位}
@@ -22,14 +22,38 @@
    public LocTypeDto() {
    }
    public LocTypeDto(Short locType1, Short locType2, Short locType3) {
        this.locType1 = locType1;
        this.locType2 = locType2;
        this.locType3 = locType3;
    }
    public LocTypeDto(StaProtocol staProtocol) {
        if (staProtocol.isHigh() == staProtocol.isLow()) {
            throw new CoolException("plc高低检测异常");
        int trueLen = 0;
        if (staProtocol.isHigh()) {
            trueLen++;
        }
        if (staProtocol.isHigh1()) {
            trueLen++;
        }
        if (staProtocol.isLow()) {
            this.locType1 = 1; // 低库位
        } else {
            this.locType1 = 2; // 高库位
            trueLen++;
        }
        if (staProtocol.isLow1()) {
            trueLen++;
        }
        if (trueLen != 1) {
            throw new CoolException("plc高低检测异常");
        }
        if (staProtocol.isLow()) {
            this.locType1 = 1; // 较低库位
        } else if (staProtocol.isLow1()){
            this.locType1 = 2; // 低库位
        } else if (staProtocol.isHigh()){
            this.locType1 = 3; // 高库位
        } else if (staProtocol.isHigh1()){
            this.locType1 = 4; // 特高库位
        }
    }
@@ -38,14 +62,14 @@
     */
    public static LocTypeDto process(StaProtocol staProtocol) {
        LocTypeDto dto = new LocTypeDto();
        if (staProtocol.isHigh() == staProtocol.isLow()) {
            throw new CoolException("plc高低检测异常");
        }
        if (staProtocol.isLow()) {
            dto.setLocType1((short) 1); // 低库位
        } else {
            dto.setLocType1((short) 2); // 高库位
        }
//        if (staProtocol.isHigh() == staProtocol.isLow()) {
//            throw new CoolException("plc高低检测异常");
//        }
//        if (staProtocol.isLow()) {
//            dto.setLocType1((short) 1); // 低库位
//        } else {
//            dto.setLocType1((short) 2); // 高库位
//        }
        return dto;
    }