admin 发表于 2014-1-15 19:33:29

teamcenter ITK二次开发源码分享: Item 创建 createpost操作


teamcenter ITK二次开发源码分享: Item 创建 createpost操作
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ug_va_copy.h>
#include <tc/emh.h>
#include <ict/ict_userservice.h>
#include <itk/bmf.h>
#include <tc/emh.h>
#include <tc/tc.h>
#include <tccore/item.h>
#include <tccore/method.h>
#include <metaframework/CreateInput.hxx>

extern "C" DLLAPI intA2_gtac_extension_rule(METHOD_message_t *m, va_list args)
{
    printf("\n\n A2_gtac_extension_rule \n\n");

    int ifail = ITK_ok;

    va_list largs;
    va_copy( largs, args );
    Teamcenter::CreateInput *creInput = va_arg(largs, Teamcenter::CreateInput*);
    va_end( largs );

    tag_t new_item = m->object_tag;   
    char *uid = NULL;
    ITK__convert_tag_to_uid(new_item, &uid);
    printf("    new_item: %s \n", uid);
    MEM_free(uid);


    bool isNull = true;
    tag_t new_rev = NULLTAG;
    ifail = creInput->getTag("revision", new_rev, isNull);
    if((isNull == FALSE)&& (ifail == ITK_ok))
    {
      printf("    new_rev: %u \n", new_rev);
    }
   
    tag_t master_form = NULLTAG;
    ifail = creInput->getTag("IMAN_master_form", master_form, isNull);
    if((isNull == FALSE)&& (ifail == ITK_ok))
    {
      printf("    master_form: %u \n", master_form);
    }

    std::string item_id = "";
    ifail = creInput->getString("item_id", item_id, isNull);
    if((isNull == FALSE)&& (ifail == ITK_ok))
    {
      printf("    item_id: %s \n", item_id.c_str());
    }

    std::string name = "";
    ifail = creInput->getString("object_name", name, isNull);
    if((isNull == FALSE)&& (ifail == ITK_ok))
    {
      printf("    object_name: %s \n", name.c_str());
    }

    return ifail;;
}



页: [1]
查看完整版本: teamcenter ITK二次开发源码分享: Item 创建 createpost操作