#define _CRT_SECURE_NO_WARNINGS #include "epm_handler_common.h" int ML_ReferencedIsHaveItem(EPM_action_message_t msg) { printf("=========================判断关系文件夹下是否包含相同对象 Start===================\n"); auto startTime = std::chrono::high_resolution_clock::now(); int ifail = ITK_ok; int attachments_num = 0; tag_t rootTask = NULLTAG, *attachments = NULLTAG; //获取任务对象 EPM_ask_root_task(msg.task, &rootTask); //获取任务目标对象 EPM_ask_attachments(rootTask, EPM_target_attachment, &attachments_num, &attachments); char *argflag = NULL, *argvalue = NULL, *arg = NULL; char arg1value[1024] = "", arg2value[1024] = "", arg3value[1024] = ""; //获取参数 int arg_cnt = TC_number_of_arguments(msg.arguments); printf("参数个数为:%d\n", arg_cnt); if (arg_cnt > 0) { for (int i = 0; i puidList; int tagNum = 0; tag_t * tags = NULLTAG; //获取指定关系下的对象 AOM_ask_value_tags(attachments[i], arg2value, &tagNum, &tags); for (int j = 0; j < tagNum; j++) { char * tag_uid = NULL; //根据Uid获取数据集 ITK__convert_tag_to_uid(tags[j], &tag_uid); puidList.push_back(tag_uid); } int tagNum2 = 0; tag_t * tags2 = NULLTAG; //获取指定关系下的对象 AOM_ask_value_tags(attachments[i], arg3value, &tagNum2, &tags2); for (int j = 0; j < tagNum2; j++) { char * tag_uid = NULL; //根据Uid获取数据集 ITK__convert_tag_to_uid(tags2[j], &tag_uid); int count = puidList.size(); for (int k = 0; k < count; k++) { if (strcmp(puidList.at(k), tag_uid) == 0) { char * objectString = NULL; AOM_ask_value_string(tags2[j], "object_string", &objectString); strcat(resultString, objectString); strcat(resultString, "\n"); ifail = 1; DOFREE(objectString); break; } } DOFREE(tag_uid); } puidList.clear(); vector().swap(puidList); DOFREE(tags); DOFREE(tags2); DOFREE(itemType); } DOFREE(attachments); if (ifail == 1) { strcat(resultString, "在两个关系下都存在!"); EMH_store_error_s1(EMH_severity_user_error, EMH_USER_error_base, resultString); } auto stopTime = std::chrono::high_resolution_clock::now(); auto duration = std::chrono::duration_cast(stopTime - startTime); //std::cout << "ML_ReferencedIsHaveItem用时:" << duration.count() / 1000 << std::endl; string usetime = "ML_ReferencedIsHaveItem用时:"; usetime.append(std::to_string(duration.count() / 1000)); WriteLog(true, usetime.c_str()); printf("=========================判断关系文件夹下是否包含相同对象 End===================\n"); return ifail; }