ARTICLE DETAIL

建站实战干货

来自一线的建站与推广经验沉淀,每一条都经过真实交付验证。

Teamcenter AWC实现根据项目模板名称 筛选任务箱任务 - 张永全

2026/8/11 5:53:54 拓冰建站 浏览量
Teamcenter AWC实现根据项目模板名称 筛选任务箱任务 - 张永全

1.动态属性或复合属性无法实现 筛选配置,TC设计 支持 数据库永久属性,或永久属性的复合属性 设置筛选。

The problem where we can't filter custom compound property in the Inbox on Active Workspace Client has been investigated and the following has been found:
Inbox filtering only works with persistent (and compound properties based on persistent properties) properties only. In this case the user has used a is As-Designed behavior.

2.在EPMTASK上增加 x1taskTemplate

image

 

3.开发handler,实现流程启动时,自动设置每个任务的流程模板属性。

#include "commons.hxx"
#include "actionmethod.hxx"
#include <iostream>
#include <tccore/uom.h>

#include <epm/epm.h>
#include <server_exits/user_server_exits.h>
#include "string.h"

int VMAX_set_task_template_name(EPM_action_message_t msg) {
int rcode = ITK_ok;
tag_t task = msg.task;
tag_t job_tag = NULLTAG;
tag_t root_task = NULLTAG;
int i = 0, j = 0;
string s = "";
//获取流程目标
ITKCALL(EPM_ask_job(msg.task, &job_tag));
ITKCALL(EPM_ask_root_task(job_tag, &root_task));

int n_childs = NULL;
tag_t* child_tasks = NULL;
ITKCALL(AOM_ask_value_tags(root_task, "child_tasks",&n_childs, &child_tasks));
char** task_template_names = NULL;
int n_task_template_names = NULL;
// 调用接口获取模板名称列表
ITKCALL(AOM_ask_displayable_values(root_task, "task_template", &n_task_template_names, &task_template_names));
char v9VmaxTemplateName[256] = { 0 };
// 安全校验:有名称 + 首名称非空 + 长度安全
if (n_task_template_names > 0
&& task_template_names != NULL
&& task_template_names[0] != NULL
&& tc_strlen(task_template_names[0]) > 0
&& tc_strlen(task_template_names[0]) + 1 < sizeof(v9VmaxTemplateName))
{
// 安全拼接(比 strcat 更安全,防止溢出)
strncat(v9VmaxTemplateName, task_template_names[0], sizeof(v9VmaxTemplateName) - strlen(v9VmaxTemplateName) - 1);
}
GAOM_set_bypass(true);
if (strlen(v9VmaxTemplateName)>0) {
for (i = 0; i < n_childs;i++) {
ITKCALL(AOM_lock(child_tasks[i]));
ITKCALL(AOM_set_value_string(child_tasks[i], "v9VmaxTemplateName", v9VmaxTemplateName));
ITKCALL(AOM_save_without_extensions(child_tasks[i]));
ITKCALL(AOM_unlock(child_tasks[i]));
int n_sub_childs = NULL;
tag_t* sub_child_tasks = NULL;
ITKCALL(AOM_ask_value_tags(child_tasks[i], "child_tasks", &n_sub_childs, &sub_child_tasks));
for (j = 0; j < n_sub_childs;j++) {
ITKCALL(AOM_lock(sub_child_tasks[j]));
ITKCALL(AOM_set_value_string(sub_child_tasks[j], "v9VmaxTemplateName", v9VmaxTemplateName));
ITKCALL(AOM_save_without_extensions(sub_child_tasks[j]));
ITKCALL(AOM_unlock(sub_child_tasks[j]));
}
SAFE_SM_FREE(sub_child_tasks);
}
}
GAOM_set_bypass(false);
SAFE_SM_FREE(task_template_names);
SAFE_SM_FREE(child_tasks);
return rcode;
}