| | |
| | | import com.zy.asrs.entity.param.FullStoreParam; |
| | | import com.zy.asrs.entity.param.StockOutParam; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.common.model.LocDetlDto; |
| | | import com.zy.common.model.OutLocDto; |
| | | import com.zy.common.model.StartupDto; |
| | | import com.zy.common.service.CommonService; |
| | |
| | | // 目标站点状态检测 |
| | | BasDevp staNo = basDevpService.checkSiteStatus(param.getOutSite()); |
| | | // 获取库位明细 |
| | | List<LocDetl> locDetls = new ArrayList<>(); |
| | | List<LocDetlDto> locDetlDtos = new ArrayList<>(); |
| | | for (StockOutParam.LocDetl locDetl : param.getLocDetls()) { |
| | | if (!Cools.isEmpty(locDetl.getLocNo(), locDetl.getMatnr())) { |
| | | if (!Cools.isEmpty(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getCount())) { |
| | | LocDetl sqlParam = new LocDetl(); |
| | | sqlParam.setLocNo(locDetl.getLocNo()); |
| | | sqlParam.setMatnr(locDetl.getMatnr()); |
| | | LocDetl one = locDetlService.selectOne(new EntityWrapper<>(sqlParam)); |
| | | if (null != one) locDetls.add(one); |
| | | if (null != one) locDetlDtos.add(new LocDetlDto(one, locDetl.getCount())); |
| | | } |
| | | } |
| | | if (!locDetls.isEmpty()) { |
| | | if (!locDetlDtos.isEmpty()) { |
| | | // 启动出库开始 |
| | | stockOut(staNo, locDetls, userId); |
| | | stockOut(staNo, locDetlDtos, userId); |
| | | } else { |
| | | throw new CoolException("库位物料不存在"); |
| | | } |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void stockOut(BasDevp staNo, List<LocDetl> locDetls, Long userId) { |
| | | public void stockOut(BasDevp staNo, List<LocDetlDto> locDetlDtos, Long userId) { |
| | | // 生成工作号 |
| | | int workNo = commonService.getWorkNo(DEFAULT_WORK_NO_TYPE); |
| | | // 合并同类项 |
| | | Set<String> locNos = new HashSet<>(); |
| | | locDetls.forEach(locDetl -> locNos.add(locDetl.getLocNo())); |
| | | locDetlDtos.forEach(dto -> locNos.add(dto.getLocDetl().getLocNo())); |
| | | List<OutLocDto> dtos = new ArrayList<>(); |
| | | for (String locNo : locNos) { |
| | | List<LocDetl> list = new ArrayList<>(); |
| | | Iterator<LocDetl> iterator = locDetls.iterator(); |
| | | List<LocDetlDto> list = new ArrayList<>(); |
| | | Iterator<LocDetlDto> iterator = locDetlDtos.iterator(); |
| | | while (iterator.hasNext()) { |
| | | LocDetl locDetl = iterator.next(); |
| | | if (locNo.equals(locDetl.getLocNo())) { |
| | | list.add(locDetl); |
| | | LocDetlDto dto = iterator.next(); |
| | | if (locNo.equals(dto.getLocDetl().getLocNo())) { |
| | | list.add(dto); |
| | | iterator.remove(); |
| | | } |
| | | } |
| | |
| | | throw new CoolException("保存工作档失败,出库库位号:"+dto.getLocNo()); |
| | | } |
| | | // 生成工作档明细 |
| | | for (LocDetl locDetl : dto.getLocDetls()) { |
| | | for (LocDetlDto detlDto : dto.getLocDetlDtos()) { |
| | | if (detlDto.getCount() <= 0.0D) {continue;} |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetl.setWrkNo(workNo); |
| | | wrkDetl.setIoTime(new Date()); |
| | | wrkDetl.setMatnr(locDetl.getMatnr()); |
| | | wrkDetl.setAnfme(locDetl.getAnfme()); |
| | | wrkDetl.setZmatid(locDetl.getZmatid()); |
| | | wrkDetl.setTbpos(locDetl.getTbpos()); |
| | | wrkDetl.setTbnum(locDetl.getTbnum()); |
| | | wrkDetl.setLgnum(locDetl.getLgnum()); |
| | | wrkDetl.setAltme(locDetl.getAltme()); |
| | | wrkDetl.setBname(locDetl.getBname()); |
| | | wrkDetl.setMaktx(locDetl.getMaktx()); |
| | | wrkDetl.setMatnr(detlDto.getLocDetl().getMatnr()); |
| | | wrkDetl.setAnfme(detlDto.getCount()); // 数量 |
| | | wrkDetl.setZmatid(detlDto.getLocDetl().getZmatid()); |
| | | wrkDetl.setTbpos(detlDto.getLocDetl().getTbpos()); |
| | | wrkDetl.setTbnum(detlDto.getLocDetl().getTbnum()); |
| | | wrkDetl.setLgnum(detlDto.getLocDetl().getLgnum()); |
| | | wrkDetl.setAltme(detlDto.getLocDetl().getAltme()); |
| | | wrkDetl.setBname(detlDto.getLocDetl().getBname()); |
| | | wrkDetl.setMaktx(detlDto.getLocDetl().getMaktx()); |
| | | wrkDetl.setAppeTime(new Date()); |
| | | wrkDetl.setAppeUser(userId); |
| | | wrkDetl.setModiTime(new Date()); |
| | |
| | | wrkDetl.setIoTime(new Date()); |
| | | wrkDetl.setMatnr(locDetl.getMatnr()); |
| | | wrkDetl.setAnfme(locDetl.getAnfme()); |
| | | wrkDetl.setZmatid(locDetl.getZmatid()); |
| | | wrkDetl.setTbpos(locDetl.getTbpos()); |
| | | wrkDetl.setTbnum(locDetl.getTbnum()); |
| | | wrkDetl.setLgnum(locDetl.getLgnum()); |
| | | wrkDetl.setAltme(locDetl.getAltme()); |
| | | wrkDetl.setBname(locDetl.getBname()); |
| | | wrkDetl.setMaktx(locDetl.getMaktx()); |
| | | wrkDetl.setAppeTime(new Date()); |
| | | wrkDetl.setAppeUser(userId); |
| | | wrkDetl.setModiTime(new Date()); |
| | |
| | | throw new CoolException("更新目标库位状态失败"); |
| | | } |
| | | } else { |
| | | throw new CoolException("预约目标库位入库失败,状态:"+loc.getLocType$()); |
| | | throw new CoolException("移转失败,目标库位状态:"+loc.getLocType$()); |
| | | } |
| | | } |
| | | |