| | |
| | | @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()); |
| | | |
| | | // 获取库位明细 |
| | | List<LocDetlDto> locDetlDtos = new ArrayList<>(); |
| | | for (StockOutParam.LocDetl paramLocDetl : param.getLocDetls()) { |
| | |
| | | } |
| | | if (!locDetlDtos.isEmpty()) { |
| | | // 启动出库开始 101.出库 |
| | | stockOut(staNo, locDetlDtos, null, userId); |
| | | stockOut(null, locDetlDtos, null, userId); |
| | | } else { |
| | | throw new CoolException("库存不存在"); |
| | | } |
| | |
| | | // 获取路径 |
| | | Boolean outMost = locMastService.isOutMost(dto.getLocNo(), false); |
| | | Integer outCrnNo = locMastService.getOutCrnNo(locMast); |
| | | StaDesc staDesc = staDescService.queryCrnStn(ioType, outCrnNo, staNo.getDevNo()); |
| | | |
| | | // 生成工作号 |
| | | int workNo = commonService.getWorkNo(WorkNoType.getWorkNoType(ioType)); |
| | | // 生成工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setWrkNo(workNo); |
| | | wrkMast.setIoTime(now); |
| | | wrkMast.setWrkSts(11L); // 工作状态:11.生成出库ID |
| | | wrkMast.setIoType(ioType); // 入出库状态 |
| | | wrkMast.setWrkSts(ioType == 101?17L:9L); // 工作状态:11.生成出库ID |
| | | wrkMast.setIoType(ioType == 101?101:53); // 入出库状态 |
| | | Double ioPri = wrkMastService.getIoPri(ioType, dto.getLocNo()); |
| | | wrkMast.setIoPri(ioPri); // 优先级:13 |
| | | wrkMast.setOutMost(outMost?1:0);; |
| | | wrkMast.setCrnNo(outMost?outCrnNo:locMast.getCrnNo()); |
| | | wrkMast.setSourceStaNo(staDesc.getCrnStn()); // 源站 |
| | | wrkMast.setStaNo(staDesc.getStnNo()); // 目标站 |
| | | if (ioType == 101){ |
| | | wrkMast.setSourceLocNo(dto.getLocNo()); // 源库位 |
| | | }else { |
| | | wrkMast.setLocNo(dto.getLocNo()); |
| | | } |
| | | |
| | | wrkMast.setFullPlt("Y"); // 满板:Y |
| | | wrkMast.setPicking("N"); // 拣料 |
| | | wrkMast.setExitMk("N"); // 退出 |
| | |
| | | // 修改库位状态: F.在库 ====>>> R.出库预约/P.拣料/盘点/并板出库中 |
| | | locMast = locMastService.selectById(dto.getLocNo()); |
| | | if (locMast.getLocSts().equals("F")) { |
| | | locMast.setLocSts(ioType==101?"R":"P"); |
| | | locMast.setLocSts(ioType==101?"R":"Q"); |
| | | locMast.setModiUser(userId); |
| | | locMast.setModiTime(now); |
| | | if (!locMastService.updateById(locMast)) { |