0

我正在使用 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)

敏捷 API 需要一个带有属性和值的哈希图作为参数来创建关系。所以这是我的代码:

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 类型,这种 Map 用于添加 BOM 项和附件,所以我认为这不是问题所在。

我只是手动查询了现有关系的单元格,并将它们的键与我在此映射中使用的常量进行了比较,它们是相同的。我真的不知道无效参数是什么。是不是缺少一个属性?参数的类型是否错误?没有迹象表明出了什么问题。

4

1 回答 1

0

好的,答案很简单,尽管它与 BOM 的工作方式不同并且没有记录。

解决方案只是将要添加的 iiitem 作为关系传递:relationshipTable.createRow(iiitem)

于 2021-04-07T14:53:13.167 回答