| | |
| | | throw new CoolException(locDetl.getLocNo() + "库位不是在库状态"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void createEmptyWrk(String barcode, Long userId) { |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", barcode)); |
| | | if (!Cools.isEmpty(wrkMast)){ |
| | | throw new CoolException("托盘编号" + barcode + "已存在工作档"); |
| | | } |
| | | List<WaitPakin> waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode)); |
| | | if (!Cools.isEmpty(waitPakins)){ |
| | | throw new CoolException("托盘编号" + barcode + "已组托"); |
| | | } |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("barcode", barcode)); |
| | | if (!locMast.getLocSts().equals("O")){ |
| | | throw new CoolException("托盘编号" + barcode + "库位状态不是空库位"); |
| | | } |
| | | int workNo = commonService.getWorkNo(0); |
| | | Date now = new Date(); |
| | | // 生成工作档 |
| | | WrkMast emptyWrkMast = new WrkMast(); |
| | | emptyWrkMast.setWrkNo(workNo); |
| | | emptyWrkMast.setIoTime(new Date()); |
| | | emptyWrkMast.setWrkSts(2L); // 工作状态:生成入库ID |
| | | emptyWrkMast.setIoType(10); // 入出库状态:1.空托盘入库 |
| | | emptyWrkMast.setIoPri(30D); // 优先级 |
| | | emptyWrkMast.setCrnNo(1); |
| | | emptyWrkMast.setSourceStaNo(101); |
| | | emptyWrkMast.setStaNo(0); |
| | | emptyWrkMast.setLocNo(locMast.getLocNo()); |
| | | emptyWrkMast.setBarcode(barcode); // 托盘码 |
| | | emptyWrkMast.setFullPlt("N"); // 满板:N |
| | | emptyWrkMast.setPicking("N"); // 拣料 |
| | | emptyWrkMast.setExitMk("N"); // 退出 |
| | | emptyWrkMast.setEmptyMk("Y"); // 空板 |
| | | emptyWrkMast.setLinkMis("Y"); |
| | | emptyWrkMast.setCtnType(0); // 容器类型 |
| | | // 操作人员数据 |
| | | emptyWrkMast.setAppeTime(now); |
| | | emptyWrkMast.setModiTime(now); |
| | | emptyWrkMast.setModiUser(userId); |
| | | emptyWrkMast.setAppeUser(userId); |
| | | boolean res = wrkMastService.insert(emptyWrkMast); |
| | | if (!res) { |
| | | throw new CoolException("保存空托盘入库工作档失败"); |
| | | } |
| | | |
| | | // 更新源站点信息 |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(101, true); |
| | | sourceStaNo.setWrkNo(emptyWrkMast.getWrkNo()); |
| | | sourceStaNo.setModiTime(now); |
| | | if (!basDevpService.updateById(sourceStaNo)){ |
| | | throw new CoolException("更新源站失败"); |
| | | } |
| | | |
| | | // 更新目标库位状态 |
| | | locMast.setLocSts("S"); // S.入库预约 |
| | | locMast.setModiTime(now); |
| | | if (!locMastService.updateById(locMast)){ |
| | | throw new CoolException("改变库位状态失败"); |
| | | } |
| | | } |
| | | } |