| | |
| | | import com.zy.asrs.service.RowLastnoService; |
| | | import com.zy.asrs.service.WorkService; |
| | | import com.zy.asrs.utils.Utils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Slf4j |
| | | @Service("locMastService") |
| | | public class LocMastServiceImpl extends ServiceImpl<LocMastMapper, LocMast> implements LocMastService { |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<LocMast> queryFreeLocMastEnd(Integer row){ |
| | | return this.baseMapper.queryFreeLocMastEnd(row); |
| | | public List<LocMast> queryFreeLocMastEnd(Integer row, Short locType1){ |
| | | return this.baseMapper.queryFreeLocMastEnd(row, locType1); |
| | | } |
| | | @Override |
| | | public List<LocMast> queryFreeLocMastEnd0(Integer bay,Integer lev,Integer row){ |
| | | return this.baseMapper.queryFreeLocMastEnd0(bay,lev,row); |
| | | public List<LocMast> queryFreeLocMastEnd0(Integer bay,Integer lev,Integer row, Short locType1){ |
| | | return this.baseMapper.queryFreeLocMastEnd0(bay,lev,row, locType1); |
| | | } |
| | | |
| | | @Override |
| | | public List<LocMast> queryFreeLocMastEnd1(Integer row, Short locType1,Boolean inoutEveryday){ |
| | | return this.baseMapper.queryFreeLocMastEnd1(row, locType1,inoutEveryday); |
| | | } |
| | | |
| | | @Override |
| | | public List<LocMast> queryFreeLocMast2(Short locType1, Integer rowBeg, Integer rowEnd, Integer bayBeg, Integer bayEnd, Integer levBeg, Integer levEnd) { |
| | | return this.baseMapper.queryFreeLocMast2(locType1, rowBeg, rowEnd, bayBeg, bayEnd, levBeg, levEnd); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<String> queryGroupEmptyStock(String sourceLocNo) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Boolean checkEmptyCount(LocMast locMast) { |
| | | public Boolean checkEmptyCount(LocMast locMast, int quaOfBlank) { |
| | | if (locMast == null) { |
| | | return false; |
| | | } |
| | | return this.baseMapper.selectEmptyLocCount(locMast.getLocType1(), locMast.getCrnNo()) > 1; |
| | | boolean res = this.baseMapper.selectEmptyLocCount(locMast.getLocType1(), locMast.getCrnNo()) > quaOfBlank; |
| | | if (!res) { |
| | | log.warn("{}号堆垛机库位不足,因滞留空库位{}个", locMast.getCrnNo(), quaOfBlank); |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | @Override |
| | |
| | | rows = locNos.stream().map(item -> Integer.parseInt(item.substring(0, 2))).distinct().collect(Collectors.toList()); |
| | | } |
| | | |
| | | // if (!rows.retainAll(new ArrayList<Integer>() {{ add(1);add(2);add(3);}}) |
| | | // || !rows.retainAll(new ArrayList<Integer>() {{ add(8);add(9);add(10);add(11);}}) |
| | | // || !rows.retainAll(new ArrayList<Integer>() {{ add(15);add(16);add(17);add(18);}}) |
| | | // ) { |
| | | // locNos.sort(Comparator.comparingInt(o -> Integer.parseInt(o.substring(0, 2)))); |
| | | // } else if (!rows.retainAll(new ArrayList<Integer>() {{ add(4);add(5);add(6);add(7);}}) |
| | | // || !rows.retainAll(new ArrayList<Integer>() {{ add(12);add(13);add(14);}}) |
| | | // || !rows.retainAll(new ArrayList<Integer>() {{ add(19);add(20);add(21);}}) |
| | | // ) { |
| | | // locNos.sort((o1, o2) -> Integer.parseInt(o2.substring(0, 2)) - Integer.parseInt(o1.substring(0, 2))); |
| | | // plan first |
| | | // for (int i = 0; i<locNos.size(); i++) { |
| | | // LocMast locMast = this.selectById(locNos.get(i)); |
| | | // 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("X")) { |
| | | // return locMast; |
| | | // } else { |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | for (int i = 0; i<locNos.size(); i++) { |
| | | LocMast locMast = this.selectById(locNos.get(i)); |
| | | // return null; |
| | | |
| | | // plan second |
| | | LocMast finalRes = null; |
| | | for (String locNo : locNos) { |
| | | LocMast locMast = this.selectById(locNo); |
| | | 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("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 |