| | |
| | | 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.Constants; |
| | | 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::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).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) |
| | | ); |
| | | //获取所有合同号 |
| | | 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()) |
| | | ); |
| | | 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); |
| | | } |
| | | |
| | | platformWmsJob.setWmsJobContractVOList(wmsJobContractVOList); |
| | | }else{ |
| | | platformWmsJob.setIoQty(BigDecimal.ZERO); |
| | | } |
| | | return platformWmsJob; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformWmsJob findOne(PlatformWmsJob platformWmsJob) { |
| | | QueryWrapper<PlatformWmsJob> wrapper = new QueryWrapper<>(platformWmsJob); |
| | |
| | | .eq(pageWrap.getModel().getDriverName() != null, PlatformWmsJob::getDriverName, pageWrap.getModel().getDriverName()) |
| | | .eq(pageWrap.getModel().getCarrierName() != null, PlatformWmsJob::getCarrierName, pageWrap.getModel().getCarrierName()) |
| | | .eq(pageWrap.getModel().getCarryBillCode() != null, PlatformWmsJob::getCarryBillCode, pageWrap.getModel().getCarryBillCode()) |
| | | .ge(pageWrap.getModel().getIoCreatedate() != null, PlatformWmsJob::getIoCreatedate, Utils.Date.getStart(pageWrap.getModel().getIoCreatedate())) |
| | | .le(pageWrap.getModel().getIoCreatedate() != null, PlatformWmsJob::getIoCreatedate, Utils.Date.getEnd(pageWrap.getModel().getIoCreatedate())) |
| | | .eq(pageWrap.getModel().getStatus() != null, PlatformWmsJob::getStatus, pageWrap.getModel().getStatus()) |
| | | .ge(pageWrap.getModel().getCancelDate() != null, PlatformWmsJob::getCancelDate, Utils.Date.getStart(pageWrap.getModel().getCancelDate())) |
| | | .le(pageWrap.getModel().getCancelDate() != null, PlatformWmsJob::getCancelDate, Utils.Date.getEnd(pageWrap.getModel().getCancelDate())) |