From abc451e52a9ded8a18238d6903539fb310c1b256 Mon Sep 17 00:00:00 2001 From: zhanghl <253316343@qq.com> Date: 星期四, 08 五月 2025 16:18:17 +0800 Subject: [PATCH] 增加初始化钣金计划数据接口 --- aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateStandardRequireServiceImpl.java | 28 +++++++++++----------------- 1 files changed, 11 insertions(+), 17 deletions(-) diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateStandardRequireServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateStandardRequireServiceImpl.java index 0e40df7..b33d4d7 100644 --- a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateStandardRequireServiceImpl.java +++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateStandardRequireServiceImpl.java @@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.aps.core.service.IApsPlateStandardRequireService; +import org.springframework.transaction.annotation.Transactional; import java.util.List; @@ -69,6 +70,9 @@ @Resource IApsStandardProcessRouteLineService routeLineService; + + @Resource + IApsPlateStandardRequireBatchService requireBatchService; /** * 鏌ヨ閽i噾宸ュ崟鏍囧噯闇�姹� @@ -154,14 +158,17 @@ return apsPlateStandardRequireMapper.selectPlateSupplyGapList(apsPlateStandardRequire); } - private void generatorPlan(){ + @Transactional + public void generatorPlan(){ + /*鍒濆鍖栨暟鎹�*/ + requireBatchService.initRequireBatch(); /*瀹氫箟宸ュ巶涓哄崡閫� */ String plantCode="FORTUNA"; /*瀹氫箟涓诲崟绫诲瀷涓洪挘閲戜富鍗�*/ String mainOrderType = "閽i噾涓讳欢"; /*鐢熸垚鏂版壒娆″彿*/ - String batchNum=getBatch(); + String batchNum= requireBatchService.getNewBatchNumber(); /*鑾峰彇閽i噾涓诲崟淇℃伅*/ List<ApsPlatePlan> mainPlans = platePlanMapper.selectPlatePlanByPlantMajor(plantCode,mainOrderType); for (ApsPlatePlan mainPlan : mainPlans) { @@ -215,6 +222,8 @@ } /*鏌ユ壘搴撳瓨锛岃绠楀噣闇�姹傦紝淇濆瓨鍓╀綑搴撳瓨锛屼繚瀛樺簱瀛樻墸鍑忔槑缁�*/ BigDecimal remainderStock = BigDecimal.ZERO; + /*榛樿鍑�闇�姹備负BOM鐢ㄩ噺*/ + require.setNetRequirement(require.getBomUseAmount()); Optional<ApsMaterialStorageManagement> itemStorage = getItemStorage(plant, itemNumber); if (itemStorage.isPresent()) { ApsMaterialStorageManagement storage = itemStorage.get(); @@ -294,21 +303,6 @@ getBomRequires(plant, line, batchNum, require.getStartDate(), plan, allRequires, level + 1); }); } - } - - /** - * 鐢熸垚鏂版壒娆″彿 - * */ - private String getBatch() { - String batchNum = System.currentTimeMillis() + ""; - ApsPlateStandardRequireBatch batchBuilder = ApsPlateStandardRequireBatch.builder() - .id(IdUtil.getSnowflakeNextId()) - .batchNumber(batchNum) - .delFlag("0").build(); - batchBuilder.setCreateBy(SecurityUtils.getUsername()); - batchBuilder.setCreateTime(DateUtils.getNowDate()); - requireBatchMapper.insertApsPlateStandardRequireBatch(batchBuilder); - return batchNum; } /** * 鑾峰彇鐗╂枡搴撳瓨淇℃伅 -- Gitblit v1.9.3