| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.*; |
| | | |
| | | @Service("locDetlService") |
| | | public class LocDetlServiceImpl extends ServiceImpl<LocDetlMapper, LocDetl> implements LocDetlService { |
| | |
| | | wapperSetCondition(wrapper,"batch",batch); |
| | | wapperSetCondition(wrapper,"three_code",csocode); |
| | | wapperSetCondition(wrapper,"dead_time",isoseq); |
| | | // if(Cools.isEmpty(batch)){ |
| | | // wrapper.isNull("batch"); |
| | | // }else { |
| | | // wrapper.eq("batch",batch); |
| | | // } |
| | | |
| | | List<LocDetl> locDetlList = this.selectList(wrapper); |
| | | for (LocDetl locDetl : locDetlList) { |
| | | //判断当前库位货物是否F在库 |
| | | LocMast locMast = locMastService.selectById(locDetl.getLocNo()); |
| | | if(!"F".equals(locMast.getLocSts())){ |
| | | continue; |
| | | } |
| | | |
| | | Set<LocDetl> resort = resort(locDetlList); |
| | | |
| | | for (LocDetl locDetl : resort) { |
| | | |
| | | if (issued > 0) { |
| | | double anfme = locDetl.getAnfme(); |
| | | int ioType = anfme > issued ? 103 : 101; |
| | | anfme = anfme > issued ? issued : anfme; |
| | | LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderNo, anfme); |
| | | //List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), ioType); |
| | | |
| | | List<Integer> outSite = basDevpService.getAvailableOutSite(101); |
| | | |
| | | locDto.setStaNos(outSite); |
| | |
| | | wapperSetCondition(wrapper,"batch",batch); |
| | | wapperSetCondition(wrapper,"three_code",csocode); |
| | | wapperSetCondition(wrapper,"dead_time",isoseq); |
| | | // if(Cools.isEmpty(batch)){ |
| | | // wrapper.isNull("batch"); |
| | | // }else { |
| | | // wrapper.eq("batch",batch); |
| | | // } |
| | | |
| | | List<LocDetl> locDetlList = this.selectList(wrapper); |
| | | for (LocDetl locDetl : locDetlList) { |
| | | Set<LocDetl> resort = resort(locDetlList); |
| | | for (LocDetl locDetl : resort) { |
| | | //判断当前库位货物是否F在库 |
| | | LocMast locMast = locMastService.selectById(locDetl.getLocNo()); |
| | | if(!"F".equals(locMast.getLocSts())){ |
| | |
| | | wrapper.eq(column,condition); |
| | | } |
| | | } |
| | | |
| | | //根据深浅库位进行重新排序 |
| | | private Set<LocDetl> resort(List<LocDetl> locDetls){ |
| | | Set<LocDetl> locDetlsResort = new LinkedHashSet<>(); |
| | | |
| | | for(LocDetl locDetl : locDetls){ |
| | | LocMast locMast = locMastService.selectById(locDetl.getLocNo()); |
| | | if(!"F".equals(locMast.getLocSts())){ |
| | | continue; |
| | | } |
| | | |
| | | List<String> groupOuterLoc = Utils.getGroupOuterLoc(locDetl.getLocNo()); |
| | | |
| | | if(Cools.isEmpty(groupOuterLoc)){ |
| | | locDetlsResort.add(locDetl); |
| | | }else { |
| | | groupOuterLoc.add(locDetl.getLocNo()); |
| | | //如果是深库位,则先找外侧的库位 |
| | | for (String locNo : groupOuterLoc){ |
| | | LocMast locMastOuter = locMastService.selectById(locNo); |
| | | //外侧如果是拣料,则内测不允许出 |
| | | if("P".equals(locMastOuter.getLocSts()) || "Q".equals(locMastOuter.getLocSts()) || "S".equals(locMastOuter.getLocSts())){ |
| | | break; |
| | | } |
| | | |
| | | if(!"F".equals(locMastOuter.getLocSts())){ |
| | | continue; |
| | | } |
| | | locDetlsResort.addAll(this.selectByLocNo(locNo)); |
| | | |
| | | } |
| | | } |
| | | } |
| | | return locDetlsResort; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | List<LocDetl> locDetls = new ArrayList<>(); |
| | | LocDetl locDetl2 = new LocDetl(); |
| | | locDetl2.setLocNo("aaa1"); |
| | | LocDetl locDetl3 = new LocDetl(); |
| | | locDetl3.setLocNo("aaa2"); |
| | | locDetls.add(locDetl2); |
| | | locDetls.add(locDetl3); |
| | | System.out.println(locDetls.size()); |
| | | |
| | | Set<LocDetl> set = new LinkedHashSet<>(); |
| | | LocDetl locDetl = new LocDetl(); |
| | | LocDetl locDetl1 = new LocDetl(); |
| | | locDetl.setLocNo("aaa"); |
| | | locDetl1.setLocNo("aaa"); |
| | | |
| | | set.add(locDetl); |
| | | set.add(locDetl1); |
| | | set.addAll(locDetls); |
| | | |
| | | System.out.println(set); |
| | | System.out.println(set.size()); |
| | | } |
| | | } |