SOA Service Client : Create Relation Between Manufacturing Objects

本文详细介绍了在Teamcenter环境中创建制造流程计划的方法,包括如何在不同制造对象间建立关联,如过程修订、工作区域、操作及文档之间的链接。同时,讲解了如何递归打印完整的物料清单(BOM),并创建协作上下文来关联流程、产品和工厂上下文。
部署运行你感兴趣的模型镜像

Dealing with Manufacturing process plan
How do you create relation between manufacturing objects ?
Important steps are
1)Open context
2)Create Relation
2)Save BOM Window
3)Close Context

Open Context

com.teamcenter.services.strong.manufacturing.DataManagementService dataManagementService

= com.teamcenter.services.strong.manufacturing.DataManagementService.getService( connection );

//Get Plant Model object
ModelObject mdlPlantobbj=getModelObjectsFromUIDs(new String[]{"yUWhDLC_Y95QJC"},connection)[0];

OpenContextInput[] openContextInps = new OpenContextInput[1];
openContextInps[0] = new OpenContextInput();
openContextInps[0].object = getModelObjectsFromUIDs( new String[]{ "S8chkjqvY95QJC" }, connection )[0];
openContextInps[0].openAssociatedContexts = true; //This will open all context i.e if user has associated/linked something to Process then that will open in their respective context
openContextInps[0].openViews = true;
openContextInps[0].contextSettings = new CreateInput();

OpenContextsResponse openContexts = dataManagementService.openContexts( openContextInps );
OpenContextInfo openContextInfo = openContexts.output[0].contexts[0]; //Process context
ModelObject topLine = openContextInfo.context; //Process Top line

OpenContextInfo openContextInfo1 = openContexts.output[0].contexts[2];//WorkArea context
ModelObject factorytopline=openContextInfo1.context;

/*------ Create Relation Left=MEProcessRevision Right=MEWorkArea  -> plant --------*/

//Get Plant Model object
ModelObject mdlPlantobbj=getModelObjectsFromUIDs(new String[]{"yUWhDLC_Y95QJC"},connection)[0];

com.teamcenter.services.strong.manufacturing.DataManagementService dataManagementService
= com.teamcenter.services.strong.manufacturing.DataManagementService.getService( connection );


ConnectObjectsInputData[] connectinfor = new ConnectObjectsInputData[1];
connectinfor[0] = new ConnectObjectsInputData();
connectinfor[0].targetObjects = new ModelObject[]{ leftObject };

SourceInfo sourceInfoobj=new SourceInfo() ;


sourceInfoobj.sourceObjects=new ModelObject[]{ mdlPlantobbj};
sourceInfoobj.additionalInfo.stringProps=
hmChildObjectAttributes; //Property to be set on MEWorkArea
sourceInfoobj.relationType= "MEWorkArea";//Used to set the Occurrence Type
sourceInfoobj.additionalInfo.boolProps.put("occTypeFromPreferenceFlag", false);

connectinfor[0].sourceInfo=sourceInfoobj;

ConnectObjectResponse connectObjects = dataManagementService.connectObjects(connectinfor);

connectObjects.newObjects; // This will give us array of BOMLine objects created

/*------ Create Relation Left=MEProcessRevision Right=Operation --------*/

ModelObject mdlOperationobbj=
getModelObjectsFromUIDs(new String[]{"idThVI8tY95QJC"},connection)[0];
com.teamcenter.services.strong.structuremanagement.StructureService strservice_oper=
com.teamcenter.services.strong.structuremanagement.StructureService.getService(connection);


ConnectObjectsInputData[] connectinforoperationandprocess=new ConnectObjectsInputData[1];
connectinforoperationandprocess[0]=new ConnectObjectsInputData();
connectinforoperationandprocess[0].targetObjects=
new ModelObject[]{topLineObject};//process topline

SourceInfo sourceInfoobjopME=new SourceInfo() ;
sourceInfoobjopME.sourceObjects=new ModelObject[]{mdlOperationobbj};

