| | |
| | | import com.zy.asrs.service.WorkService; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.service.CommonService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | | @Service("locMastService") |
| | | public class LocMastServiceImpl extends ServiceImpl<LocMastMapper, LocMast> implements LocMastService { |
| | | |
| | |
| | | |
| | | @Override |
| | | public List<LocMast> queryFreeLocMast(List<Integer> rows, Integer rowsLen, Short locType1) { |
| | | return this.baseMapper.queryFreeLocMast(rows, rowsLen, locType1); |
| | | } |
| | | |
| | | @Override |
| | | public List<LocMast> queryFreeLocMast2(List<Integer> rows, Integer rowsLen, Short locType1) { |
| | | return this.baseMapper.queryFreeLocMast(rows, rowsLen, locType1); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Boolean checkEmptyCount(LocMast locMast) { |
| | | public Boolean checkEmptyCount(LocMast locMast, int quaOfBlank) { |
| | | if (locMast == null) { |
| | | return false; |
| | | } |
| | | return this.baseMapper.selectEmptyLocCount(locMast.getCrnNo()) > 1; |
| | | return this.baseMapper.selectEmptyLocCount(locMast.getCrnNo()) > quaOfBlank; |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public Boolean isOutMost(String locNo, Boolean pakin) { |
| | | return Integer.parseInt(locNo.substring(0, 2)) == Utils.getOutLayerRow(locNo, true); |
| | | return Integer.parseInt(locNo.substring(0, 2)) == Utils.getOutLayerRow(locNo, pakin); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | |
| | | } else { |
| | | throw new RuntimeException("库位解析异常"); |
| | | } |
| | | // 入库外层库位滞空 |
| | | for (int i = 0; i<locNos.size() - 1; i++) { |
| | | LocMast locMast = this.selectById(locNos.get(i)); |
| | | |
| | | // plan second |
| | | LocMast finalRes = null; |
| | | for (String locNo0 : locNos) { |
| | | LocMast locMast = this.selectById(locNo0); |
| | | if (locMast.getLocSts().equals("O")) { |
| | | if (i == 0) { |
| | | return locMast; |
| | | } else { |
| | | LocMast lastLoc = this.selectById(locNos.get(i - 1)); |
| | | if (lastLoc.getLocSts().equals("F") || lastLoc.getLocSts().equals("D") |
| | | || lastLoc.getLocSts().equals("S") || lastLoc.getLocSts().equals("X")) { |
| | | return locMast; |
| | | } else { |
| | | break; |
| | | } |
| | | if (finalRes == null) { |
| | | finalRes = locMast; |
| | | } |
| | | } else { |
| | | if (finalRes != null) { |
| | | log.error("{}库位异常:{}库位状态为O.空库位,但{}库位状态为{}", finalRes.getLocNo(), finalRes.getLocNo(), locMast.getLocNo(), locMast.getLocSts()); |
| | | finalRes = null; |
| | | break; |
| | | } |
| | | if (locMast.getLocSts().equals("R") || locMast.getLocSts().equals("P")) { |
| | | finalRes = null; |
| | | break; |
| | | } |
| | | finalRes = null; |
| | | } |
| | | } |
| | | return null; |
| | | return finalRes; |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public Integer getOutCrnNo(LocMast locMast) { |
| | | int row = Utils.getRow(locMast.getLocNo()); |
| | | if (CommonService.FIRST_GROUP_ROW_LIST.contains(row)) { |
| | | return 1; |
| | | } |
| | | if (CommonService.SECOND_GROUP_ROW_LIST.contains(row)) { |
| | | return 3; |
| | | } else { |
| | | return locMast.getCrnNo(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | } |