From d72f95b3ffb6020996c04f6f9df3f6aa9977d5a3 Mon Sep 17 00:00:00 2001 From: 石广澎 <shiguangpeng@163.com> Date: 星期六, 02 十二月 2023 21:33:22 +0800 Subject: [PATCH] fix: 去除数据大屏 --- consum-base/src/main/java/com/consum/base/service/LWhFormScrappedCoreService.java | 56 +++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 35 insertions(+), 21 deletions(-) diff --git a/consum-base/src/main/java/com/consum/base/service/LWhFormScrappedCoreService.java b/consum-base/src/main/java/com/consum/base/service/LWhFormScrappedCoreService.java index 28d8941..28040ff 100644 --- a/consum-base/src/main/java/com/consum/base/service/LWhFormScrappedCoreService.java +++ b/consum-base/src/main/java/com/consum/base/service/LWhFormScrappedCoreService.java @@ -1,20 +1,26 @@ package com.consum.base.service; +import cn.hutool.core.convert.Convert; import com.consum.base.core.WhBusinessEnum; +import com.consum.base.core.service.LWhWarningCoreServiceImpl; +import com.consum.base.core.utils.IdUtil; import com.consum.base.core.utils.LockManage; -import com.consum.model.po.*; +import com.consum.model.po.LWarehouseFlow; +import com.consum.model.po.LWhFormScrapped; +import com.consum.model.po.LWhFormScrappedGoods; +import com.consum.model.po.LWhGoodsRecord; import com.iplatform.model.po.S_user_core; import com.walker.infrastructure.utils.CollectionUtils; -import com.walker.infrastructure.utils.NumberGenerator; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.transaction.interceptor.TransactionAspectSupport; - +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.interceptor.TransactionAspectSupport; /** * @ClassName LWhFormScrappedCoreService @@ -24,23 +30,27 @@ **/ @Service @Slf4j +@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) public class LWhFormScrappedCoreService { + private GoodsBaseServiceImpl goodsBaseService; private LWhFormScrappedGoodsService lWhFormScrappedGoodsService; - private BaseGoodsTemplateServiceImpl baseGoodsTemplateService; + private BaseGoodsTemplateService baseGoodsTemplateService; private LWhGoodsService lWhGoodsService; private LWhGoodsRecordDetailsService lWhGoodsRecordDetailsService; private LWhGoodsRecordService lWhGoodsRecordService; private LWarehouseFlowService lWarehouseFlowService; + private LWhWarningCoreServiceImpl lWhWarningCoreService; @Autowired public LWhFormScrappedCoreService(GoodsBaseServiceImpl goodsBaseService, LWhFormScrappedGoodsService lWhFormScrappedGoodsService, - BaseGoodsTemplateServiceImpl baseGoodsTemplateService, + BaseGoodsTemplateService baseGoodsTemplateService, LWhGoodsService lWhGoodsService, LWhGoodsRecordDetailsService lWhGoodsRecordDetailsService, LWhGoodsRecordService lWhGoodsRecordService, - LWarehouseFlowService lWarehouseFlowService) { + LWarehouseFlowService lWarehouseFlowService, + LWhWarningCoreServiceImpl lWhWarningCoreService) { // this.lWhFormScrappedService = lWhFormScrappedService; this.lWhFormScrappedGoodsService = lWhFormScrappedGoodsService; this.baseGoodsTemplateService = baseGoodsTemplateService; @@ -49,6 +59,7 @@ this.lWhGoodsRecordService = lWhGoodsRecordService; this.lWarehouseFlowService = lWarehouseFlowService; this.goodsBaseService = goodsBaseService; + this.lWhWarningCoreService = lWhWarningCoreService; } @@ -77,7 +88,7 @@ Long warehouseId = lWhFormScrapped.getWarehouseId(); String warehouseName = lWhFormScrapped.getWarehouseName(); // 娴佹按璁板綍鎬昏〃ID - long lWarehouseFlowId = NumberGenerator.getLongSequenceNumberNano(); + long lWarehouseFlowId = IdUtil.generateId(); //瑕佹姤搴熺殑鐗╁搧 LWhFormScrappedGoods goods = new LWhFormScrappedGoods(); @@ -89,10 +100,14 @@ } // 鎸夊瀷鍙峰垎缁� - Map<Long, List<LWhFormScrappedGoods>> modelGroup = formScrappedGoods.stream().collect(Collectors.groupingBy(LWhFormScrappedGoods::getBaseGoodsModelsId)); + ArrayList<Long> allChangModelList = new ArrayList<>(); + + Map<Long, List<LWhFormScrappedGoods>> modelGroup = formScrappedGoods.stream() + .collect(Collectors.groupingBy(LWhFormScrappedGoods::getBaseGoodsModelsId)); for (Map.Entry<Long, List<LWhFormScrappedGoods>> entry : modelGroup.entrySet()) { //瑙勬牸鍨嬪彿缂栧彿 Long baseGoodsModelsId = entry.getKey(); + allChangModelList.add(baseGoodsModelsId); //瀵规瘡缁勪腑瑕佹姤搴熺殑鏁伴噺姹傚拰 List<LWhFormScrappedGoods> modelGoodsList = entry.getValue(); //鏌ヨ鍨嬪彿淇℃伅 @@ -103,7 +118,7 @@ String goodsName = (String) tempGoodsInfo.get("goodsname"); String modelName = (String) tempGoodsInfo.get("modelname"); // 鎻掑叆 鍚勮鏍肩墿鍝佺殑杩涘嚭搴撹褰� L_WH_GOODS_RECORD - long whGoodsRecordId = NumberGenerator.getLongSequenceNumberNano(); + long whGoodsRecordId = IdUtil.generateId(); LWhGoodsRecord whGoodsRecord = new LWhGoodsRecord(); whGoodsRecord.setId(whGoodsRecordId); whGoodsRecord.setWarehouseType(warehouseType); @@ -135,7 +150,8 @@ //浣跨敤浜哄憳鍚嶇О String userName = formScrappedGood.getUserName(); // 鏍规嵁鍒嗗彂鍗曘�佽鏍煎瀷鍙风紪鍙枫�佷娇鐢ㄤ汉鍛樺悕绉帮紝杩涜鎶ュ簾 - srappedGoodsIds = lWhGoodsService.queryScrappedGoodsIds(warehouseType, warehouseId, transBusinessId, userName, baseGoodsModelsId, (short) 2, counts); + srappedGoodsIds = lWhGoodsService.queryScrappedGoodsIds(warehouseType, warehouseId, transBusinessId, userName, baseGoodsModelsId, + (short) 2, counts); } if (CollectionUtils.isEmpty(srappedGoodsIds) || srappedGoodsIds.size() < counts) { log.error("瑕佹姤搴熺殑鐗╁搧鏁伴噺涓嶈冻锛�"); @@ -148,7 +164,7 @@ whGoodsRecord.setEndCount(goodsModelNum - counts); // 璁剧疆鐗╁搧涓烘姤搴熺姸鎬� - lWhGoodsService.modGoodsTransfering(srappedGoodsIds, null, null, null, (short) 3); + lWhGoodsService.modGoodsTransfering(srappedGoodsIds, null, null, null, 3); // 鎵归噺鎻掑叆 杩涘嚭搴撴祦姘存槑缁哰L_WH_GOODS_RECORD_DETAILS] lWhGoodsRecordDetailsService.sameGoodsInsertMore(srappedGoodsIds, whGoodsRecordId, (short) 2); } @@ -175,17 +191,15 @@ } // 鏇存柊鎶ュ簾鍗� lWhFormScrapped = new LWhFormScrapped(formScrappedId); - lWhFormScrapped = goodsBaseService.get(lWhFormScrapped); - if (lWhFormScrapped != null && lWhFormScrapped.getStates() != 0) { - log.error("鎶ュ簾澶辫触锛佽妫�鏌ユ姤搴熷崟鐘舵��"); - return null; - } lWhFormScrapped.setLWarehouseFlowId(lWarehouseFlowId); lWhFormScrapped.setStates(1); lWhFormScrapped.setOperatorId(userId); lWhFormScrapped.setOperatorName(nickName); lWhFormScrapped.setDealTime(dealTime); goodsBaseService.update(lWhFormScrapped); + + //褰撳簱瀛樺彉鍔ㄦ椂璋冪敤璇ユ柟娉� + lWhWarningCoreService.updateKuCun(Convert.toShort(warehouseType,(short) 0), warehouseId, allChangModelList, null, dealTime); return lWarehouseFlowId; } -- Gitblit v1.9.1