| | |
| | | // 检索库位 |
| | | LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo); |
| | | List<String> matnrs = param.getList().stream().map(FullStoreParam.MatCodeStore::getMatnr).distinct().collect(Collectors.toList()); |
| | | StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 1, param.getDevpNo(), matnrs, locTypeDto, 0); |
| | | // List<String> batchs = param.getList().stream().map(FullStoreParam.MatCodeStore::getBatch).distinct().collect(Collectors.toList()); |
| | | StartupDto dto = commonService.getLocNo(1, param.getDevpNo(), matnrs.get(0), null, null,locTypeDto); |
| | | if (Cools.isEmpty(dto)){ |
| | | throw new CoolException("查询库位失败!!==》startupFullPutStore ==》 commonService.getLocNo"); |
| | | } |
| | | // 生成工作号 |
| | | int workNo = dto.getWorkNo(); |
| | | // 生成工作档 |
| | |
| | | } |
| | | } |
| | | if (!locDetlDtos.isEmpty()) { |
| | | // 启动出库开始 101.出库 |
| | | stockOut(staNo, locDetlDtos, null, userId); |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetlDtos.get(0).getLocDetl().getLocNo())); |
| | | if (locMast.getLocSts().equals("F") || locMast.getLocSts().equals("D") ){ |
| | | // 启动出库开始 101.出库 |
| | | stockOut(staNo, locDetlDtos, null, userId); |
| | | }else { |
| | | throw new CoolException("所选库位存在状态不为F、D的库位,库位号:"+locMast.getLocNo()+" 、当前状态:"+locMast.getLocSts()+"-"+locMast.getLocSts$()); |
| | | } |
| | | } else { |
| | | throw new CoolException("库存不存在"); |
| | | } |
| | |
| | | LocMast locMast = locMastService.selectById(dto.getLocNo()); |
| | | |
| | | Integer outSta = staNo.getDevNo(); |
| | | //2号堆垛机全板出库站指定为204站,拣料站指定为202 |
| | | if(locMast.getCrnNo()==2){ |
| | | outSta = ioType == 101 ? 204 : 202; |
| | | } |
| | | // //2号堆垛机全板出库站指定为204站,拣料站指定为202 |
| | | // if(locMast.getCrnNo()==2){ |
| | | // outSta = ioType == 101 ? 204 : 202; |
| | | // } |
| | | |
| | | // 获取路径 |
| | | StaDesc staDesc = staDescService.queryCrnStn(ioType, locMast.getCrnNo(), outSta); |
| | |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true); |
| | | // 检索库位 |
| | | LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo); |
| | | StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 10, devpNo, null, locTypeDto, 0); |
| | | StartupDto dto = commonService.getLocNo( 10, devpNo, null,null,null, locTypeDto); |
| | | int workNo = dto.getWorkNo(); |
| | | Date now = new Date(); |
| | | // 生成工作档 |
| | |
| | | LocMast locMast = locMastService.selectById(locNo); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException(locNo+"库位不存在"); |
| | | } |
| | | if (!locMast.getLocSts().equals("D")){ |
| | | throw new CoolException("所选库位存在状态不为D的库位,库位号:"+locMast.getLocNo()+" 、当前状态:"+locMast.getLocSts()+"-"+locMast.getLocSts$()); |
| | | } |
| | | // 获取源站 |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | |
| | | } |
| | | } |
| | | if (!locDetlDtos.isEmpty()) { |
| | | // 启动出库开始 107.盘点出库 |
| | | stockOut(staNo, locDetlDtos, IoWorkType.CHECK_OUT, userId); |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetlDtos.get(0).getLocDetl().getLocNo())); |
| | | if (locMast.getLocSts().equals("F")){ |
| | | // 启动出库开始 107.盘点出库 |
| | | stockOut(staNo, locDetlDtos, IoWorkType.CHECK_OUT, userId); |
| | | }else { |
| | | throw new CoolException("所选库位存在状态不为F的库位,库位号:"+locMast.getLocNo()+" 、当前状态:"+locMast.getLocSts()+"-"+locMast.getLocSts$()); |
| | | } |
| | | } else { |
| | | throw new CoolException("库位物料不存在"); |
| | | } |
| | |
| | | LocMast loc = locMastService.selectById(locNo); |
| | | if (Cools.isEmpty(loc)){ |
| | | throw new CoolException("未找到库位"); |
| | | } |
| | | if (!loc.getLocSts().equals("O") || (!sourceLoc.getLocSts().equals("F") && !sourceLoc.getLocSts().equals("D"))){ |
| | | throw new CoolException("库位状态已改变"); |
| | | } |
| | | if (!sourceLoc.getCrnNo().equals(loc.getCrnNo())) { |
| | | throw new CoolException("移转库位属于不同堆垛机"); |
| | |
| | | waitPakin.setIoStatus("N"); |
| | | waitPakin.setLocNo(""); |
| | | waitPakinService.update(waitPakin, new EntityWrapper<WaitPakin>() |
| | | .eq("order_no", waitPakin.getOrderNo()) |
| | | // .eq("order_no", waitPakin.getOrderNo()) |
| | | .eq("zpallet",waitPakin.getZpallet()) |
| | | .eq("matnr", waitPakin.getMatnr()) |
| | | .eq("batch", waitPakin.getBatch())); |
| | | } |
| | |
| | | return targetLoc.getLocNo(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void turnMatLocDetl(EmptyPlateOutParam param, Long userId) { |
| | | Mat mat = matService.selectOne(new EntityWrapper<Mat>().eq("id", param.getMatId())); |
| | | if (Cools.isEmpty(mat)){ |
| | | throw new CoolException("目标库位商品编码有误!"); |
| | | } |
| | | List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("matnr", param.getLocDetls().get(0).getMatnr())); |
| | | if (Cools.isEmpty(locDetls) || locDetls.size()<1){ |
| | | throw new CoolException("待修改商品无库存,无需修改! 品号:"+param.getLocDetls().get(0).getMatnr()); |
| | | } |
| | | try { |
| | | locDetlService.updateMatTurn(param.getLocDetls().get(0).getMatnr(),mat.getMatnr()); |
| | | }catch (Exception e){ |
| | | throw new CoolException("对数据库修改出错!"); |
| | | } |
| | | for (LocDetl locDetl:locDetls){ |
| | | // 保存调整记录 |
| | | AdjDetl adjDetl = new AdjDetl(); |
| | | adjDetl.setLocNo(locDetl.getLocNo()); |
| | | adjDetl.setMatnr(mat.getMatnr()); |
| | | adjDetl.setMatnrOld(param.getLocDetls().get(0).getMatnr()); |
| | | adjDetl.setAdjQty(locDetl.getAnfme()); |
| | | adjDetlService.save(adjDetl, userId); |
| | | } |
| | | } |
| | | |
| | | } |