You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

223 lines
7.3 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

//#include "kutil.h"
//
////流程自动指派审批人
//int HS2_AutoAssign(EPM_action_message_t msg) {
//
// printf("===================================\n");
// printf("流程自动指派审批人 开始\n");
// printf("===================================\n");
// int ifail = ITK_ok;
// printf("开超级权限\n");
// POM_AM__set_application_bypass(true);
// int att_cnt = 0;
// tag_t task_tag = NULL_TAG,
// root_task_tag = NULLTAG,
// * attachments;
// char* argflag = NULL, * argvalue = NULL, * arg = NULL;
// int arg_cnt = 0;
// char task_name[1024] = "";
// vector<string> vec;
// char* message;
// //获取handler的参数的个数
// arg_cnt = TC_number_of_arguments(msg.arguments);
// ECHO("参数个数为:%d\n", arg_cnt);
//
// if (arg_cnt > 0)
// {
// for (int i = 0; i < arg_cnt; i++)
// {
// //获取下一个参数从0开始
// arg = TC_next_argument(msg.arguments);
// //获取参数的名称和值
// ITK_ask_argument_named_value((const char*)arg, &argflag, &argvalue);
// if (strcmp(argflag, "task") == 0)
// {
// if (argvalue != NULL)
// {
// strcpy(task_name, argvalue);
// }
// }
//
// }
// MEM_free(argflag);
// MEM_free(argvalue);
// }
// task_tag = msg.task;
// EPM_ask_root_task(task_tag, &root_task_tag);
// int cnt_task = 0; tag_t* tasks = NULLTAG;
// EPM_ask_sub_tasks(root_task_tag, &cnt_task, &tasks);
// //ITKCALL(EPM_ask_tasks(root_task_tag, EPM_started, &cnt_task, &tasks));
// EPM_ask_attachments(root_task_tag, EPM_target_attachment, &att_cnt, &attachments);
// if (att_cnt > 0) {
// for (int i = 0; i < att_cnt; i++)
// {
// tag_t rev_tag = attachments[i];
// char* tag_type;
// ITKCALL(AOM_ask_value_string(rev_tag, "object_type", &tag_type));
//
// if (strcmp("HS2_ChangeTaskRevision", tag_type) == 0) {
// int doc_num = 0;
// tag_t* doc_tags = NULL;
// tag_t* pathFile = NULLTAG;
// int Num = 0;
// char* excel_path;
// ITKCALL(AOM_ask_value_tags(rev_tag, "IMAN_specification", &doc_num, &doc_tags));
// char user[1024] = "\0";
// for (int j = 0; j < cnt_task; j++)
// {
// tag_t subtask = tasks[j];
// char* sub_task_object_type = NULL;
// char* sub_task_object_name = NULL;
// ITKCALL(AOM_ask_value_string(subtask, "object_name", &sub_task_object_name));
// cout << "名称--------" << sub_task_object_name << endl;
// ITKCALL(AOM_ask_value_string(subtask, "object_type", &sub_task_object_type));
// cout << "类型--------" << sub_task_object_type << endl;
// if (strcmp(task_name, sub_task_object_name) == 0)
// {
// cout << "bingo0" << endl;
// // ITKCALL( SA_find_user( "0120160006", &user_tag ));
// // ITKCALL( EPM_assign_responsible_party( task, user_tag));//设置编制节点的责任方
// tag_t tmp_select_signoff_task = NULLTAG;
// ITKCALL(EPM_ask_sub_task(subtask, EPM_select_signoff_team_task, &tmp_select_signoff_task));
// for (int k = 0; k < vec.size(); k++)
// {
// //构建器
// tag_t* results;
// const char query_name_product[1][QRY_name_size_c + 1] = { "管理 - 员工信息" };
// tag_t query_tag1 = NULLTAG;
// int entry_count1 = 0;
// char** entries1;
// char** values1;
// char* other_values1[1];
// char* other_entrys1[1];
// other_values1[0] = (char*)calloc(48, sizeof(char));
// other_entrys1[0] = (char*)calloc(48, sizeof(char));
// int num_found1 = 0;
// ITKCALL(QRY_find2(query_name_product[0], &query_tag1));
// if (query_tag1 == NULLTAG)
// {
// WriteLog("query_tag=NULLTAG,没找到 [%s]查询构建器!\n", query_name_product[0]);
// ITK_exit_module(1);
// return 0;
// }
// else
// {
// WriteLog("找到查询构建器\n");
// }
//
// ITKCALL(QRY_find_user_entries(query_tag1, &entry_count1, &entries1, &values1));//entries1查询条件表达式values1查询条件值MEM_free释放
// if (entry_count1 == 0)
// {
// WriteLog("entry_count1=0,查询构建器中没有配置查询条件!\n");
// //ITK_exit_module(1);
// if (entries1 != NULL) {
// MEM_free(entries1);
// entries1 = NULL;
// }
// if (values1 != NULL) {
// MEM_free(values1);
// values1 = NULL;
// }
// return 0;
// }
//
// //date_tag.second = p->tm_sec ;
//
// for (int n = 0; n < entry_count1; n++)
// {
// printf("entries1[%d]=%s\n", n, entries1[n]);
// if (tc_strcmp(entries1[n], "人员姓名") == 0) {
// //strcpy(values[n],nowtime1);
// tc_strcpy(other_entrys1[0], "人员姓名");
// tc_strcpy(other_values1[0], vec[k].c_str());//* 2012-05 NBJF16025 Test001 NBJF16046 16C104
// printf("other_values1[0] %s\n", other_values1[0]);
//
// }
//
// printf("values[%d]=%s\n", n, values1[n]);
//
// }
//
// ITKCALL(ifail = QRY_execute(query_tag1, 1, other_entrys1, other_values1, &num_found1, &results));
//
// if (ifail != ITK_ok) {
// EMH_ask_error_text(ifail, &message);
// WriteLog("程序异常 : \"%d\",\"%s\"\n", ifail, message);
// MEM_free(message);
// if (entries1 != NULL) {
// MEM_free(entries1);
// entries1 = NULL;
// }
// if (values1 != NULL) {
// MEM_free(values1);
// values1 = NULL;
// }
// return 0;
// }
// if (num_found1 == 0)
// {
// printf("num_found=0,查询构建器中没找到满足条件的数据!\n");
// //ITK_exit_module(1);
// if (entries1 != NULL) {
// MEM_free(entries1);
// entries1 = NULL;
// }
// if (values1 != NULL) {
// MEM_free(values1);
// values1 = NULL;
// }
// }
// //开始获取产品信息
// printf("查询构建器得到ITEM数num_found1: \"%d\" \n", num_found1);
//
// if (num_found1 != 0) {
// tag_t login_group = NULLTAG;
// printf("111\n");
// tag_t user = results[0];
// /* char* user_id;
// tag_t user_tag = NULLTAG;
// printf("222\n");
// int mem_cnt = 0;
// tag_t* members = NULL;*/
// int signoff_cnt = 0;
// tag_t* signoffs = NULL;
// /* ITKCALL(AOM_ask_value_string(user, "user_id", &user_id));
// printf("user_id=%s\n", user_id);
// ITKCALL(SA_find_user2(user_id, &user_tag));
// ITKCALL(SA_ask_user_login_group(user_tag, &login_group));
// printf("333\n");
// ITKCALL(SA_find_groupmembers(user_tag, login_group, &mem_cnt, &members));
// printf("mem_cnt=%d\n", mem_cnt);
// printf("444\n");
// ITKCALL(EPM_create_adhoc_signoff(tmp_select_signoff_task, members[0], &signoff_cnt, &signoffs));*/
// ITKCALL(EPM_create_adhoc_signoff(tmp_select_signoff_task, user, &signoff_cnt, &signoffs));
// printf("555\n");
// ITKCALL(EPM_set_adhoc_signoff_selection_done(tmp_select_signoff_task, true));
// printf("666\n");
// if (signoffs)
// {
// MEM_free(signoffs);
// signoffs = NULL;
// }
// }
//
// }
//
// // ITKCALL(EPM_trigger_action(tmp_select_signoff_task,EPM_complete_action, ""));
// break;
// }
// //}
// //}
// }
// }
// }
//
// }
//
// printf("关超级权限\n");
// POM_AM__set_application_bypass(false);
// printf("===================================\n");
// printf("流程自动指派审批人 结束\n");
// printf("===================================\n");
// return ifail;
//}