connectinforoperationandprocess[0].sourceInfo=sourceInfoobjopME;
ConnectObjectResponse connectObjects = 
dataManagementService.connectObjects(connectinforoperationandprocess);

//How to set the Bomline attribute
//i.e how to set the find number or other attibute on operation BOMLine created recently
//This is achieved using

com.teamcenter.services.strong.bom.StructureManagementService ds1 = com.teamcenter.services.strong.bom.StructureManagementService.getService( connection );

AddOrUpdateChildrenToParentLineInfo[] infos = new AddOrUpdateChildrenToParentLineInfo[1];
infos[0] = new AddOrUpdateChildrenToParentLineInfo();
infos[0].parentLine = topLineObject;

ItemElementLineInfo[] itemElements = new ItemElementLineInfo[1];
itemElements[0] = new ItemElementLineInfo();
itemElements[0].itemElementline 
= (BOMLine) connectObjects.newObjects[0];//This is operation BOMLine got from execution of connectObjects method
itemElements[0].itemElementLineProperties.put( "TEMPLATE ACTION", "Reference" );
itemElements[0].itemElementLineProperties.put( "bl_sequence_no", "90" );

infos[0].itemElements = itemElements;

AddOrUpdateChildrenToParentLineResponse addOrUpdateChildrenToParentLine = 
ds1.addOrUpdateChildrenToParentLine( infos );

/*------ Create Relation Left=Operation Right= Document --------*/

ModelObject mdlDocumentobbj=
getModelObjectsFromUIDs(new String[]{"SxRhkmxTY95QJC"},connection)[0];

 ConnectObjectsInputData[] connectinfor=new ConnectObjectsInputData[1];
 connectinfor[0]=new ConnectObjectsInputData();
 connectinfor[0].targetObjects=
new ModelObject[]{operationline};//operationline is operation BOMLine to which we need to add child document

 SourceInfo sourceInfoobj=new SourceInfo() ;
 sourceInfoobj.sourceObjects=new ModelObject[]{mdlDocumentobbj};
 sourceInfoobj.relationType="KK_ManufacturingDocumentation"; //Occurrence Type
 sourceInfoobj.additionalInfo.boolProps.put("occTypeFromPreferenceFlag", false);
//Above bollProps must be specified to set occurrence type

 connectinfor[0].sourceInfo=sourceInfoobj;

 dataManagementService.connectObjects(connectinfor);

 /*------ Create Relation Left=Operation Right=RR_Part - > optegra part --------*/

ModelObject mdloptegraobj=
getModelObjectsFromUIDs(new String[]{"j9chklAWY95QJC"},connection)[0];

ConnectObjectsInputData[] connectinforoper_optegrapart=new ConnectObjectsInputData[1];
connectinforoper_optegrapart[0]=new ConnectObjectsInputData();
connectinforoper_optegrapart[0].targetObjects=new ModelObject[]{operationline_OPER_optegra};//operationline_OPER_optegra is operation BOMLine to which we need to add child part

SourceInfo sourceInfoobj_oper_optegrapart=new SourceInfo() ;
sourceInfoobj_oper_optegrapart.sourceObjects=new ModelObject[]{mdloptegraobj};
sourceInfoobj_oper_optegrapart.relationType=
"KK_Reference"; //Occurrence Type it can be //MEResource/MECONSUMED
sourceInfoobj_oper_optegrapart.additionalInfo.boolProps.put("occTypeFromPreferenceFlag", false);//This must be specified to set occurrence type
connectinforoper_optegrapart[0].sourceInfo=sourceInfoobj_oper_optegrapart;

dataManagementService.connectObjects(connectinforoper_optegrapart);

//SAVE BOM WINDOW

com.teamcenter.services.strong.cad.StructureManagementService cadSMService =
com.teamcenter.services.strong.cad.StructureManagementService.getService(connection);

