From 8ce1dcfe07de7dcfd397a0af02689653da0981eb Mon Sep 17 00:00:00 2001 From: futian.liu <liufutianyoo@163.com> Date: 星期五, 22 十二月 2023 13:49:16 +0800 Subject: [PATCH] 部门分发时,修改正确的预警库存 --- consum-base/src/main/java/com/consum/base/service/core/LWhFormTransferCoreService.java | 47 ++++++++++++++++++++++------------------------- 1 files changed, 22 insertions(+), 25 deletions(-) diff --git a/consum-base/src/main/java/com/consum/base/service/core/LWhFormTransferCoreService.java b/consum-base/src/main/java/com/consum/base/service/core/LWhFormTransferCoreService.java index b2b55fc..cc0a57a 100644 --- a/consum-base/src/main/java/com/consum/base/service/core/LWhFormTransferCoreService.java +++ b/consum-base/src/main/java/com/consum/base/service/core/LWhFormTransferCoreService.java @@ -144,12 +144,13 @@ * @param whFormTransferId * @param currentUser */ - public Long doTransferOutPutNew(Long whFormTransferId, S_user_core currentUser) { + public Long doTransferOutPutNew(Long whFormTransferId, S_user_core currentUser, WhBusinessEnum whBusinessEnum) + throws Exception { LWhFormTransfer lWhFormTransfer = new LWhFormTransfer(whFormTransferId); lWhFormTransfer = lWhFormTransferService.get(lWhFormTransfer); if (lWhFormTransfer == null || lWhFormTransfer.getStates() != 0) { log.error("璋冩嫧澶辫触锛佽妫�鏌ヨ皟鎷ㄥ崟鐘舵��"); - return null; + throw new Exception("璋冩嫧澶辫触锛佽妫�鏌ヨ皟鎷ㄥ崟鐘舵��"); } Long userId = currentUser.getId(); @@ -157,10 +158,10 @@ long dealTime = DateUtils.getDateTimeNumber(System.currentTimeMillis()); // 鐢宠璋冩嫧鐨勭墿鍝� List<LWhProcureModel> goodsModelNumList = - lWhProcureModelService.getModelByForm(WhBusinessEnum.DIAOBO, whFormTransferId); + lWhProcureModelService.getModelByForm(whBusinessEnum, whFormTransferId); if (CollectionUtils.isEmpty(goodsModelNumList)) { log.error("娌℃湁瑕佸嚭搴撶殑鐗╁搧"); - return null; + throw new Exception("娌℃湁瑕佸嚭搴撶殑鐗╁搧"); } List<LWhProcureModel> goodsModelNumUpdList = new ArrayList<>(goodsModelNumList.size()); @@ -178,21 +179,16 @@ long lWarehouseFlowBusinessId = whFormTransferId; // 鐗╁搧鐘舵�侊紙0=鍦ㄩ�旇皟鎷紱1=鍏ュ簱鏈垎鍙戯紱2=宸蹭笅鍙戯紱3=鎶ュ簾锛� - Integer queryModelStatusT = 1; + Integer queryModelStatus = 1; // 閲囪喘鏂瑰紡锛�1锛氶泦閲囷紱2=鑷噰锛� - Integer buyTypeT = null; - Integer modGoodsTransferingStatusT = null; - // 璋冩嫧鍑哄簱 - queryModelStatusT = 1; - buyTypeT = 1; - modGoodsTransferingStatusT = 0; - - Integer queryModelStatus = queryModelStatusT; - Integer buyType = buyTypeT; - Integer modGoodsTransferingStatus = modGoodsTransferingStatusT; + Integer buyType = 1; + if (whBusinessEnum == WhBusinessEnum.BUMENFENFA) { + buyType = null; + } + Integer modGoodsStatus = 0; ArrayList<Long> allChangModelList = new ArrayList<>(); - goodsModelNumList.forEach(itemModelInfo -> { + for (LWhProcureModel itemModelInfo : goodsModelNumList) { // 闇�瑕佽皟鎷ㄧ殑鐗╁搧鐨勬煇涓瀷鍙� Long baseGoodsModelsId = itemModelInfo.getBaseGoodsModelsId(); LWhProcureModel updWhProcureModel = new LWhProcureModel(itemModelInfo.getId()); @@ -244,7 +240,7 @@ outGoodsId = lWhGoodsService.queryOutGoodsId(outWarehouseType, outWarehouseId, baseGoodsModelsId, queryModelStatus, buyType, counts); lWhGoodsService.modGoodsTransfering(outGoodsId, inWarehouseType, inWarehouseId, inWarehouseName, - modGoodsTransferingStatus); + modGoodsStatus); // 鎵归噺鎻掑叆 杩涘嚭搴撴祦姘存槑缁哰L_WH_GOODS_RECORD_DETAILS] lWhGoodsRecordDetailsService.sameGoodsInsertMore(outGoodsId, whGoodsRecordId, (short)0); } @@ -256,7 +252,7 @@ lWhProcureModelService.update(lWhProcureModel); updWhProcureModel.setTotalAmount(totalAmount); goodsModelNumUpdList.add(updWhProcureModel); - }); + } // 鏇存柊L_WH_PROCURE_MODEL琛ㄥ唴閲戦 lWhProcureModelService.updateBatch(goodsModelNumUpdList); @@ -265,7 +261,7 @@ warehouseFlow.setWarehouseId(outWarehouseId); warehouseFlow.setWarehouseName(warehouseName); warehouseFlow.setThisType(2); - warehouseFlow.setBusinessType(WhBusinessEnum.DIAOBO.getValue() + 0); + warehouseFlow.setBusinessType(whBusinessEnum.getValue()); warehouseFlow.setBusinessFormId(whFormTransferId == null ? lWarehouseFlowBusinessId : whFormTransferId); warehouseFlow.setOperatorId(userId); @@ -305,20 +301,21 @@ * @param whFormTransferId * @param currentUser */ - public void doTransferInPut(Long whFormTransferId, S_user_core currentUser, String inOperatorName) { + public void doTransferInPut(Long whFormTransferId, S_user_core currentUser, String inOperatorName) + throws Exception { LWhFormTransfer lWhFormTransfer = new LWhFormTransfer(whFormTransferId); lWhFormTransfer = lWhFormTransferService.get(lWhFormTransfer); if (lWhFormTransfer == null || lWhFormTransfer.getStates() != 1) { - log.error("璋冩嫧澶辫触锛佽妫�鏌ヨ皟鎷ㄥ崟鐘舵��"); - return; + log.info("璋冩嫧澶辫触锛佽妫�鏌ヨ皟鎷ㄥ崟鐘舵��"); + throw new RuntimeException("璋冩嫧澶辫触锛佽妫�鏌ヨ皟鎷ㄥ崟鐘舵��"); } Long userId = currentUser.getId(); String nickName = currentUser.getNick_name(); // 鍑哄簱鍗曟祦姘磇d Long outWarehouseFlowId = lWhFormTransfer.getOutWarehouseFlowId(); if (outWarehouseFlowId == null) { - log.error("璋冩嫧澶辫触锛佹湭鎵惧埌鍑哄簱鍗�"); - return; + log.info("璋冩嫧澶辫触锛佹湭鎵惧埌鍑哄簱鍗�"); + throw new RuntimeException("璋冩嫧澶辫触锛佹湭鎵惧埌鍑哄簱鍗�"); } // 鍏ュ簱浠撳簱绫诲瀷 0鏈烘瀯1閮ㄩ棬 Integer inWarehouseType = lWhFormTransfer.getInWarehouseType(); @@ -411,8 +408,8 @@ .mapToInt(LWhProcureModelUser::getGoodsNum).sum(); if (totalGoodsNum != outGoodsIds.size()) { TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + log.info("鍏ュ簱鍗曞け璐ワ紝浣跨敤浜轰娇鐢ㄦ暟閲忎笌鐗╁搧鏁伴噺涓嶄竴鑷�"); throw new RuntimeException("鍏ュ簱鍗曞け璐ワ紝浣跨敤浜轰娇鐢ㄦ暟閲忎笌鐗╁搧鏁伴噺涓嶄竴鑷�"); - // log.error("鍒涘缓鍏ュ簱鍗曞け璐�"); } ArrayList<LGoodsUserRecord> goodsUserRecordList = new ArrayList<>(); -- Gitblit v1.9.1