首页 > 其他分享 >teamcenter 创建Item是带必填项实现

teamcenter 创建Item是带必填项实现

时间:2024-03-29 10:11:53浏览次数:22  
标签:createInput 必填 param Item teamcenter session new throws CreateInput

 

其中itemUom 为度量单位

/**
*  度量单位的获取
* @Title: getMeasureMap
* @Description: TODO
* @param session
* @Author:wushigao
* @CreateDate:2022 Feb 25 08:29:00
*/
public static Map<String,TCComponentUnitOfMeasure> getMeasureMap(TCSession session) {
Map<String,TCComponentUnitOfMeasure> unitOfMeasureMap = new HashMap<>();
TCComponentType uomType;
try {
uomType = session.getTypeComponent("UnitOfMeasure");
TCComponent[] uoms = uomType.extent();
// System.out.println("UOM Count:" + uoms.length);
for (int i = 0; i < uoms.length; i++) {
TCComponentUnitOfMeasure measure = (TCComponentUnitOfMeasure) uoms[i];
System.out.println(measure);
unitOfMeasureMap.put(measure.toString(), measure);
}
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return unitOfMeasureMap;
}

 

 item版本与itemRevesion创建时必填项的带入

/**
* 20240109 add hzh
* @param session
* @param typeName
* @param itemMap
* @param revesionMaps
* @param itemUom
* @return
* @throws ServiceException
* @throws TCException
* @throws InterruptedException
* @throws ExecutionException
*/
public TCComponent createComponent(TCSession session, String typeName, Map<String, String> itemMap,
Map<String, String> revesionMaps, TCComponent itemUom)
throws ServiceException, TCException, InterruptedException, ExecutionException {
TCComponentItem tcComponentItem = null;
DataManagementService dataManagementService = DataManagementService.getService(session);
CreateInput createInput = new CreateInput();
createInput.boName = typeName;
createInput.stringProps = itemMap;
CreateIn createIn = new CreateIn();
createInput.tagProps.put("uom_tag", itemUom);

createIn.data = createInput;

// revision
CreateInput createRevInput = new CreateInput();
createRevInput.boName = typeName + "Revision";
createRevInput.stringProps = revesionMaps;
List<CreateInput> createInputs = Lists.newArrayList(createRevInput);
createInput.compoundCreateInput.put("revision", createInputs.toArray(new CreateInput[] {}));

List<CreateIn> createIns = Lists.newArrayList(createIn);
CreateResponse createResponse = dataManagementService.createObjects(createIns.toArray(new CreateIn[] {}));
SoaUtil.checkPartialErrors(createResponse.serviceData);
for (CreateOut createOut : createResponse.output) {
for (TCComponent tcComponent : createOut.objects) {
if (tcComponent instanceof TCComponentItem) {
tcComponentItem = (TCComponentItem) tcComponent;
}
}
}
return tcComponentItem;

}

标签:createInput,必填,param,Item,teamcenter,session,new,throws,CreateInput
From: https://www.cnblogs.com/huangzuhong/p/18103164

相关文章

  • 2-18. 创建 InventoryManager 和 Item
    创建Singleton创建InventoryManager创建ItemBase接下来修改碰撞体大小这样写是因为图片的锚点可能在底部,所以需要修改coll.offset项目相关代码代码仓库:https://gitee.com/nbda1121440/DreamOfTheKingdom.git标签:20240328_2045......
  • Qt显示图像之QGraphicsPixmapItem
    为防止不断地addItem导致内存增长,建议在初始化时newItem、scene->addItem。在合适的地方scene->removeItem(或scene->clear)或者item->setVisible。h头文件中#include<QGraphicsView>QGraphicsView*view;QGraphicsScene*scene;QGraphicsPixmapItem*m_pix=nullptr;cp......
  • content可以拿出来下面的子item里设置吗?
    content可以拿出来下面的子item里设置吗?<Buttonx:Name="_button"Content="退出"Width="100"Height="25"Click="_button_Click"IsDefault="True"/>......
  • Ant Design 设置必填属性的一个坑!Objects are not valid as a React child (found: ob
    1、刚开始,我是用第一种方式。通过一个变量,来设置必填属性的提示值 显示是没有问题的。但是点击ModalForm确认按钮时,报错ObjectsarenotvalidasaReactchild(found:objectwithkeys{requiredMsg}).Ifyoumeanttorenderacollectionofchildren,useanarray......
  • 【wpf】ListBoxItemIndexConverter转换器listbox序号自更新
    publicclassListBoxItemIndexConverter:IMultiValueConverter{publicobjectConvert(object[]values,TypetargetType,objectparameter,CultureInfoculture){stringindexPrefix=null;if(parameter!=null&&parameter......
  • IRIS / Chronicles 定义 Item 中的 Add Type 属性
    根据我们前面说的Item中的AddType属性,这个主要用来标识输入的数据是不是随着时间的变化而变化,有下面3种选项。No‐Add这个就是当数据输入后,是不会再变化了,不会随着时间的变化而变化。ResponseEachTime这个就是每次在数据在创建的时候都有可能会变化。比如说体重,当你......
  • WPF解决当ScrollViewer中嵌套ItemsControl时,不能使用鼠标来滚动翻页
    1.在DataGrid中添加PreviewMouseWheel事件,并将事件的Handled属性设置为false,以便将滚动事件传递给ScrollViewer。示例代码如下:<DataGridPreviewMouseWheel="DataGrid_PreviewMouseWheel"><!--DataGrid的其他设置--></DataGrid>privatevoidDataGrid_PreviewMouseWh......
  • 淘宝/天猫获得淘宝app商品详情原数据 API接口数据item_get_app,官方授权接口
     淘宝/天猫的API接口,特别是那些用于获取淘宝app商品详情原数据的接口,提供了强大的功能,使得开发者能够轻松地获取和处理淘宝平台上的商品信息。以下是这些API接口的主要功能:公共参数请求地址:item_get名称类型必须描述keyString是调用key(必须以GET方式拼接在URL中)secretSt......
  • 京东获得JD商品详情 API接口数据item_get(内含详细步骤)
    onebound.jd.item_get公共参数注册账号获取测试key 名称类型必须描述keyString是调用key(必须以GET方式拼接在URL中)secretString是调用密钥api_nameString是API接口名称(包括在请求地址中)[item_search,item_get,item_search_shop等]cacheString否[yes,no]默认yes,将调用缓存......
  • 阿里巴巴中国站获得1688商品详情 API接口数据item_get(内含详细步骤)
     阿里巴巴中国站(1688)提供的商品详情API为开发者提供了丰富的功能,使他们能够通过编程的方式访问和获取1688平台上的商品详细信息。以下是关于这个API功能的一些主要介绍:获取商品详情信息:通过API,开发者可以查询指定商品的详细信息,包括商品标题、描述、价格、库存等。这些信息......