#include"kutil.h" #include #define ITK_err 919012 void sendTCMail(char* title, int ifail, string contents, tag_t rootTask_tag) { //发送TC邮件 tag_t envelope, owning_user, envelope2, user2; char* userId; AOM_ask_owner(rootTask_tag, &owning_user); AOM_ask_value_string(owning_user, "user_id", &userId); ITKCALL(ifail = MAIL_create_envelope(title, contents.c_str(), &envelope)); ITKCALL(ifail = MAIL_initialize_envelope2(envelope, title, contents.c_str())); ITKCALL(ifail = MAIL_add_envelope_receiver(envelope, owning_user)); ITKCALL(ifail = MAIL_send_envelope(envelope)); //发给殷工 SA_find_user2("two", &user2); ITKCALL(ifail = MAIL_create_envelope(title, contents.c_str(), &envelope2)); ITKCALL(ifail = MAIL_initialize_envelope2(envelope2, title, contents.c_str())); ITKCALL(ifail = MAIL_add_envelope_receiver(envelope2, user2)); ITKCALL(ifail = MAIL_send_envelope(envelope2)); printf("tc邮寄发送成功"); } int TEST(EPM_action_message_t msg) { int ifail = ITK_ok, task_count = 0; int attachments_num = 0, * attach_type; tag_t rootTask = NULLTAG, cur_perform_task, memberTag; tag_t* attachments = NULLTAG, *task_tags = NULLTAG; //获取任务对象 EPM_ask_root_task(msg.task, &rootTask); //获取任务目标对象 //EPM_ask_attachments(rootTask, EPM_target_attachment, &attachments_num, &attachments); char* puid = NULL; ITK__convert_tag_to_uid(rootTask, &puid); printf("当前根节点的puid为:%s\n", puid); EPM_ask_sub_tasks(rootTask, &task_count, &task_tags); for (int i = 0; i < task_count; i++) { char* task_type = NULL; WSOM_ask_object_type2(task_tags[i], &task_type); printf("当前节点的类型为:%s\n", task_type); if (strcmp("EPMReviewTask", task_type) == 0 || strcmp("EPMAcknowledgeTask", task_type) == 0) { EPM_ask_sub_task(task_tags[i], "select-signoff-team", &cur_perform_task); EPM_ask_all_attachments(cur_perform_task, &attachments_num, &attachments, &attach_type); if (attachments > 0) { for (int j = 0; j < attachments_num; j++) { char* comment = NULL; date_t decision_date_temp; tag_t aUserTag = NULLTAG; EPM_signoff_decision_t dec; SIGNOFF_TYPE_t memberType; ITKCALL(EPM_ask_signoff_decision(attachments[j], &dec, &comment, &decision_date_temp)); ITKCALL(EPM_ask_signoff_member(attachments[j], &memberTag, &memberType)); printf("用户标签为:%d\n", memberTag); ITKCALL(SA_ask_groupmember_user(memberTag, &aUserTag)); char* name; ITKCALL(SA_ask_user_person_name2(aUserTag, &name)); printf("用户名称为:%s\n", name); } } } } //sendTCMail("题目...", ifail, "内容ceshi", rootTask); return ifail; } int TEST3(EPM_action_message_t msg) { int ifail = ITK_ok, att_cnt = 0, arg_cnt = 0; char* arg = NULL, * argflag = NULL, * argvalue = NULL; tag_t* attachments = NULLTAG, task_tag = NULLTAG, rootTask_tag; string type,grant_value; vector types; arg_cnt = TC_number_of_arguments(msg.arguments); if (arg_cnt > 0) { for (int i = 0; i < arg_cnt; i++) { arg = TC_next_argument(msg.arguments); ITKCALL(ifail = ITK_ask_argument_named_value(arg, &argflag, &argvalue)); if (strcmp(argflag, "type") == 0) { type.assign(argvalue); printf("%s\n", argvalue); } else if (strcmp(argflag, "grant") == 0) { grant_value.assign(argvalue); printf("%s\n", argvalue); } MEM_free(argflag); MEM_free(argvalue); } } else { EMH_store_error_s1(EMH_severity_error, ITK_err, "未配置流程参数"); ifail = 1; goto end; } { if (grant_value.empty()) { EMH_store_error_s1(EMH_severity_error, ITK_err, "未配置流程参数:-grant"); ifail = 1; goto end; } Split(type, ";", types); if (types.size() == 0) { EMH_store_error_s1(EMH_severity_error, ITK_err, "未配置流程参数:-type"); ifail = 1; goto end; } } end: DOFREE(attachments); return ifail; } int TEST2(EPM_action_message_t msg) { int ifail = ITK_ok; int attachments_num = 0; tag_t rootTask = NULLTAG; tag_t* attachments = NULLTAG; //获取任务对象 EPM_ask_root_task(msg.task, &rootTask); //获取任务目标对象 EPM_ask_attachments(rootTask, EPM_target_attachment, &attachments_num, &attachments); for (int i = 0; i < attachments_num; i++) { //新建pdf数据集 tag_t item = NULLTAG,rev = attachments[i], spec_relation; const char name[AE_datasettype_name_size_c + 1] = "Text"; char ref_name[WSO_name_size_c + 1] = "Text"; tag_t datasetType = NULLTAG, tool = NULLTAG; tag_t newDatasetTag = NULLTAG; //新数据集的tag tag_t relation = NULLTAG; AE_find_datasettype2(name, &datasetType); AE_create_dataset_with_id(datasetType, "数据集名称蛇皮", "数据集描述", "", "", &newDatasetTag); AOM_lock(newDatasetTag); AE_ask_datasettype_def_tool(datasetType, &tool); AE_set_dataset_tool(newDatasetTag, tool); AE_set_dataset_format2(newDatasetTag, name); AOM_save(newDatasetTag); AOM_unlock(newDatasetTag); AOM_refresh(newDatasetTag, TRUE); //ITEM_attach_rev_object2(rev, newDatasetTag, ITEM_specification_atth); GRM_find_relation_type("IMAN_specification", &spec_relation); //关联变更件(变更相关附件) GRM_create_relation(rev, newDatasetTag, spec_relation, NULLTAG,&relation); GRM_save_relation(relation); //添加命名的引用 import_dataset_file(newDatasetTag,ref_name,"txt", "C:\\Users\\Administrator\\Desktop\\新建文件夹\\2.txt", "命名的引用名字"); //tag_t new_file_tag = NULLTAG; //IMF_file_t file_descriptor; //char new_ds_name[WSO_name_size_c + 1] = ""; //char* new_file_name = USER_new_file_name(new_ds_name, ref_name, "txt", 0);//方法为数据集生成文件名。 //IMF_import_file("C:\\Users\\Administrator\\Desktop\\新建文件夹\\2.txt", new_file_name, SS_TEXT, &new_file_tag, &file_descriptor); //AOM_lock(new_file_tag); //IMF_set_original_file_name2(new_file_tag, "命名的引用名字"); //IMF_close_file(file_descriptor); //AOM_save(new_file_tag); //AOM_unlock(new_file_tag); //AOM_refresh(new_file_tag, TRUE); //AOM_lock(newDatasetTag); //AE_add_dataset_named_ref2(newDatasetTag, ref_name, AE_PART_OF, new_file_tag); //AE_save_myself(newDatasetTag); //AOM_unlock(newDatasetTag); //AOM_refresh(newDatasetTag, TRUE); } return ifail; }