我正在使用Agile PLM API开发一个scala应用程序。到目前为止,一切都正常,添加附件、添加BOM条目、创建条目等等。
但是当在关系表中创建关系时,我总是得到这样的错误:
com.agile.api.APIException: Invalid parameter.
at com.agile.api.pc.Session.createError(Session.java:2039)
at com.agile.api.pc.APIObject.createError(APIObject.java:76)
at com.agile.api.pc.TableRelationships.convertCreateParamMapToVOCells(TableRelationships.java:92)
at com.agile.api.pc.TablePC.doCreateServerRowWithParam(TablePC.java:58)
at com.agile.api.pc.Table.createTableRow(Table.java:267)
at com.agile.api.pc.Table.createRow(Table.java:231)Agile API需要一个以属性和值作为参数的hashmap来创建关系。所以这是我的代码:
val cells: java.utils.Map[_, _] = Map(
Attrs.Items.Relationships.CriteriaMet -> null,
Attrs.Items.Relationships.TypeImage -> 666, // id of item type as Integer
Attrs.Items.Relationships.Name -> "foo", // name as String
Attrs.Items.Relationships.Description -> "bar", // the description as String
Attrs.Items.Relationships.CurrentStatus -> "Production", // lifecyclephase 'Production' as a String
Attrs.Items.Relationships.Rule -> null,
Attrs.Items.Relationships.Type -> 600 // id of item type as Integer
)
relationshipTable.createRow(cells)relationshipTable实例的类型是ITable,并且这种映射用于添加物料清单条目和附件,所以我认为这不是这里的问题。
我只是手动查询现有关系的单元格,并将它们的键与此映射中使用的常量进行比较,它们是相同的。我真的不知道无效参数是什么。是否缺少属性?参数的类型是否错误?没有迹象表明哪里出了问题。
发布于 2021-04-07 22:53:13
好的,答案很简单,尽管它与BOM的工作原理不同,并且没有文档记录。
解决方案只是简单地传递您想要作为关系添加的iitem : relationshipTable.createRow(iitem)
https://stackoverflow.com/questions/66976109
复制相似问题