From 4976563e692c610f2a8e2ba472424114340ff6a7 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期四, 25 三月 2021 10:34:52 +0800 Subject: [PATCH] # --- src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java | 68 ++++++++++++++++++++++++++++++++- 1 files changed, 65 insertions(+), 3 deletions(-) diff --git a/src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java b/src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java index a3de2b5..99df66d 100644 --- a/src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java +++ b/src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java @@ -428,9 +428,7 @@ Date now = new Date(); List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("node_id", node.getId())); List<String> locDetlMatnrs = new ArrayList<>(); - locDetls.forEach(locDetl -> { - locDetlMatnrs.add(locDetl.getMatnr()); - }); + locDetls.forEach(locDetl -> locDetlMatnrs.add(locDetl.getMatnr())); Iterator<LocDetl> detlIterator = locDetls.iterator(); List<PakinMatDto> dtos = param.getDtos(); @@ -452,6 +450,7 @@ null, // 鍗曟嵁缂栧彿 locDetl.getAnfme(), // 璐﹂潰鏁伴噺 dto.getCount(), // 瀹炵洏鏁伴噺 + dto.getCount() - locDetl.getAnfme(), // 宸�� locDetl.getAnfme() < dto.getCount() ? 1 : 2, // 鐩堜簭 1, // 鐘舵�� userId, // 娣诲姞浜哄憳 @@ -484,6 +483,7 @@ null, // 鍗曟嵁缂栧彿 locDetl.getAnfme(), // 璐﹂潰鏁伴噺 0D, // 瀹炵洏鏁伴噺 + 0D - locDetl.getAnfme(), // 宸�� 2, // 鐩堜簭 1, // 鐘舵�� userId, // 娣诲姞浜哄憳 @@ -514,6 +514,7 @@ null, // 鍗曟嵁缂栧彿 0D, // 璐﹂潰鏁伴噺 dto.getCount(), // 瀹炵洏鏁伴噺 + dto.getCount() - 0D, // 宸�� 1, // 鐩堜簭 1, // 鐘舵�� userId, // 娣诲姞浜哄憳 @@ -528,7 +529,68 @@ } } + return R.ok(); + } + @Override + @Transactional + public R stockCheckAuditing(Long checkId, Long userId) { + Check check = checkService.selectById(checkId); + if (null == check) { + return R.error("鐩樼偣璁板綍宸插け鏁�"); + } + Date now = new Date(); + // 1.淇敼搴撳瓨鏁伴噺 + if (check.getOriQty() != 0 && check.getCekQty() != 0) { + // 鏇存柊搴撳瓨鏄庣粏 + if (check.getSettle() == 1) { + if (!locDetlService.incrementStock(check.getNodeId(), check.getMatnr(), Math.abs(check.getDiffQty()))) { + throw new CoolException("淇敼搴撳瓨鏄庣粏鏁伴噺澶辫触"); + } + } else if (check.getSettle() == 2) { + if (!locDetlService.reduceStock(check.getNodeId(), check.getMatnr(), Math.abs(check.getDiffQty()))) { + throw new CoolException("淇敼搴撳瓨鏄庣粏鏁伴噺澶辫触"); + } + } + } + + // 2.鍒犻櫎搴撳瓨 + if (check.getOriQty() != 0 && check.getCekQty() == 0) { + if (!locDetlService.delete(new EntityWrapper<LocDetl>().eq("node_id", check.getNodeId()).eq("matnr", check.getMatnr()))) { + throw new CoolException("鍒犻櫎搴撳瓨鏄庣粏鏁伴噺澶辫触"); + } + } + + // 3.鏂板搴撳瓨 + if (check.getOriQty() == 0 && check.getCekQty() != 0) { + Mat mat = matService.selectByMatnr(check.getMatnr()); + if (mat == null) { + throw new CoolException("鍟嗗搧鏁版嵁寮傚父锛岃鑱旂郴绠$悊鍛�"); + } + // 鏇存柊璐т綅搴撳瓨鏄庣粏 + LocDetl locDetl = new LocDetl(); + locDetl.setLocNo(check.getLocNo()); + locDetl.setNodeId(check.getNodeId()); +// locDetl.setZpallet(param.getZpallet()); + locDetl.setAnfme(check.getCekQty()); + VersionUtils.setLocDetl(locDetl, mat); + locDetl.setStatus(1); + locDetl.setCreateBy(userId); + locDetl.setCreateTime(now); + locDetl.setUpdateBy(userId); + locDetl.setUpdateTime(now); + if (!locDetlService.insert(locDetl)) { + throw new CoolException("鏂板搴撳瓨鏄庣粏澶辫触"); + } + } + + // 淇敼鐩樼偣璁板綍 + check.setStatus(2); + check.setUpdateBy(userId); + check.setUpdateTime(now); + if (!checkService.updateById(check)) { + throw new CoolException("淇敼鐩樼偣璁板綍鐘舵�佸け璐�"); + } return R.ok(); } -- Gitblit v1.9.1