#
Junjie
2025-05-15 cadb481188032daabaabbda2259b98afead2c41b
src/main/java/com/zy/common/model/LocTypeDto.java
@@ -10,6 +10,7 @@
@Data
public class LocTypeDto {
    // 高低类型{0:未知,1:低库位,2:高库位}
    private Short locType1;
@@ -19,7 +20,15 @@
    // 轻重类型{0:未知,1:轻库位,2:重库位}
    private Short locType3;
    private Integer siteId;
    public LocTypeDto() {
    }
    public LocTypeDto(Short locType1, Short locType2, Short locType3) {
        this.locType1 = locType1;
        this.locType2 = locType2;
        this.locType3 = locType3;
    }
    public LocTypeDto(StaProtocol staProtocol) {
@@ -32,21 +41,19 @@
            this.locType1 = 2; // 高库位
        }
    }
    /**
     * 库位类型解析
     */
    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;
    }
}