| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.PlatformWmsDetailMapper; |
| | | import com.doumee.dao.business.PlatformWmsJobMapper; |
| | | import com.doumee.dao.business.model.PlatformWmsDetail; |
| | | import com.doumee.dao.business.model.PlatformWmsJob; |
| | | import com.doumee.dao.business.vo.WmsJobContractVO; |
| | | import com.doumee.service.business.PlatformWmsJobService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 月台_WMS作业通知单行数据Service实现 |
| | |
| | | |
| | | @Autowired |
| | | private PlatformWmsJobMapper platformWmsJobMapper; |
| | | |
| | | @Autowired |
| | | private PlatformWmsDetailMapper platformWmsDetailMapper; |
| | | |
| | | @Override |
| | | public Integer create(PlatformWmsJob platformWmsJob) { |
| | |
| | | return platformWmsJobMapper.selectById(id); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public PlatformWmsJob findByDetailId(Integer id) { |
| | | PlatformWmsJob platformWmsJob = platformWmsJobMapper.selectOne(new QueryWrapper<PlatformWmsJob>().lambda().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)); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(platformWmsDetailList)){ |
| | | platformWmsJob.setIoQty( |
| | | platformWmsDetailList.stream().map(m->m.getIoQty()).reduce(BigDecimal.ZERO,BigDecimal::add) |
| | | ); |
| | | //获取所有合同号 |
| | | List<String> ioCodeList = platformWmsDetailList.stream().map(m->m.getIocode()).collect(Collectors.toList()); |
| | | Set<String> ioCodeSet = new HashSet<String>(ioCodeList); |
| | | List<WmsJobContractVO> wmsJobContractVOList = new ArrayList<>(); |
| | | for (String ioCode:ioCodeSet) { |
| | | WmsJobContractVO wmsJobContractVO = new WmsJobContractVO(); |
| | | wmsJobContractVO.setContractCode(ioCode); |
| | | wmsJobContractVO.setAddress(platformWmsJob.getRepertotyAddress()); |
| | | wmsJobContractVO.setPlatformWmsDetailList( |
| | | platformWmsDetailList.stream().filter(i->i.getIocode().equals(ioCode)).collect(Collectors.toList()) |
| | | ); |
| | | wmsJobContractVOList.add(wmsJobContractVO); |
| | | } |
| | | |
| | | platformWmsJob.setWmsJobContractVOList(wmsJobContractVOList); |
| | | }else{ |
| | | platformWmsJob.setIoQty(BigDecimal.ZERO); |
| | | } |
| | | return platformWmsJob; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformWmsJob findOne(PlatformWmsJob platformWmsJob) { |
| | | QueryWrapper<PlatformWmsJob> wrapper = new QueryWrapper<>(platformWmsJob); |