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.
115 lines
3.2 KiB
115 lines
3.2 KiB
#define _CRT_SECURE_NO_WARNINGS
|
|
#include "epm_handler_common.h"
|
|
|
|
int Cut_ScheduleTask(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 resultString[1024] = "";
|
|
|
|
for (int i = 0; i < attachments_num; i++)
|
|
{
|
|
char *itemType = NULL;
|
|
|
|
AOM_ask_value_string(attachments[i], "object_type", &itemType);
|
|
printf("type_class : %s \r\n", itemType);
|
|
//过滤掉非时间表的对象
|
|
if ((strstr(itemType, "Schedule") == NULL))
|
|
{
|
|
DOFREE(itemType);
|
|
continue;
|
|
}
|
|
|
|
//获取基线时间表对应的基线时间表任务
|
|
tag_t bakScheduleTaskTags = NULLTAG;
|
|
//获取基线时间表任务
|
|
AOM_ask_value_tag(attachments[i], "fnd0SummaryTask", &bakScheduleTaskTags);
|
|
|
|
tag_t scheduleTaskTags = NULLTAG;
|
|
//获取时间表
|
|
AOM_ask_value_tag(bakScheduleTaskTags, "original_task_tag", &scheduleTaskTags);
|
|
//获取基线对应的时间表任务
|
|
tag_t scheduleTags = NULLTAG;
|
|
//获取时间表
|
|
AOM_ask_value_tag(scheduleTaskTags, "schedule_tag",&scheduleTags);
|
|
|
|
POM_AM__set_application_bypass(true);
|
|
cutScheduleTask(bakScheduleTaskTags, scheduleTags);
|
|
POM_AM__set_application_bypass(false);
|
|
|
|
DOFREE(itemType);
|
|
DOFREE(itemTags);
|
|
}
|
|
|
|
DOFREE(attachments);
|
|
|
|
auto stopTime = std::chrono::high_resolution_clock::now();
|
|
auto duration = std::chrono::duration_cast<std::chrono::microseconds>(stopTime - startTime);
|
|
//std::cout << "Cut_ScheduleTask用时:" << duration.count() / 1000 << std::endl;
|
|
string usetime = "Cut_ScheduleTask用时:";
|
|
usetime.append(std::to_string(duration.count() / 1000));
|
|
WriteLog(true, usetime.c_str());
|
|
printf("=========================删除时间表任务 End===================\n");
|
|
return ifail;
|
|
}
|
|
|
|
void cutScheduleTask(tag_t scheduleTaskTags,tag_t scheduleTags)
|
|
{
|
|
//判断表示下的对象是否包含时间表任务
|
|
int itemNum = 0;
|
|
tag_t * itemTags = NULLTAG;
|
|
|
|
AOM_ask_value_tags(scheduleTaskTags, "child_task_taglist", &itemNum, &itemTags);
|
|
if (itemNum > 0)
|
|
{
|
|
int cutItemNum = 0;
|
|
tag_t * cutItemTags = (tag_t *)MEM_alloc(1024 * sizeof(tag_t));
|
|
|
|
//判断是否剪切属性
|
|
for (int i = 0; i < itemNum; i++)
|
|
{
|
|
char * value = NULL;
|
|
AOM_ask_value_string(itemTags[i], "ml8_CutOrNot", &value);
|
|
if (strcmp(value, "不归") == 0)
|
|
{
|
|
tag_t scheduleTaskTags = NULLTAG;
|
|
//获取时间表
|
|
AOM_ask_value_tag(itemTags[i], "original_task_tag", &scheduleTaskTags);
|
|
AOM_lock(scheduleTaskTags);
|
|
AOM_set_value_string(scheduleTaskTags, "ml8_FilingRequirements", "N");
|
|
AOM_save(scheduleTaskTags);
|
|
AOM_unlock(scheduleTaskTags);
|
|
AOM_refresh(scheduleTaskTags, false);
|
|
|
|
cutItemTags[cutItemNum] = scheduleTaskTags;
|
|
cutItemNum++;
|
|
}
|
|
else
|
|
{
|
|
cutScheduleTask(itemTags[i], scheduleTags);
|
|
}
|
|
}
|
|
if (cutItemNum > 0)
|
|
{
|
|
int itasks = 0;
|
|
int iOrtasks = 0;
|
|
tag_t* ptTasks = NULL;
|
|
tag_t* ptOrTasks = NULL;
|
|
|
|
SCHMGT_delete_tasks_non_interactive(scheduleTags, cutItemNum, cutItemTags, &itasks, &ptTasks, &iOrtasks, &ptOrTasks);
|
|
DOFREE(ptTasks);
|
|
DOFREE(ptOrTasks);
|
|
}
|
|
|
|
DOFREE(itemTags);
|
|
}
|
|
|
|
|
|
} |