|  |  | 
 |  |  | package com.zy.common.model; | 
 |  |  |  | 
 |  |  | import com.alibaba.fastjson.JSON; | 
 |  |  | import com.core.exception.CoolException; | 
 |  |  | import com.zy.core.model.protocol.StaProtocol; | 
 |  |  | import com.zy.asrs.entity.BasDevp; | 
 |  |  | import lombok.Data; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2020/10/19 | 
 |  |  |  */ | 
 |  |  | @Slf4j | 
 |  |  | @Data | 
 |  |  | public class LocTypeDto { | 
 |  |  |  | 
 |  |  | 
 |  |  |     // 轻重类型{0:未知,1:轻库位,2:重库位} | 
 |  |  |     private Short locType3; | 
 |  |  |  | 
 |  |  |     private Integer siteId; | 
 |  |  |  | 
 |  |  |     public LocTypeDto() { | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public LocTypeDto(StaProtocol staProtocol) { | 
 |  |  |         if (staProtocol.isHigh() == staProtocol.isLow()) { | 
 |  |  |     public LocTypeDto(BasDevp basDevp) { | 
 |  |  |         if (basDevp.getLocType1() == null || basDevp.getLocType1() == 0) { | 
 |  |  |             throw new CoolException("plc高低检测异常"); | 
 |  |  |         } | 
 |  |  |         if (staProtocol.isLow()) { | 
 |  |  |         if (basDevp.getLocType1() == 1) { | 
 |  |  |             this.locType1 = 1; // 低库位 | 
 |  |  |         } else { | 
 |  |  |             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); // 高库位 | 
 |  |  |         } | 
 |  |  |         return dto; | 
 |  |  |         this.locType1 = 1; // 低库位 | 
 |  |  |         log.info(JSON.toJSONString(this)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } |