| | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static jdk.nashorn.internal.runtime.regexp.joni.Config.log; |
| | | |
| | | /** |
| | | * Created by vincent on 2020/10/30 |
| | | */ |
| | |
| | | throw new CoolException(dto.getLocNo() + "目标库位已被占用"); |
| | | } |
| | | |
| | | Date now = new Date(); |
| | | for (LocDetl locDetl : locDetls) { |
| | | locDetl.setLocNo(dto.getLocNo());//修改目标库位 |
| | | locDetl.setAppeTime(now); |
| | | locDetl.setModiTime(now); |
| | | if (!locDetlService.insert(locDetl)) { |
| | | throw new CoolException("库存明细更新失败"); |
| | | } |
| | | } |
| | | // Date now = new Date(); |
| | | // for (LocDetl locDetl : locDetls) { |
| | | // locDetl.setLocNo(dto.getLocNo());//修改目标库位 |
| | | // locDetl.setAppeTime(now); |
| | | // locDetl.setModiTime(now); |
| | | // if (!locDetlService.insert(locDetl)) { |
| | | // throw new CoolException("库存明细更新失败"); |
| | | // } |
| | | // } |
| | | |
| | | //检查目标库位,库存明细是否添加成功 |
| | | List<LocDetl> checkLocDetls = locDetlService.selectByLocNo(dto.getLocNo()); |
| | | if (checkLocDetls.isEmpty()) { |
| | | throw new CoolException("库存明细迁移失败"); |
| | | } |
| | | // //检查目标库位,库存明细是否添加成功 |
| | | // List<LocDetl> checkLocDetls = locDetlService.selectByLocNo(dto.getLocNo()); |
| | | // if (checkLocDetls.isEmpty()) { |
| | | // throw new CoolException("库存明细迁移失败"); |
| | | // } |
| | | |
| | | // //清空源库位数据 |
| | | LocMast locMast1 = locMastService.selectByLoc(wrkMast.getSourceLocNo()); |
| | |
| | | @PostMapping("/start") |
| | | @ResponseBody |
| | | public R start(@RequestBody ReplenishmentParam param){ |
| | | |
| | | log.info("start param: " + param.toString()); |
| | | String containerCode = param.getContainerCode(); |
| | | if(Cools.isEmpty(containerCode)){ |
| | | throw new CoolException("料箱码为空"); |
| | |
| | | currentContainerMap = new HashMap<>(); |
| | | } |
| | | |
| | | String containerCode = param.getContainerCode(); |
| | | String containerCode = param.getContainerCode().split(";")[0]; |
| | | |
| | | if(Cools.isEmpty(containerCode)){ |
| | | throw new CoolException("料箱码为空"); |
| | | } |
| | |
| | | //查询旧容器的工作档 |
| | | AgvWrkMast agvWrkMast = agvWrkMastService.selectByContainerCode(currentContainerCode); |
| | | if(!Cools.isEmpty(agvWrkMast) && agvWrkMast.getIoType() == 101){ |
| | | //发送容器立场请求,完成工作档 |
| | | List<AgvWrkMast> agvWrkMastList = new ArrayList<>(); |
| | | agvWrkMastList.add(agvWrkMast); |
| | | try { |
| | | int code = agvWrkMastService.containerMoveOut(agvWrkMastList); |
| | | if(code == 0){ |
| | | //将工作党状态改为容器离场 |
| | | agvWrkMast.setWrkSts(206L); |
| | | agvWrkMastService.updateById(agvWrkMast); |
| | | } |
| | | } catch (IOException e) { |
| | | log.error(e.getMessage()); |
| | | } |
| | | //将工作党状态改为容器离场 |
| | | agvWrkMast.setWrkSts(206L); |
| | | agvWrkMastService.updateById(agvWrkMast); |
| | | // //发送容器立场请求,完成工作档 |
| | | // List<AgvWrkMast> agvWrkMastList = new ArrayList<>(); |
| | | // agvWrkMastList.add(agvWrkMast); |
| | | // try { |
| | | // int code = agvWrkMastService.containerMoveOut(agvWrkMastList); |
| | | // if(code == 0){ |
| | | // //将工作党状态改为容器离场 |
| | | // agvWrkMast.setWrkSts(206L); |
| | | // agvWrkMastService.updateById(agvWrkMast); |
| | | // } |
| | | // } catch (IOException e) { |
| | | // log.error(e.getMessage()); |
| | | // } |
| | | } |
| | | } |
| | | |
| | |
| | | public R containerMove(@RequestBody ReplenishmentParam param){ |
| | | |
| | | String devNo = param.getDevNo(); |
| | | if(Cools.isEmpty(currentContainerMap)){ |
| | | currentContainerMap = new HashMap<>(); |
| | | } |
| | | String containerCode = currentContainerMap.get(devNo); |
| | | |
| | | AgvBasDevpDto agvBasDevpDto = new AgvBasDevpDto(); |
| | |
| | | agvBasDevpDto.setAgvWaitPakins(agvWaitPakinList); |
| | | } |
| | | |
| | | //System.out.println("currentContainerMap: " + currentContainerMap); |
| | | |
| | | |
| | | //System.out.println("agvBasDevpDto: " + agvBasDevpDto); |
| | | |
| | | return R.ok(agvBasDevpDto); |
| | | } |
| | | |