| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.core.common.Cools; |
| | | import com.zy.asrs.entity.LocDetl; |
| | |
| | | import com.zy.asrs.service.RowLastnoService; |
| | | import com.zy.asrs.service.WorkService; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.service.CommonService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.Collections; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service("locMastService") |
| | | public class LocMastServiceImpl extends ServiceImpl<LocMastMapper, LocMast> implements LocMastService { |
| | |
| | | return Integer.parseInt(locNo.substring(0, 2)) == Utils.getOutLayerRow(locNo, true); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | List<String> groupLoc = Utils.getGroupLoc("2300101"); |
| | | Collections.reverse(groupLoc); |
| | | System.out.println(JSON.toJSONString(groupLoc)); |
| | | } |
| | | |
| | | @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);}})) { |
| | | locNos.sort(Comparator.comparingInt(o -> Integer.parseInt(o.substring(0, 2)))); |
| | | public LocMast findOutMost(String locNo) { |
| | | int row = Utils.getRow(locNo); |
| | | List<String> locNos = Utils.getGroupLoc(locNo); |
| | | if (CommonService.FIRST_GROUP_ROW_LIST.contains(row)) { |
| | | } else if (CommonService.SECOND_GROUP_ROW_LIST.contains(row)) { |
| | | Collections.reverse(locNos); |
| | | } else { |
| | | rows = locNos.stream().map(item -> Integer.parseInt(item.substring(0, 2))).distinct().collect(Collectors.toList()); |
| | | throw new RuntimeException("库位解析异常"); |
| | | } |
| | | |
| | | 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()); |
| | | } |
| | | for (int i = 0; i<locNos.size(); i++) { |
| | | LocMast locMast = this.selectById(locNos.get(i)); |
| | | if (locMast.getLocSts().equals("O")) { |
| | |
| | | return locMast; |
| | | } else { |
| | | LocMast lastLoc = this.selectById(locNos.get(i - 1)); |
| | | if (lastLoc.getLocSts().equals("F") || lastLoc.getLocSts().equals("D") || lastLoc.getLocSts().equals("X")) { |
| | | if (lastLoc.getLocSts().equals("F") || lastLoc.getLocSts().equals("D") |
| | | || lastLoc.getLocSts().equals("S") || lastLoc.getLocSts().equals("X")) { |
| | | return locMast; |
| | | } else { |
| | | break; |