From 940f06f6d8e5508f39bd7f8ce7791d60bfc0686c Mon Sep 17 00:00:00 2001 From: Fixiaobai <fixiaobai@163.com> Date: 星期二, 07 十一月 2023 14:11:21 +0800 Subject: [PATCH] Changes --- mes-technology/src/main/java/com/chinaztt/mes/technology/service/impl/BomServiceImpl.java | 66 +++++++++++++++++++++++++++++--- 1 files changed, 59 insertions(+), 7 deletions(-) diff --git a/mes-technology/src/main/java/com/chinaztt/mes/technology/service/impl/BomServiceImpl.java b/mes-technology/src/main/java/com/chinaztt/mes/technology/service/impl/BomServiceImpl.java index 8ed9c14..cacfed0 100644 --- a/mes-technology/src/main/java/com/chinaztt/mes/technology/service/impl/BomServiceImpl.java +++ b/mes-technology/src/main/java/com/chinaztt/mes/technology/service/impl/BomServiceImpl.java @@ -40,6 +40,7 @@ import com.chinaztt.mes.technology.state.bom.constant.BomStates; import com.chinaztt.ztt.common.core.util.R; import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.messaging.Message; import org.springframework.messaging.support.MessageBuilder; @@ -66,6 +67,7 @@ @Service @AllArgsConstructor @Transactional(rollbackFor = Exception.class) +@Slf4j public class BomServiceImpl extends ServiceImpl<BomMapper, Bom> implements BomService { private NumberGenerator<Bom> numberGenerator; @@ -162,10 +164,13 @@ bom.setVersion(structure.getVersion()); bom.setAlternativeNo(structure.getAlternativeNo()); bom.setAlternativeDesc(structure.getAlternativeDesc()); - StructureTree tree = getAllBomExt(bom, 998); + //log.info("绗竴灞�========================銆�"+bom); + StructureTree tree = getAllBomExt(bom, 999); BomDTO bomDTO = new BomDTO(); BeanUtils.copyProperties(bom, bomDTO); bomDTO.setTree(tree); + //BomDTO bomDTO = getBomDtoById(structure.getPartId()); + log.info("bomDto============>"+bomDTO); saveBom(bomDTO); }); return R.ok(); @@ -184,6 +189,18 @@ bomComp.setPlanningMethod(structureTree.getPlanningMethod()); bomComp.setColor(structureTree.getColor()); bomComp.setOperationId(structureTree.getOperationId()); + + bomComp.setSharpenerNo(structureTree.getSharpenerNo()); + bomComp.setCaveNum(structureTree.getCaveNum()); + bomComp.setGramWeight(structureTree.getGramWeight()); + bomComp.setGateGramWeight(structureTree.getGateGramWeight()); + bomComp.setMoldingCycle(structureTree.getMoldingCycle()); + bomComp.setMachine(structureTree.getMachine()); + bomComp.setScale(structureTree.getScale()); + bomComp.setDryingTime(structureTree.getDryingTime()); + bomComp.setDryingTemperature(structureTree.getDryingTemperature()); + bomComp.setPackingInfo(structureTree.getPackingInfo()); + bomComponentMapper.insert(bomComp); saveChildren(structureTree.getChildren(), bomComp.getId(), bom, structureTree.getPartId()); } @@ -209,12 +226,14 @@ return; } Part parentPart = partMapper.selectById(parentPartId); - //"P" 铏氭嫙浠剁殑鎰忔�� 鍦ㄤ竴涓狟OM涓紝闄ゆ牴鑺傜偣澶栵紝鍏朵綑鑺傜偣鑻ヤ笉鏄櫄鎷熶欢锛堥浂浠躲�愯鍒掓柟娉曘�戜笉涓篜 鍜� K锛夛紝鍒欑姝负鍏跺鍔犲瓙浠躲�� - if (!bom.getPartId().equals(parentPartId)) { - if (!"P".equals(parentPart.getPlanningMethod()) && !"K".equals(parentPart.getPlanningMethod())) { - throw new RuntimeException(parentPart.getPartNo() + parentPart.getPartName() + "涓洪潪铏氭嫙浠讹紝涓嶅彲娣诲姞瀛愪欢"); - } - } + log.error("parentId=======>"+parentPartId); + log.error("bomParentId====>"+bom); + ////"P" 铏氭嫙浠剁殑鎰忔�� 鍦ㄤ竴涓狟OM涓紝闄ゆ牴鑺傜偣澶栵紝鍏朵綑鑺傜偣鑻ヤ笉鏄櫄鎷熶欢锛堥浂浠躲�愯鍒掓柟娉曘�戜笉涓篜 鍜� K锛夛紝鍒欑姝负鍏跺鍔犲瓙浠躲�� + //if (!bom.getPartId().equals(parentPartId)) { + // if (!"P".equals(parentPart.getPlanningMethod()) && !"K".equals(parentPart.getPlanningMethod())) { + // throw new RuntimeException(parentPart.getPartNo() + parentPart.getPartName() + "涓洪潪铏氭嫙浠讹紝涓嶅彲娣诲姞瀛愪欢"); + // } + //} for (StructureTree child : children) { BomComponent bomComp = new BomComponent(); bomComp.setQpa(child.getQpa()); @@ -227,6 +246,18 @@ bomComp.setOperationId(child.getOperationId()); bomComp.setPlanningMethod(child.getPlanningMethod()); bomComp.setDiscNum(child.getDiscNum()); + + bomComp.setSharpenerNo(child.getSharpenerNo()); + bomComp.setCaveNum(child.getCaveNum()); + bomComp.setGramWeight(child.getGramWeight()); + bomComp.setGateGramWeight(child.getGateGramWeight()); + bomComp.setMoldingCycle(child.getMoldingCycle()); + bomComp.setMachine(child.getMachine()); + bomComp.setScale(child.getScale()); + bomComp.setDryingTime(child.getDryingTime()); + bomComp.setDryingTemperature(child.getDryingTemperature()); + bomComp.setPackingInfo(child.getPackingInfo()); + bomComponentMapper.insert(bomComp); saveChildren(child.getChildren(), bomComp.getId(), bom, child.getPartId()); } @@ -239,6 +270,7 @@ */ @Override public StructureTree getAllBomExt(Bom bom, int bomLayers) { + log.info("鐢熸垚鏍�=======銆�"); Long partId = bom.getPartId(); String version = bom.getVersion(); String alternativeNo = bom.getAlternativeNo(); @@ -264,7 +296,9 @@ * @Date: 2022-06-01 */ private StructureTree getRootNode(Long partId) { + log.info("鑾峰彇bom鏍硅妭鐐�====銆�"+partId); Part part = partMapper.selectById(partId); + log.info("鐖剁骇闆朵欢====銆�"+part); StructureTree root = new StructureTree(); root.setPartName(part.getPartName()); root.setPlanningMethod(part.getPlanningMethod()); @@ -328,13 +362,16 @@ @Override public BomDTO getBomDtoById(Long id) { Bom bom = baseMapper.selectById(id); + log.info("getBomDtoById=>>>"+bom); //濡傛灉瀛樺湪鏈粦瀹氬伐搴忕殑 宸ヨ壓璺嚎 鍒欎細涓虹┖ List<StructureTree> nodes = baseMapper.getBomComponents4Tree(id); if (CollectionUtil.isEmpty(nodes)) { return null; } StructureTree root = nodes.stream().filter(e -> e.getParentId() == null || e.getParentId() == 0).findFirst().get(); + log.info("root=======>"+root); setChildren(root, nodes); + log.info("setChildren鍚�========銆�"+root); Part part = partMapper.selectById(bom.getPartId()); BomDTO bomDto = new BomDTO(); BeanUtils.copyProperties(bom, bomDto); @@ -533,6 +570,7 @@ */ private void getStructureByPartId(StructureTree parent, Long partId, Map<Long, Integer> cache, String version, String alternativeNo, String bomType, int bomLayers) { + log.info("姣忓眰鏍�===================銆�"+parent); Integer cycleCount = cache.get(partId) == null ? 0 : cache.get(partId); if (cycleCount >= CYCLE_DEEP) { return; @@ -541,8 +579,21 @@ } //鏍规嵁闆朵欢鎵惧埌缁撴瀯涓昏〃 List<Structure> structures = getRootNodes(partId, version, alternativeNo, bomType); + log.info("寰楀埌缁撴瀯=========銆�"+structures); if (CollectionUtil.isNotEmpty(structures)) { for (Structure structure : structures) { + + parent.setSharpenerNo(structure.getSharpenerNo()); + parent.setCaveNum(structure.getCaveNum()); + parent.setGramWeight(structure.getGramWeight()); + parent.setGateGramWeight(structure.getGateGramWeight()); + parent.setMoldingCycle(structure.getMoldingCycle()); + parent.setMachine(structure.getMachine()); + parent.setScale(structure.getScale()); + parent.setDryingTime(structure.getDryingTime()); + parent.setDryingTemperature(structure.getDryingTemperature()); + parent.setPackingInfo(structure.getPackingInfo()); + // 鏌ヨBOM瀛愯妭鐐� List<StructureComponent> components = structureComponentMapper.selectList(Wrappers.<StructureComponent>lambdaQuery(). eq(StructureComponent::getStructureId, structure.getId()) @@ -562,6 +613,7 @@ } // 濉厖child鑺傜偣鏁版嵁 StructureTree child = fillChildNode(parent, component, structure, part); + log.info("鑺傜偣鏁版嵁====================銆�"+child); if (bomLayers == 999) { getStructureByPartId(child, component.getPartId(), cache, "ALL", "ALL", bomType, bomLayers); // 鍒ゆ柇鍒扮鍑犲眰浜嗭紝鍒堕�犵被鍨嬩负1-宸插埗閫狅紝璁″垝鏂规硶涓篜-铏氭嫙浠� -- Gitblit v1.9.3