BOMWindow bomwindow1=(BOMWindow)topLine.get_bl_window();
cadSMService.saveBOMWindows(new BOMWindow[]{bomwindow1});

//Close Context

dataManagementService.closeContexts( new ModelObject[]{ topLine } );

How to Print complete BOM Recursively

private void printBoMLine(ModelObject topLine, Connection connection) throws NotLoadedException
{

  if ( topLine instanceof BOMLine )
  {
      BOMLine topLineObject = (BOMLine)  topLine;
      DataManagementService dataManagementService = 
      DataManagementService.getService( connection );
      dataManagementService.getProperties( new ModelObject[] { topLineObject }, new String[]{ "bl_all_child_lines", "bl_formatted_title" } );
      String sName = topLineObject.get_bl_formatted_title();
      ModelObject[] allChildLines = topLineObject.get_bl_all_child_lines();
      for ( int i = 0; i < allChildLines.length; i++ )
 {
  BOMLine bomLine = (BOMLine) allChildLines[i];
  dataManagementService.getProperties( new ModelObject[] { bomLine }, new String[]{ "bl_formatted_title" } );
  System.out.println( bomLine.get_bl_formatted_title() );
  printBoMLine( bomLine, connection );
 }
   }
}

/*---Create Collaboration Context and create Relation to Process,Product,Plant context----*/

CreateIn[] createIn = new CreateIn[1];
createIn[0] = new CreateIn();
createIn[0].data.stringProps.put( "object_name", "cc_object_name" );
createIn[0].data.boName = "MECollaborationContext";

//dataManagementService1 is com.teamcenter.services.strong.core.DataManagementService object

CreateResponse createObjects = 
dataManagementService1.createObjects( createIn );// Create Collaboration context object

MECollaborationContext modelObject = 
(MECollaborationContext) createObjects.output[0].objects[0]; //Get the Collaboration context object

//Now link Other context object to Collaboration context

//When you do open context its output response gives you all context objects

CreateConfigInput[] createConfigInp = new CreateConfigInput[1];
createConfigInp[0] = new CreateConfigInput();
createConfigInp[0].modifyObject = modelObject;//Collaboration context object

//Info about process context
CreateConfigInput[] internalConfigData = new CreateConfigInput[3];
internalConfigData[0] = new CreateConfigInput();
internalConfigData[0].data.type = "MEProcessContext";
internalConfigData[0].data.stringProps.put( "object_name", "process context name " );

//actual object of process context
internalConfigData[0].basedOn = 
openContexts.output[0].contexts[0].context;//openContexts is OpenContextsResponse object ,this line gives you Process context which is process top line


//Info about Product context
internalConfigData[1] = new CreateConfigInput();
internalConfigData[1].data.type = "MEProductContext";
internalConfigData[1].data.stringProps.put( "object_name", "prod context name " );

//actual object of product context
internalConfigData[1].basedOn =
openContexts.output[0].contexts[1].context;//openContexts is OpenContextsResponse object ,this line gives you Product context which is process top line

//Info about Product context
internalConfigData[2] = new CreateConfigInput();
internalConfigData[2].data.type = "MEPlantContext";
internalConfigData[2].data.stringProps.put( "object_name", "plant context name" );


//actual object of plant context
internalConfigData[2].basedOn =
openContexts.output[0].contexts[2].context;//openContexts is OpenContextsResponse object ,this line gives you Plant context which is process top line

createConfigInp[0].internalConfigData = internalConfigData;
CreateConfigResponse createOrUpdateConfigObjects =
dataManagementService.createOrUpdateConfigObjects( createConfigInp );// Create Relation between Collaboration context and  Process,Product,plant context

/*-------------------------------------------------------------------------------------------------------*/

/*--------------------------------Create Form and Attach to Collaboration Context------------------------*/

