| | |
| | | import com.zy.asrs.mapper.LocMastMapper; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.service.RowLastnoService; |
| | | import com.zy.asrs.service.WorkService; |
| | | import com.zy.asrs.utils.Utils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private RowLastnoService rowLastnoService; |
| | | @Autowired |
| | | private WorkService workService; |
| | | |
| | | @Override |
| | | public LocMast queryFreeLocMast(Integer row, List<Integer> rows, Integer rowsLen, Short locType1) { |
| | | List<LocMast> locMasts = this.baseMapper.queryFreeLocMast(row, rows, rowsLen, locType1); |
| | | if (Cools.isEmpty(locMasts)) { |
| | | return null; |
| | | } |
| | | Integer innermostRow = Utils.getInnermostRow(locMasts.get(0).getLocNo()); |
| | | for (LocMast locMast : locMasts) { |
| | | if (locMast.getRow1().equals(innermostRow)) { |
| | | return locMast; |
| | | } |
| | | } |
| | | return null; |
| | | public List<LocMast> queryFreeLocMast(List<Integer> rows, Integer rowsLen, Short locType1) { |
| | | return this.baseMapper.queryFreeLocMast(rows, rowsLen, locType1); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public LocMast findOutMost(List<String> locNos) { |
| | | List<Integer> 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);}}) |
| | | ) { |
| | | if (!rows.retainAll(new ArrayList<Integer>() {{ add(1);add(2);add(3);}})) { |
| | | 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))); |
| | | } else { |
| | | rows = locNos.stream().map(item -> Integer.parseInt(item.substring(0, 2))).distinct().collect(Collectors.toList()); |
| | | } |
| | | |
| | | if (!rows.retainAll(new ArrayList<Integer>() {{ add(8);add(9);add(10);add(11);}})) { |
| | | locNos.sort(Comparator.comparingInt(o -> Integer.parseInt(o.substring(0, 2)))); |
| | | } else { |
| | | rows = locNos.stream().map(item -> Integer.parseInt(item.substring(0, 2))).distinct().collect(Collectors.toList()); |
| | | } |
| | | |
| | | if (!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 { |
| | | rows = locNos.stream().map(item -> Integer.parseInt(item.substring(0, 2))).distinct().collect(Collectors.toList()); |
| | | } |
| | | |
| | | if (!rows.retainAll(new ArrayList<Integer>() {{ add(4);add(5);add(6);add(7);}})) { |
| | | locNos.sort((o1, o2) -> Integer.parseInt(o2.substring(0, 2)) - Integer.parseInt(o1.substring(0, 2))); |
| | | } else { |
| | | rows = locNos.stream().map(item -> Integer.parseInt(item.substring(0, 2))).distinct().collect(Collectors.toList()); |
| | | } |
| | | |
| | | if (!rows.retainAll(new ArrayList<Integer>() {{ add(12);add(13);add(14);}})) { |
| | | locNos.sort((o1, o2) -> Integer.parseInt(o2.substring(0, 2)) - Integer.parseInt(o1.substring(0, 2))); |
| | | } else { |
| | | rows = locNos.stream().map(item -> Integer.parseInt(item.substring(0, 2))).distinct().collect(Collectors.toList()); |
| | | } |
| | | |
| | | if (!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))); |
| | | } else { |
| | | 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))); |
| | | // } |
| | | for (String locNo : locNos) { |
| | | LocMast locMast = this.selectById(locNo); |
| | | if (locMast.getLocSts().equals("O")) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public synchronized void breakUp(String locNo) { |
| | | public synchronized void breakUp(String locNo, List<String> excludeLocNos) { |
| | | List<String> groupLoc = Utils.getGroupOuterLoc(locNo); |
| | | for (String outerLocNo : groupLoc) { |
| | | LocMast locMast = this.selectById(outerLocNo); |
| | | |
| | | Iterator<String> iterator = groupLoc.iterator(); |
| | | while (iterator.hasNext()) { |
| | | String next = iterator.next(); |
| | | LocMast locMast = this.selectById(next); |
| | | if (locMast.getLocSts().equals("F") || locMast.getLocSts().equals("D")) { |
| | | if (!excludeLocNos.contains(locMast.getLocNo())) { |
| | | continue; |
| | | } |
| | | } |
| | | iterator.remove(); |
| | | } |
| | | workService.shuttleTransfer(groupLoc); |
| | | } |
| | | |
| | | } |