| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void completeWrkMast(String workNo) { |
| | | public void completeWrkMast(String workNo, Long userId) { |
| | | WrkMast wrkMast = wrkMastService.selectById(workNo); |
| | | if (Cools.isEmpty(wrkMast)){ |
| | | throw new CoolException(workNo+"工作档不存在"); |
| | |
| | | } else if (wrkMast.getWrkSts() > 10) { |
| | | wrkMast.setWrkSts(14L); |
| | | } |
| | | wrkMast.setModiTime(new Date()); |
| | | wrkMast.setModiUser(userId); |
| | | if (!wrkMastService.updateById(wrkMast)) { |
| | | throw new CoolException("修改工作档失败"); |
| | | } |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void cancelWrkMast(String workNo) { |
| | | public void cancelWrkMast(String workNo, Long userId) { |
| | | WrkMast wrkMast = wrkMastService.selectById(workNo); |
| | | if (Cools.isEmpty(wrkMast)){ |
| | | throw new CoolException(workNo+"工作档不存在"); |
| | | } |
| | | // 入库 |
| | | String locNo = ""; // 待修改目标库位 |
| | | String locType = ""; // 待修改目标库位状态 |
| | | // 入库取消(修改目标库位) |
| | | if (wrkMast.getWrkSts() < 4) { |
| | | if (wrkMast.getIoType() != 11) { |
| | | |
| | | } else { |
| | | // 库位转移 |
| | | |
| | | |
| | | locNo = wrkMast.getLocNo(); |
| | | locType = "O"; |
| | | /** |
| | | * 库位转移 |
| | | * 取消后 源库位 ==>> F.在库 |
| | | * 目标库位 ===>> O.空库位 |
| | | **/ |
| | | if (wrkMast.getIoType() == 11) { |
| | | // 库位转移:源库位 |
| | | LocMast locMast = new LocMast(); |
| | | locMast.setLocNo(wrkMast.getSourceLocNo()); |
| | | locMast.setLocType("F"); |
| | | locMast.setModiTime(new Date()); |
| | | locMast.setModiUser(userId); |
| | | locMastService.updateById(locMast); |
| | | } |
| | | // 出库 |
| | | // 出库取消(修改源库位) |
| | | } else if (wrkMast.getWrkSts() > 10) { |
| | | |
| | | locNo = wrkMast.getSourceLocNo(); |
| | | // 出库 ===>> F.在库 |
| | | if (wrkMast.getIoType() > 100 && wrkMast.getIoType() != 110) { |
| | | locType = "F"; |
| | | // 空板出库 ===>> D.空桶/空栈板 |
| | | } else if (wrkMast.getIoType() == 110) { |
| | | locType = "D"; |
| | | // 库位转移 ===>> D.空桶/空栈板 |
| | | } else if (wrkMast.getIoType() == 11) { |
| | | locType = "F"; |
| | | // 库位转移:目标库位 |
| | | LocMast locMast = new LocMast(); |
| | | locMast.setLocNo(wrkMast.getLocNo()); |
| | | locMast.setLocType("O"); |
| | | locMast.setModiTime(new Date()); |
| | | locMast.setModiUser(userId); |
| | | locMastService.updateById(locMast); |
| | | } |
| | | } |
| | | // 删除工作档 |
| | | wrkMastService.deleteById(wrkMast); |
| | | boolean wrkMastRes = wrkMastService.deleteById(wrkMast); |
| | | // 删除工作档明细 |
| | | wrkDetlService.delete(new EntityWrapper<WrkDetl>().eq("wrk_no", workNo)); |
| | | boolean wrkDetlRes = wrkDetlService.delete(new EntityWrapper<WrkDetl>().eq("wrk_no", workNo)); |
| | | // 修改库位状态 |
| | | // locMastService.updateById() |
| | | LocMast locMast = new LocMast(); |
| | | locMast.setLocNo(locNo); |
| | | locMast.setLocType(locType); |
| | | locMast.setModiTime(new Date()); |
| | | locMast.setModiUser(userId); |
| | | boolean locMastRes = locMastService.updateById(locMast); |
| | | if (!wrkMastRes || !wrkDetlRes || !locMastRes) { |
| | | throw new CoolException("保存数据失败"); |
| | | } |
| | | } |
| | | |
| | | } |