//Create Form
createIn[0] = new CreateIn();
createIn[0].data.stringProps.put( "object_name", "sample_Info_name" );
createIn[0].data.stringProps.put( "object_desc", "Sample_Info desc" );
createIn[0].data.boName = "FormObjectName";//This is Business Object name for form

CreateResponse createObjectsForm = 
dataManagementService1.createObjects( createIn ); // create form object

//End Create form

CreateOrUpdateRelationsInfo[] inps = new CreateOrUpdateRelationsInfo[1];
inps[0] = new CreateOrUpdateRelationsInfo();
inps[0].primaryObject = modelObject;//collaboration context object

SecondaryData[] secondaryData = new SecondaryData[1];
secondaryData[0] = new SecondaryData();
secondaryData[0].secondary = 
createObjectsForm.output[0].objects[0];//Created form object

inps[0].secondaryData = secondaryData;
inps[0].relationType = "IMAN_reference";

//dataManagementService1 is com.teamcenter.services.strong.core.DataManagementService object

CreateOrUpdateRelationsResponse createOrUpdateRelations = 
dataManagementService1.createOrUpdateRelations( inps, false ); //Create relation between Collaboration context and form

您可能感兴趣的与本文相关的镜像

ACE-Step

ACE-Step

音乐合成
ACE-Step

ACE-Step是由中国团队阶跃星辰(StepFun)与ACE Studio联手打造的开源音乐生成模型。 它拥有3.5B参数量,支持快速高质量生成、强可控性和易于拓展的特点。 最厉害的是,它可以生成多种语言的歌曲,包括但不限于中文、英文、日文等19种语言

