|  |  |  | 
|---|
|  |  |  | import com.doumee.core.exception.BusinessException; | 
|---|
|  |  |  | import com.doumee.core.model.PageData; | 
|---|
|  |  |  | import com.doumee.core.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.core.utils.Utils; | 
|---|
|  |  |  | import com.doumee.dao.business.PlatformWmsDetailMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.PlatformWmsJobMapper; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public PlatformWmsJob findByDetailId(Integer id) { | 
|---|
|  |  |  | PlatformWmsJob platformWmsJob = platformWmsJobMapper.selectOne(new QueryWrapper<PlatformWmsJob>().lambda().eq(PlatformWmsJob::getJobId,id).last(" limit 1 ")); | 
|---|
|  |  |  | PlatformWmsJob platformWmsJob = platformWmsJobMapper.selectOne(new QueryWrapper<PlatformWmsJob>().lambda().eq(PlatformWmsJob::getIsdeleted, Constants.ZERO).eq(PlatformWmsJob::getJobId,id).last(" limit 1 ")); | 
|---|
|  |  |  | if(Objects.isNull(platformWmsJob)){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"未查询到运单信息"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<PlatformWmsDetail> platformWmsDetailList = platformWmsDetailMapper.selectList(new QueryWrapper<PlatformWmsDetail>() | 
|---|
|  |  |  | .lambda().eq(PlatformWmsDetail::getJobId,id)); | 
|---|
|  |  |  | .lambda().eq(PlatformWmsDetail::getJobId,id).eq(PlatformWmsDetail::getIsdeleted, Constants.ZERO)); | 
|---|
|  |  |  | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(platformWmsDetailList)){ | 
|---|
|  |  |  | platformWmsJob.setIoQty( | 
|---|
|  |  |  | platformWmsDetailList.stream().map(m->m.getIoQty()).reduce(BigDecimal.ZERO,BigDecimal::add) | 
|---|
|  |  |  | 
|---|
|  |  |  | wmsJobContractVO.setPlatformWmsDetailList( | 
|---|
|  |  |  | platformWmsDetailList.stream().filter(i->i.getIocode().equals(ioCode)).collect(Collectors.toList()) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(Objects.isNull(wmsJobContractVO.getLockStatus())&& | 
|---|
|  |  |  | com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(wmsJobContractVO.getPlatformWmsDetailList())){ | 
|---|
|  |  |  | if(Constants.equalsInteger(platformWmsJob.getType(),Constants.ONE)){ | 
|---|
|  |  |  | if(Objects.isNull(wmsJobContractVO.getPlatformWmsDetailList().get(Constants.ZERO).getLockStatus())){ | 
|---|
|  |  |  | wmsJobContractVO.setLockStatus(Constants.ZERO | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | wmsJobContractVO.setLockStatus( | 
|---|
|  |  |  | wmsJobContractVO.getPlatformWmsDetailList().get(Constants.ZERO).getLockStatus() | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | wmsJobContractVO.setStatus( | 
|---|
|  |  |  | wmsJobContractVO.getPlatformWmsDetailList().get(Constants.ZERO).getStatus() | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | wmsJobContractVOList.add(wmsJobContractVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|