| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.swing.*; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(param.getDevpNo(), true); |
| | | // 检索库位 |
| | | LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo); |
| | | |
| | | List<String> matnrs = new ArrayList<>(); |
| | | for (FullStoreParam.MatCodeStore matCodeStore : param.getList()) { |
| | | Mat mat = matService.selectByMatnr(matCodeStore.getMatnr()); |
| | | if (mat != null && !matnrs.contains(mat.getMaktx())) { |
| | | matnrs.add(mat.getMaktx()); |
| | | } |
| | | } |
| | | 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); |
| | | // 生成工作号 |
| | | int workNo = dto.getWorkNo(); |
| | |
| | | @Override |
| | | @Transactional |
| | | public void startupFullTakeStore(StockOutParam param, Long userId) { |
| | | ArrayList<String> locNos = new ArrayList<>(); |
| | | for (StockOutParam.LocDetl locDetl:param.getLocDetls()){ |
| | | locNos.add(locDetl.getLocNo()); |
| | | } |
| | | //检测是否为浅库位 |
| | | List<LocMast> locMasts = null; |
| | | boolean sign=false; |
| | | String th = ""; |
| | | for (StockOutParam.LocDetl locDetl:param.getLocDetls()){ |
| | | int row = getRow(locDetl.getLocNo()); |
| | | int bay = getBay(locDetl.getLocNo()); |
| | | int lev = getLev(locDetl.getLocNo()); |
| | | if (!(row==4 || row==5)){ |
| | | if (row>5){ |
| | | locMasts=locMastService.selectList(new EntityWrapper<LocMast>().ge("row1", 5).le("row1", row) |
| | | .eq("bay1",bay).eq("lev1",lev)); |
| | | for (LocMast locMast1:locMasts){ |
| | | if (locNos.contains(locMast1.getLocNo())){ |
| | | continue; |
| | | } |
| | | if (locMast1.getRow1()<row){ |
| | | if (!locMast1.getLocSts().equals("O")){ |
| | | sign=true; |
| | | th="库位号:"+locDetl.getLocNo()+" 浅库位有非空库位!"; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | }else { |
| | | locMasts=locMastService.selectList(new EntityWrapper<LocMast>().le("row1", 4).ge("row1", row) |
| | | .eq("bay1",bay).eq("lev1",lev)); |
| | | for (LocMast locMast1:locMasts){ |
| | | if (locNos.contains(locMast1.getLocNo())){ |
| | | continue; |
| | | } |
| | | if (locMast1.getRow1()>row){ |
| | | if (!locMast1.getLocSts().equals("O")){ |
| | | sign=true; |
| | | th="库位号:"+locDetl.getLocNo()+" 浅库位有非空库位!"; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (sign){ |
| | | throw new CoolException("出库失败;"+th); |
| | | } |
| | | // 目标站点状态检测 |
| | | BasDevp staNo = basDevpService.checkSiteStatus(param.getOutSite()); |
| | | // 获取库位明细 |
| | |
| | | } else { |
| | | throw new CoolException("库存不存在"); |
| | | } |
| | | } |
| | | /** |
| | | * 通过库位号获取 排 |
| | | */ |
| | | public static int getRow(String locNo) { |
| | | if (!Cools.isEmpty(locNo)) { |
| | | return Integer.parseInt(locNo.substring(0, 2)); |
| | | } |
| | | throw new RuntimeException("库位解析异常"); |
| | | } |
| | | /** |
| | | * 通过库位号获取 列 |
| | | */ |
| | | public static int getBay(String locNo) { |
| | | if (!Cools.isEmpty(locNo)) { |
| | | return Integer.parseInt(locNo.substring(2, 5)); |
| | | } |
| | | throw new RuntimeException("库位解析异常"); |
| | | } |
| | | /** |
| | | * 通过库位号获取 层 |
| | | */ |
| | | public static int getLev(String locNo) { |
| | | if (!Cools.isEmpty(locNo)) { |
| | | return Integer.parseInt(locNo.substring(5, 7)); |
| | | } |
| | | throw new RuntimeException("库位解析异常"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | @Transactional |
| | | public void emptyPlateOut(EmptyPlateOutParam param, Long userId) { |
| | | //检测是否为浅库位 |
| | | List<LocMast> locMasts = null; |
| | | boolean sign=false; |
| | | String th = ""; |
| | | for (String locNoKong: param.getLocNos()){ |
| | | int row = getRow(locNoKong); |
| | | int bay = getBay(locNoKong); |
| | | int lev = getLev(locNoKong); |
| | | if (!(row==4 || row==5)){ |
| | | if (row>5){ |
| | | locMasts=locMastService.selectList(new EntityWrapper<LocMast>().ge("row1", 5).le("row1", row) |
| | | .eq("bay1",bay).eq("lev1",lev)); |
| | | for (LocMast locMast1:locMasts){ |
| | | if (locMast1.getRow1()<row){ |
| | | if (!locMast1.getLocSts().equals("O")){ |
| | | if (param.getLocNos().contains(locMast1.getLocNo())){ |
| | | continue; |
| | | } |
| | | sign=true; |
| | | th="库位号:"+locNoKong+" 浅库位有非空库位!"; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | }else { |
| | | locMasts=locMastService.selectList(new EntityWrapper<LocMast>().le("row1", 4).ge("row1", row) |
| | | .eq("bay1",bay).eq("lev1",lev)); |
| | | for (LocMast locMast1:locMasts){ |
| | | if (locMast1.getRow1()>row){ |
| | | if (!locMast1.getLocSts().equals("O")){ |
| | | if (param.getLocNos().contains(locMast1.getLocNo())){ |
| | | continue; |
| | | } |
| | | sign=true; |
| | | th="库位号:"+locNoKong+" 浅库位有非空库位!"; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (sign){ |
| | | throw new CoolException("出库失败;"+th); |
| | | } |
| | | if (Cools.isEmpty(param.getOutSite())) { |
| | | throw new CoolException("站点不存在"); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public StartupDto createWaitPainWrkMastStart(List<WaitPakin> list, Long userId) { |
| | | if (Cools.isEmpty(list)) { |
| | | throw new CoolException("入库通知档不能为空"); |
| | | } |
| | | LocTypeDto locTypeDto = new LocTypeDto(); |
| | | return wcsController.startupFullPutStore(301, list.get(0).getZpallet(), locTypeDto, null); |
| | | return null; |
| | | } |
| | | |
| | | @Override |