<think>我们正在处理OracleEBSR12中的一个具体错误:在创建公司间AR发票时出现警告:“MandatoryIntercompanyRelationorTransactionflownotdefinedbetweenthetwoorganizations”。这个错误意味着在两个组织之间缺乏必要的公司间关系或交易流定义。为了解决这个问题,我们需要确保正确配置公司间关系、交易流以及相关的系统选项。根据OracleEBS的系统设置,创建公司间发票需要在两个组织(即交易方)之间定义好公司间关系(IntercompanyRelations)和交易流(TransactionFlows)。这些设置通常在“公司间系统设置”模块中完成。解决方案步骤如下:1.确认组织关系:首先,确保两个组织(销售方和采购方)都在同一个法人实体(LegalEntity)下,或者分属不同的法人实体但已经正确建立了公司间关系。2.设置公司间关系(IntercompanyRelations):-使用具有系统管理员权限的用户登录。-导航到:`总账管理器`>设置>财务系统>公司间关系(具体路径可能根据菜单个性化设置有所不同)。-在“公司间关系”页面,确保已经为涉及的两个组织(组织A和组织B)定义了关系。关系应该是双向的(即从A到B和从B到A)。-确保公司间关系设置中启用了“发票”交易类型。3.设置交易流(TransactionFlows):-在公司间关系设置中,同一个页面上,通常有交易流设置的子区域或链接(或者可能需要导航到单独的“交易流”设置)。-为两个组织间的事务类型(这里为“发票”)定义交易流。确保已经正确设置了从销售组织到采购组织的交易流(包括应收和应付方向)。-检查交易流的会计设置,确保已分配正确的自然账户段值(这通常与公司间往来科目相关)。4.验证系统选项:-导航到:`应付账款管理器`或`应收帐款管理器`>设置>选项(系统选项)。-在系统选项中,检查是否启用了公司间功能。例如,在应付款系统选项中,确保“公司间”选项设置为“是”。5.检查多组织访问控制(MOAC):-确保用户的操作职责可以访问这两个组织,并且当前的MOAC上下文设置正确(即能够看到这两个组织)。6.检查配置文件选项:-确保配置文件选项“MO:运营单位”(MO:OperatingUnit)设置正确,当前用户会话的运营单位正确。-检查与公司间相关的其他配置文件选项,如“GL:业务流”(GL:BusinessFlow)等。7.重新提交请求:-在完成上述设置后,重新尝试创建公司间AR发票,看是否问题解决。8.如果问题仍然存在,请检查日志和调试信息:-启用调试(如果可能)以获取更详细的错误信息。-查看并发请求的日志,看是否有更具体的错误提示。注意:以上步骤基于标准OracleEBSR12的功能。由于系统可能经过定制,建议在测试环境先验证。如果这些步骤不能解决问题,可能需要进一步分析,例如检查公司间账户映射、公司间事务的自动会计设置等。参考资源:[^1]:OracleE-BusinessSuiteIntercompanyAccountingUserGuide(Release12.2)[^2]:OracleE-BusinessSuiteSetupGuideforIntercompany(Release12.2)§§相关问题§§1.如何在OracleEBS中设置公司间关系?2.如何配置公司间交易流?3.公司间发票的会计处理流程是怎样的?4.如何诊断OracleEBS中的公司间错误?</think> ### 解决Oracle EBS R12中公司间AR发票创建错误 错误提示 **"Warning: Mandatory Intercompany Relation or Transaction flow not defined between the two organizations"** 表明系统缺少组织间的公司间关系或交易流定义。以下是系统级解决方案(需管理员权限): --- ### **根本原因** 创建公司间AR发票需要预先配置: 1. **组织间关系**(法人实体/运营单位的关联关系) 2. **公司间交易流**(发票的会计规则和路径) 3. **跨组织账户映射**(科目自动匹配规则)[^1] --- ### **解决方案步骤** #### **1. 验证公司间关系** - **路径**:`N: 总账管理器 > 设置 > 财务系统 > 公司间关系` - **检查项**: - 两个组织(销售方/采购方)是否在同一法人实体下 - 关系状态是否为“已启用” - 起始/终止日期是否包含当前日期 - 事务类型包含`AR Invoice` > ✅ **修复**:若缺失则新建关系,保存后提交请求 **“生成公司间关系”** #### **2. 配置公司间交易流** - **路径**:`应付账款管理器 > 设置 > 选项 > 公司间 > 交易流` - **检查项**: - 交易流是否定义 **卖方组织 → 买方组织** 方向 - 事务类型是否为`Invoice` - 科目分配规则是否完整(应收/应付科目) > ✅ **修复**:新建交易流,确保会计科目段值正确映射 #### **3. 设置公司间账户** - **路径**:`总账管理器 > 设置 > 账户 > 公司间账户` - **检查项**: - 买卖双方的法人实体是否建立账户映射 - 公司间往来科目(如`2222-000-公司间往来`)是否配置 > ✅ **修复**:补充缺失账户,运行请求 **“创建公司间账户”** #### **4. 系统级验证** - **提交诊断请求**: ```sql EXEC arp_ic_utils.validate_ic_relation(p_seller_org_id, p_buyer_org_id); -- 检查关系有效性 ``` - **关键配置文件**: ```sql SELECT PROFILE_OPTION_VALUE FROM fnd_profile_option_values WHERE PROFILE_OPTION_ID = (SELECT PROFILE_OPTION_ID FROM fnd_profile_options_tl WHERE PROFILE_OPTION_NAME = 'MO: Security Profile'); ``` --- ### **预防措施** 1. 新增组织时同步更新公司间关系 2. 定期运行 **“验证公司间设置”** 标准请求(路径:`N: 系统管理员 > 请求 > 运行`) 3. 使用 **AD_DIAGNOSTIC** 工具检查配置完整性[^2] --- ### **调试说明** - **日志路径**:`$APPLCSF/$APPLLOG` 查看 `ar*.log` - **关键表**: ```sql SELECT * FROM ar_ic_relationships; -- 公司间关系表 SELECT * FROM ar_ic_flows_v; -- 交易流视图 ``` > ⚠️ **警告**:修改前务必在测试环境验证!直接修改生产环境可能导致财务数据断裂。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值