From 090bf407236ef5be8ea7ba803a56fdcc2dcc1ce3 Mon Sep 17 00:00:00 2001 From: luqingyang <lqy5492@163.com> Date: 星期三, 01 十一月 2023 17:37:04 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- consum-base/src/main/java/com/consum/base/service/LWhFormOutputCoreService.java | 44 ++++++++++++++++++++------------------------ 1 files changed, 20 insertions(+), 24 deletions(-) diff --git a/consum-base/src/main/java/com/consum/base/service/LWhFormOutputCoreService.java b/consum-base/src/main/java/com/consum/base/service/LWhFormOutputCoreService.java index b0b9fad..203c123 100644 --- a/consum-base/src/main/java/com/consum/base/service/LWhFormOutputCoreService.java +++ b/consum-base/src/main/java/com/consum/base/service/LWhFormOutputCoreService.java @@ -10,12 +10,7 @@ import com.walker.infrastructure.utils.CollectionUtils; import com.walker.infrastructure.utils.NumberGenerator; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; -import org.springframework.jdbc.core.namedparam.SqlParameterSource; -import org.springframework.jdbc.core.simple.SimpleJdbcCall; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.interceptor.TransactionAspectSupport; @@ -33,8 +28,7 @@ @Slf4j @Service public class LWhFormOutputCoreService { - private final JdbcTemplate jdbcTemplate; - private SimpleJdbcCall simpleJdbcCall; + private BaseGoodsTemplateServiceImpl baseGoodsTemplateService; private LWhGoodsService lWhGoodsService; private CodeGeneratorService codeGeneratorService; @@ -42,6 +36,8 @@ private LWhFormTransferService lWhFormTransferService; private LWhFormOutputService lWhFormOutputService; private LWarehouseFlowService lWarehouseFlowService; + private LWhGoodsRecordDetailsService lWhGoodsRecordDetailsService; + private LWhGoodsRecordService lWhGoodsRecordService; @Autowired public LWhFormOutputCoreService(BaseGoodsTemplateServiceImpl baseGoodsTemplateService, @@ -51,8 +47,8 @@ LWhFormTransferService lWhFormTransferService, LWhFormOutputService lWhFormOutputService, LWarehouseFlowService lWarehouseFlowService, - JdbcTemplate jdbcTemplate - ) { + LWhGoodsRecordDetailsService lWhGoodsRecordDetailsService, + LWhGoodsRecordService lWhGoodsRecordService) { this.baseGoodsTemplateService = baseGoodsTemplateService; this.lWhGoodsService = lWhGoodsService; this.codeGeneratorService = codeGeneratorService; @@ -60,8 +56,8 @@ this.lWhFormTransferService = lWhFormTransferService; this.lWhFormOutputService = lWhFormOutputService; this.lWarehouseFlowService = lWarehouseFlowService; - this.jdbcTemplate = jdbcTemplate; - this.simpleJdbcCall = new SimpleJdbcCall(jdbcTemplate).withProcedureName("insert_WH_GOODS_RECORD_DETAILS"); + this.lWhGoodsRecordDetailsService = lWhGoodsRecordDetailsService; + this.lWhGoodsRecordService = lWhGoodsRecordService; } @@ -169,6 +165,7 @@ return null; } // 瑕佸嚭鐗╁搧鐨勪粨搴搃d + Integer outWarehouseType = lWhFormOutput.getOutWarehouseType(); Long outWarehouseId = lWhFormOutput.getWarehouseId(); String warehouseName = lWhFormOutput.getWarehouseName(); @@ -245,10 +242,10 @@ whGoodsRecord.setThisCount(counts); //閫氳繃LockManage鑾峰緱閿� - Object warehouseModelLockObj = LockManage.acquireLock(outWarehouseId, baseGoodsModelsId); + Object warehouseModelLockObj = LockManage.acquireLock(outWarehouseType, outWarehouseId, baseGoodsModelsId); synchronized (warehouseModelLockObj) { // 鑾峰緱閿佸悗鏌ヨ璇ュ瀷鍙风殑鏈熷垵鏁伴噺 - int goodsModelNum = lWhGoodsService.queryGoodsModelNum(outWarehouseId, baseGoodsModelsId, queryModelStatus, buyType); + int goodsModelNum = lWhGoodsService.queryGoodsModelNum(outWarehouseType, outWarehouseId, baseGoodsModelsId, queryModelStatus, buyType); if (goodsModelNum < counts) { log.error("鍑哄簱澶辫触锛佸瀷鍙穥} 鐨勬暟閲忎笉瓒筹紝闇�瑕佽皟鎷▄}涓紝浠撳簱涓幇瀛榹}涓�", baseGoodsModelsId, counts, goodsModelNum); // 鎵嬪姩鍥炴粴 @@ -259,10 +256,11 @@ whGoodsRecord.setEndCount(goodsModelNum - counts); //鍑哄簱鏃跺�欙紝鎸� 鍏堝叆搴撶殑鍏堝嚭搴擄紝鍚屾椂鍏ュ簱鐨勶紝鎸変环鏍奸珮鐨勫厛鍑哄簱 - List<Long> outGoodsId = lWhGoodsService.queryOutGoodsId(outWarehouseId, baseGoodsModelsId, queryModelStatus, buyType, goodsModelNum); - lWhGoodsService.modGoodsTransfering(outGoodsId, inWarehouseId, inWarehouseName, modGoodsTransferingStatus); + List<Long> outGoodsId = lWhGoodsService.queryOutGoodsId(outWarehouseType, outWarehouseId, baseGoodsModelsId, queryModelStatus, buyType, goodsModelNum); + lWhGoodsService.modGoodsTransfering(outGoodsId, outWarehouseType, inWarehouseId, inWarehouseName, modGoodsTransferingStatus); // 鎵归噺鎻掑叆 杩涘嚭搴撴祦姘存槑缁哰L_WH_GOODS_RECORD_DETAILS] - sameGoodsInsertMore(outGoodsId, whGoodsRecordId, (short) 0); + lWhGoodsRecordDetailsService.sameGoodsInsertMore(outGoodsId, whGoodsRecordId, (short) 0); + lWhGoodsRecordService.insert(whGoodsRecord); } }); LWarehouseFlow warehouseFlow = new LWarehouseFlow(); @@ -281,16 +279,14 @@ if (flowInsertFlag == 0) { return null; } + // 鍚戝嚭搴撳崟 鎻掑叆 杩涘嚭搴撴祦姘存�昏〃ID + lWhFormOutput = new LWhFormOutput(outWarehouseFormId); + lWhFormOutput.setStates(2); + lWhFormOutput.setWarehouseFlowId(lWarehouseFlowId); + lWhFormOutputService.update(lWhFormOutput); + return lWarehouseFlowId; } - public void sameGoodsInsertMore(List<Long> outGoodsId, long whGoodsRecordId, short thisType) { - SqlParameterSource in = new MapSqlParameterSource() - .addValue("WHGOODSIDList", StringUtils.join(outGoodsId)) - .addValue("WH_GOODS_RECORD_ID", whGoodsRecordId) - .addValue("THIS_TYPE", thisType); - Map<String, Object> out = simpleJdbcCall.execute(in); - System.out.println("Procedure result: " + out); - } } -- Gitblit v1.9.1