首页 > 其他 > 详细

[服务器端ITK] teamcenter ITK二次开发源码分享: 创建一个工作流

时间:2021-06-21 23:49:58      阅读:27      评论:0      收藏:0      [点我收藏+]
/*HEAD CREATE_A_PROCESS CCC ITK */ 
#include <stdlib.h> 
#include <TCcore/aom.h> 
#include <tc/emh.h> 
#include <tc/tc.h> 
#include <sa/tcfile.h> 

#include <itk/mem.h> 
#define ERROR_CHECK(X) (report_error( __FILE__, __LINE__, #X, (X))) 
static void report_error( char *file, int line, char *function, int return_code) {
    if (return_code != ITK_ok) {
        char *error_message_string; 
        EMH_get_error_string (NULLTAG, return_code, &error_message_string); 
        printf ("ERROR: %d ERROR MSG: %s.\n", return_code, error_message_string); 
        printf ("FUNCTION: %s\nFILE: %s LINE: %d\n", function, file, line); 
        if(error_message_string){
            MEM_free(error_message_string); 
        }
        printf("\nExiting program!\n"); 
        exit (EXIT_FAILURE); 
    }
}

#define EXIT_IF_NULL(X) (check_value(#X, (X))) 
static void check_value( char *function, int value ) {
    if (value == 0) {
        printf ("\t%s is NULL\n", function); 
        printf("\nExiting program!\n"); 
        exit (EXIT_FAILURE); 
    }
}

static void do_it(void) {
    int attach_types[1] = {1}; 
    tag_t rev = NULLTAG, 
    process_template = NULLTAG, 
    process = NULLTAG; 
    ERROR_CHECK( ITEM_find_rev("000206", "A", &rev) ); 
    EXIT_IF_NULL( rev );

    ERROR_CHECK( EPM_find_process_template("oneStepWithStatus", &process_template) ); 
    ERROR_CHECK( EPM_find_process_template("oneStepWithStatus", &process_template) ); 
    
    ERROR_CHECK( EPM_create_process("5421377", "desc", process_template, 1, &rev, 
    attach_types, &process) ); 
    EXIT_IF_NULL( process );     
}

int ITK_user_main(int argc, char* argv[]) {
    int status = 0; 
    
    ITK_initialize_text_services( ITK_BATCH_TEXT_MODE ); 
    status = ITK_auto_login(); 
    
    if ((status != ITK_ok)) printf("\nLogin Failed!\n\n"); 
    else {
        printf("\nLogin successful!\n\n"); 
        ITK_set_journalling(TRUE); 
        do_it(); 
    }
    ITK_exit_module(TRUE);
    return status;
}

 

[服务器端ITK] teamcenter ITK二次开发源码分享: 创建一个工作流

原文:https://www.cnblogs.com/wwssgg/p/14915815.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!