| | |
| | | package com.zy.common.model; |
| | | |
| | | import com.core.exception.CoolException; |
| | | import com.zy.core.model.protocol.StaProtocol; |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | |
| | | // 轻重类型{0:未知,1:轻库位,2:重库位} |
| | | private Short locType3; |
| | | |
| | | 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; |
| | | } |
| | | |
| | | } |