|  |  | 
 |  |  | import com.zy.asrs.service.LocDetlService; | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.HashSet; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.Set; | 
 |  |  | import java.util.*; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2022/3/28 | 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public boolean isAll(){ | 
 |  |  |         // 汇总不考虑批号 | 
 |  |  |         // 汇总不考虑序列码 | 
 |  |  |         List<DetlDto> detlDtos = new ArrayList<>(); | 
 |  |  |         for (LocDto locDto : this.getLocDtos()) { | 
 |  |  |             DetlDto dto = new DetlDto(locDto.getMatnr(), null, locDto.getAnfme()); | 
 |  |  |             DetlDto dto = new DetlDto(locDto.getMatnr(), locDto.getBatch(),locDto.getBrand(),locDto.getStandby1(),locDto.getStandby2(),locDto.getStandby3(),locDto.getBoxType1(),locDto.getBoxType2(),locDto.getBoxType3(), locDto.getAnfme()); | 
 |  |  |             if (DetlDto.has(detlDtos, dto)) { | 
 |  |  |                 DetlDto detlDto = DetlDto.find(detlDtos, locDto.getMatnr(), null); | 
 |  |  |                 DetlDto detlDto = DetlDto.find(detlDtos, locDto.getMatnr(), dto.getBatch(),dto.getBrand(),dto.getStandby1(),dto.getStandby2(),dto.getStandby3(),dto.getBoxType1(),dto.getBoxType2(),dto.getBoxType3()); | 
 |  |  |                 assert detlDto != null; | 
 |  |  |                 detlDto.setAnfme(detlDto.getAnfme() + locDto.getAnfme()); | 
 |  |  |             } else { | 
 |  |  |                 detlDtos.add(new DetlDto(locDto.getMatnr(), null, locDto.getAnfme())); | 
 |  |  |                 detlDtos.add(new DetlDto(locDto.getMatnr(), locDto.getBatch() | 
 |  |  |                         ,locDto.getBrand(),locDto.getStandby1(),locDto.getStandby2(),locDto.getStandby3(),locDto.getBoxType1(),locDto.getBoxType2(),locDto.getBoxType3() | 
 |  |  |                         , locDto.getAnfme())); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         // 查询当前库位号所有的库存明细 | 
 |  |  |         LocDetlService locDetlService = SpringUtils.getBean(LocDetlService.class); | 
 |  |  |         // todo | 
 |  |  |         List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", this.locNo)); | 
 |  |  |         if (locDetls == null || locDetls.isEmpty()){ | 
 |  |  |             throw new CoolException("计算满板失败,库位号=" + this.locNo); | 
 |  |  |             throw new CoolException("检索库存明细失败,库位号=" + this.locNo); | 
 |  |  |         } | 
 |  |  |         int sameNumber = 0; | 
 |  |  |         for (LocDetl locDetl : locDetls) { | 
 |  |  |             for (DetlDto detlDto : detlDtos) { | 
 |  |  |                 if (detlDto.getLocDetl().getMatnr().equals(locDetl.getMatnr()) && dto.getCount().equals(locDetl.getAnfme())) { | 
 |  |  |             Iterator<DetlDto> iterator = detlDtos.iterator(); | 
 |  |  |             while (iterator.hasNext()) { | 
 |  |  |                 DetlDto dto = iterator.next(); | 
 |  |  |                 if (!dto.getMatnr().equals(locDetl.getMatnr())) { | 
 |  |  |                     continue; | 
 |  |  |                 } | 
 |  |  |                 if (Cools.isEmpty(dto.getBatch()) && !Cools.isEmpty(locDetl.getBatch())) { | 
 |  |  |                     continue; | 
 |  |  |                 } | 
 |  |  |                 if (!Cools.isEmpty(dto.getBatch()) && Cools.isEmpty(locDetl.getBatch())) { | 
 |  |  |                     continue; | 
 |  |  |                 } | 
 |  |  |                 if (!Cools.isEmpty(dto.getBatch()) && !Cools.isEmpty(locDetl.getBatch())) { | 
 |  |  |                     if (!dto.getBatch().equals(locDetl.getBatch())) { | 
 |  |  |                         continue; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 if (dto.getAnfme() > locDetl.getAnfme()) { | 
 |  |  |                     throw new CoolException("服务器内部错误"); | 
 |  |  |                 } | 
 |  |  |                 if (dto.getAnfme().equals(locDetl.getAnfme())) { | 
 |  |  |                     sameNumber++; | 
 |  |  |                     iterator.remove(); | 
 |  |  |                     break; | 
 |  |  |                 } | 
 |  |  |             } |