| | |
| | | node.setProcessNo(programProperties.getProcessNo()); |
| | | node.setMachineCode(programProperties.getMachineCode()); |
| | | node.setProductModel(programProperties.getProductModel()); |
| | | node.setFlowProgramFileId(programFile.getId()); |
| | | ncNodeService.save(node); |
| | | } |
| | | |
| | |
| | | |
| | | //创建产品型号节点 |
| | | //NcNode productModelNode = createProductModelNode(programProperties.getProductModel(), root); |
| | | NcNode productModelNode = createNodeIfNotExists(programProperties.getProductModel(),NcNode.TYPE_PRODUCT_MODEL, root); |
| | | NcNode productModelNode = createNodeIfNotExists(programProperties.getProductModel(),NcNode.TYPE_PRODUCT_MODEL, root,null); |
| | | //零组件号节点 |
| | | NcNode drawingNoNode = createNodeIfNotExists(programProperties.getDrawingNo(),NcNode.TYPE_DRAWING_NO, productModelNode); |
| | | NcNode drawingNoNode = createNodeIfNotExists(programProperties.getDrawingNo(),NcNode.TYPE_DRAWING_NO, productModelNode,null); |
| | | //工艺版次节点 |
| | | NcNode craftEditionNode = createNodeIfNotExists(programProperties.getCraftEdition(),NcNode.TYPE_CRAFT_EDITION, drawingNoNode); |
| | | NcNode craftEditionNode = createNodeIfNotExists(programProperties.getCraftEdition(),NcNode.TYPE_CRAFT_EDITION, drawingNoNode,null); |
| | | //工序号节 |
| | | NcNode processNoNode = createNodeIfNotExists(programProperties.getCraftEdition(),NcNode.TYPE_PROCESS_NO, craftEditionNode); |
| | | NcNode processNoNode = createNodeIfNotExists(programProperties.getCraftEdition(),NcNode.TYPE_PROCESS_NO, craftEditionNode,null); |
| | | //工序版次节点 |
| | | NcNode processEditionNode = createNodeIfNotExists(programProperties.getCraftEdition(),NcNode.TYPE_PROCESS_EDITION, processNoNode); |
| | | NcNode processEditionNode = createNodeIfNotExists(programProperties.getCraftEdition(),NcNode.TYPE_PROCESS_EDITION, processNoNode,null); |
| | | //加工机床节点 |
| | | NcNode machineCodeNode = createNodeIfNotExists(programProperties.getCraftEdition(),NcNode.TYPE_MACHINE_CODE, processEditionNode); |
| | | NcNode machineCodeNode = createNodeIfNotExists(programProperties.getCraftEdition(),NcNode.TYPE_MACHINE_CODE, processEditionNode,null); |
| | | //程序包名节点 |
| | | NcNode programPkgNode = createNodeIfNotExists(programProperties.getCraftEdition(),NcNode.TYPE_PROGRAM_PACKAGE, machineCodeNode); |
| | | NcNode programPkgNode = createNodeIfNotExists(programProperties.getCraftEdition(),NcNode.TYPE_PROGRAM_PACKAGE, machineCodeNode,programProperties.getProcessInstanceId()); |
| | | |
| | | return programPkgNode; |
| | | //程序文件节点,多个文件需要循环创建 |
| | |
| | | * @param parentNode 父节点 |
| | | * @return |
| | | */ |
| | | NcNode createNodeIfNotExists(String name,String nodeType,NcNode parentNode){ |
| | | NcNode createNodeIfNotExists(String name,String nodeType,NcNode parentNode,String processInstanceId) { |
| | | Optional<NcNode> nodeOpt = this.ncNodeService.lambdaQuery().eq(NcNode::getName,name).eq(NcNode::getNodeType,nodeType).eq(NcNode::getParentId,parentNode.getId()).oneOpt(); |
| | | if(nodeOpt.isPresent()){ |
| | | return nodeOpt.get(); |
| | |
| | | ncNode.setParentId(parentNode.getId()); |
| | | ncNode.setParentIds(parentNode.getParentIds() + "," + parentNode.getId()); |
| | | ncNode.setNodeType(nodeType); |
| | | ncNode.setProcessInstanceId(processInstanceId); |
| | | ncNodeService.save(ncNode); |
| | | |
| | | return ncNode; |