| | |
| | | } |
| | | } |
| | | // 直接增加库存 |
| | | LocDetl locDetl = locDetlService.getLocDetl(param.getNode_id(), param.getMatnr()); |
| | | if (locDetl == null) { |
| | | // 更新货位库存明细 |
| | | locDetl = new LocDetl(); |
| | | locDetl.setLocNo(node.getName()); |
| | | locDetl.setNodeId(node.getId()); |
| | | locDetl.setAnfme(anfme); |
| | | VersionUtils.setLocDetl(locDetl, mat); |
| | | locDetl.setStatus(1); |
| | | locDetl.setCreateBy(userId); |
| | | locDetl.setCreateTime(new Date()); |
| | | locDetl.setUpdateBy(userId); |
| | | locDetl.setUpdateTime(new Date()); |
| | | boolean insert = locDetlService.insert(locDetl); |
| | | if (!insert) { |
| | | throw new CoolException("新增库存明细档失败"); |
| | | } |
| | | } else { |
| | | if (!locDetlService.incrementStock(node.getId(), param.getMatnr(), anfme)) { |
| | | throw new CoolException("新增库存明细档失败"); |
| | | // LocDetl locDetl = locDetlService.getLocDetl(param.getNode_id(), param.getMatnr()); |
| | | // if (locDetl == null) { |
| | | // // 更新货位库存明细 |
| | | // locDetl = new LocDetl(); |
| | | // locDetl.setLocNo(node.getName()); |
| | | // locDetl.setNodeId(node.getId()); |
| | | // locDetl.setAnfme(anfme); |
| | | // VersionUtils.setLocDetl(locDetl, mat); |
| | | // locDetl.setStatus(1); |
| | | // locDetl.setCreateBy(userId); |
| | | // locDetl.setCreateTime(new Date()); |
| | | // locDetl.setUpdateBy(userId); |
| | | // locDetl.setUpdateTime(new Date()); |
| | | // boolean insert = locDetlService.insert(locDetl); |
| | | // if (!insert) { |
| | | // throw new CoolException("新增库存明细档失败"); |
| | | // } |
| | | // } else { |
| | | // if (!locDetlService.incrementStock(node.getId(), param.getMatnr(), anfme)) { |
| | | // throw new CoolException("新增库存明细档失败"); |
| | | // } |
| | | // } |
| | | |
| | | return R.ok("补仓成功,等待立库调拨"); |
| | | } |
| | | |
| | | @Override |
| | | public R asrsStockTransferLocMode(AsrsTransferParam param, Long userId) { |
| | | if (Cools.isEmpty(param.getNode_id(), param.getMatnr(), param.getSafe_qua(), param.getAmount())) { |
| | | return R.error("数量错误"); |
| | | } |
| | | Node node = nodeService.selectById(param.getNode_id()); |
| | | Mat mat = matService.selectByMatnr(param.getMatnr()); |
| | | if (node == null || mat == null) { |
| | | return R.error(); |
| | | } |
| | | double anfme = Arith.subtract(2, param.getSafe_qua(), param.getAmount()); |
| | | List<StockTransferParam> params = new ArrayList<>(); |
| | | StockTransferParam transferParam = new StockTransferParam(); |
| | | transferParam.setMatnr(param.getMatnr()); |
| | | transferParam.setAnfme(anfme); |
| | | transferParam.setAllotNo(param.getNode_id()+ "_" +param.getMatnr()); |
| | | transferParam.setLocNo(param.getLocNo()); |
| | | params.add(transferParam); |
| | | Result1 result = asrsService.stockTransferLocMode(params); |
| | | if (result.getCode() == 500) { |
| | | if (Cools.isEmpty(result.getData())) { |
| | | throw new CoolException(result.getMsg()); |
| | | } else { |
| | | throw new CodeCoolException("20001-" + result.getData()); |
| | | } |
| | | } |
| | | |
| | | return R.ok("补仓成功,等待立库调拨"); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R stockCheck(StoCheckParam param, Long userId) { |