| | |
| | | package com.zy.asrs.wms.asrs.service.impl;
|
| | |
|
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
| | | import com.zy.asrs.framework.common.R;
|
| | | import com.zy.asrs.framework.exception.CoolException;
|
| | | import com.zy.asrs.wms.asrs.entity.*;
|
| | | import com.zy.asrs.wms.asrs.entity.enums.CacheSiteStatusType;
|
| | | import com.zy.asrs.wms.asrs.entity.enums.OrderSettleType;
|
| | | import com.zy.asrs.wms.asrs.entity.param.BindPlatformParam;
|
| | | import com.zy.asrs.wms.asrs.entity.param.PlatformShippedParam;
|
| | | import com.zy.asrs.wms.asrs.mapper.PlatformMapper;
|
| | | import com.zy.asrs.wms.asrs.service.*;
|
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
| | | import org.springframework.beans.BeanUtils;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Objects;
|
| | |
|
| | | @Service("platformService")
|
| | | public class PlatformServiceImpl extends ServiceImpl<PlatformMapper, Platform> implements PlatformService {
|
| | |
| | | private WaveLogService waveLogService;
|
| | | @Autowired
|
| | | private WaveDetlLogService waveDetlLogService;
|
| | | @Autowired
|
| | | private WaveSeedService waveSeedService;
|
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | |
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public R bindShippingPlatform(BindPlatformParam platform) {
|
| | | if (Objects.isNull(platform.getPlatformId())) {
|
| | | throw new CoolException("集货区标识不能为空!!");
|
| | | }
|
| | | if (Objects.isNull(platform.getOrderId())) {
|
| | | throw new CoolException("订单编码不能为空!!");
|
| | | }
|
| | | if (Objects.isNull(platform.getWaveId())) {
|
| | | throw new CoolException("波次ID不能为空!!");
|
| | | }
|
| | | Platform pl = this.getById(platform.getPlatformId());
|
| | | if (Objects.isNull(pl)) {
|
| | | throw new CoolException("集货区不存在!!");
|
| | | }
|
| | | List<WaveSeed> waveSeeds = waveSeedService.list(new LambdaQueryWrapper<WaveSeed>().eq(WaveSeed::getWaveId, platform.getWaveId()).eq(WaveSeed::getOrderId, platform.getOrderId()));
|
| | | if (waveSeeds.isEmpty()) {
|
| | | throw new CoolException("分拣明细信息不存在,数据错误!!");
|
| | | }
|
| | | ArrayList<PlatformDetl> detls = new ArrayList<>();
|
| | | waveSeeds.forEach(waveSeed -> {
|
| | | PlatformDetl platformDetl = new PlatformDetl();
|
| | | BeanUtils.copyProperties(waveSeed, platformDetl);
|
| | | platformDetl.setPlatformId(pl.getId());
|
| | | platformDetl.setPlatformNo(pl.getPlatformNo());
|
| | |
|
| | | List<PlatformDetl> list = platformDetlService.list(new LambdaQueryWrapper<PlatformDetl>().eq(PlatformDetl::getTaskDetlId, waveSeed.getTaskDetlId()).eq(PlatformDetl::getOrderDetlId, waveSeed.getOrderDetlId()).eq(PlatformDetl::getMatnr, waveSeed.getMatnr()));
|
| | | if (!list.isEmpty()) {
|
| | | throw new CoolException("订单已入集货区!!");
|
| | | }
|
| | | detls.add(platformDetl);
|
| | | });
|
| | |
|
| | | if (!platformDetlService.saveOrUpdateBatch(detls)) {
|
| | | throw new CoolException("集货区明细保存失败!!");
|
| | | }
|
| | |
|
| | | List<CacheSite> list = cacheSiteService.list(new LambdaQueryWrapper<CacheSite>().eq(CacheSite::getOrderId, platform.getOrderId()));
|
| | | if (list.isEmpty()) {
|
| | | throw new CoolException("订单未绑定播种库位,请完成拣货后,再打印订单!!");
|
| | | }
|
| | |
|
| | | boolean update = cacheSiteService.update(new LambdaUpdateWrapper<CacheSite>()
|
| | | .eq(CacheSite::getOrderId, platform.getOrderId())
|
| | | .set(CacheSite::getPlatformId, pl.getId())
|
| | | .set(CacheSite::getPlatformNo, pl.getPlatformNo()));
|
| | |
|
| | | if (!update) {
|
| | | throw new CoolException("播种墙站点绑定集货区失败!!");
|
| | | }
|
| | |
|
| | | return R.ok("绑定成功!!");
|
| | | }
|
| | | }
|