|
|
#include "epm_handler_common.h"
|
|
|
#include "jk_custom_erp.h"
|
|
|
#include <tc/tc.h>
|
|
|
#include <ict/ict_userservice.h>
|
|
|
#include <tccore/custom.h>
|
|
|
#include <epm/epm_toolkit_tc_utils.h>
|
|
|
#include <tccore/aom.h>
|
|
|
#include <tccore/aom_prop.h>
|
|
|
#include <tccore/item.h>
|
|
|
#include <bom/bom.h>
|
|
|
#include "ps/ps.h";
|
|
|
#include "ps/vrule.h"
|
|
|
#include "sstream"
|
|
|
#include <tccore/grm.h>
|
|
|
#include "epm/epm.h"
|
|
|
#include "sa/sa.h"
|
|
|
#include <map>
|
|
|
#include "epm/signoff.h"
|
|
|
#include <ctime>
|
|
|
#include <vector>
|
|
|
#include <locale>
|
|
|
#include <codecvt>
|
|
|
#include "ae/dataset.h"
|
|
|
#include <server_exits/user_server_exits.h>
|
|
|
#include <tccore/custom.h>
|
|
|
#include <epm/epm.h>
|
|
|
#include <epm/epm_toolkit_tc_utils.h>
|
|
|
#include <ict/ict_userservice.h>
|
|
|
#include <tccore/item.h>
|
|
|
#include <ae/ae.h>
|
|
|
#include <tc/folder.h>
|
|
|
#include <tccore/aom.h>
|
|
|
#include <sa/sa.h>
|
|
|
#include <tccore/aom_prop.h>
|
|
|
#include <property/prop_errors.h>
|
|
|
#include <tccore/workspaceobject.h>
|
|
|
#include <tc/preferences.h>
|
|
|
#include <tccore/imantype.h>
|
|
|
#include <tccore//grm.h>
|
|
|
#include <tccore/grmtype.h>
|
|
|
#include <sa/am.h>
|
|
|
#include <cfm/cfm.h>
|
|
|
#include <bom/bom.h>
|
|
|
#include <tccore/uom.h>
|
|
|
#include <ps/ps.h>
|
|
|
#include <epm/signoff.h>
|
|
|
#include <fclasses/tc_date.h>
|
|
|
#include <form/form.h>
|
|
|
#include <form/formtype.h>
|
|
|
#include <ics\ics.h>
|
|
|
#include <stdarg.h>
|
|
|
#include <iostream>
|
|
|
# include "common_itk_util.h"
|
|
|
using namespace std;
|
|
|
extern "C" int POM_AM__set_application_bypass(logical bypass);
|
|
|
int addDisabled(EPM_action_message_t msg)
|
|
|
{
|
|
|
int ifail=ITK_ok;
|
|
|
|
|
|
EPM_decision_t decision = EPM_go;
|
|
|
tag_t task_tag = NULLTAG, rootTask_tag = NULLTAG, *attachments = NULLTAG,*revision_list=NULLTAG;
|
|
|
int arg_cnt = 0, i = 0, att_cnt = 0,revtion_nums=0;
|
|
|
int release_nums=0;
|
|
|
tag_t *release_list=NULLTAG;
|
|
|
char* object_type;
|
|
|
tag_t release_stat = NULLTAG;
|
|
|
vector<tag_t> attatcgments;
|
|
|
string dateType="dis";
|
|
|
ITKCALL(ifail=RELSTAT_create_release_status("jk8Disabled", &release_stat));//TCM Released jk8Disabled
|
|
|
//获取当前触发的任务
|
|
|
task_tag = msg.task;
|
|
|
//获取根流程节点
|
|
|
ITKCALL(ifail = EPM_ask_root_task(task_tag, &rootTask_tag));
|
|
|
//获取目标引用对象
|
|
|
ITKCALL(ifail = EPM_ask_attachments(rootTask_tag, EPM_target_attachment, &att_cnt, &attachments));
|
|
|
//循环目标对象
|
|
|
cout<<"数量------->"<<att_cnt<<endl;
|
|
|
for (i = 0; i < att_cnt; i++)
|
|
|
{
|
|
|
//获得该物料下所有版本(版本revision_list)
|
|
|
ITKCALL(ifail=AOM_ask_value_string(attachments[i],"object_type",&object_type));
|
|
|
if(strcmp("JK8Material",object_type)==0)//LP2_Design_Part JK8Material
|
|
|
{
|
|
|
//TODO 给物料添加失效状态和失效时间
|
|
|
|
|
|
ITKCALL(ifail=RELSTAT_add_release_status(release_stat, 1, &attachments[i], true));
|
|
|
ITKCALL(ifail=AOM_ask_value_tags(attachments[i],"revision_list",&revtion_nums,&revision_list));
|
|
|
|
|
|
date_t current_date;
|
|
|
char create_date_str[32] = "\0";
|
|
|
current_time(¤t_date);
|
|
|
sprintf(create_date_str,"%04d-%02d-%02d",current_date.year,1+ current_date.month,current_date.day);
|
|
|
cout<<"create_date_str-------------------"<<create_date_str;
|
|
|
string ddd=create_date_str;
|
|
|
ITKCALL(ifail=AOM_ask_value_string(attachments[i],"object_string",&object_type));
|
|
|
cout<<"attachments[i]--------------"<<object_type;
|
|
|
POM_AM__set_application_bypass(true);
|
|
|
AOM_lock(attachments[i]);
|
|
|
ITKCALL(ifail=AOM_set_value_string(attachments[i],"jk8DisabledDate",ddd.c_str()));//jk8DisabledDate TCM Released
|
|
|
AOM_save(attachments[i]);
|
|
|
AOM_unlock(attachments[i]);
|
|
|
POM_AM__set_application_bypass(false);
|
|
|
for (int j=0;j<revtion_nums;j++)
|
|
|
{
|
|
|
//给每一个版本添加失效状态
|
|
|
POM_AM__set_application_bypass(true);
|
|
|
ITKCALL(ifail=RELSTAT_add_release_status(release_stat, 1, &revision_list[j], true));
|
|
|
POM_AM__set_application_bypass(false);
|
|
|
if(j==revtion_nums-1)
|
|
|
{
|
|
|
attatcgments.push_back(revision_list[j]);//把最新版本加到版本集合中
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
//TODO 把最新版本的属性信息发送到U8,附带失效时间
|
|
|
JK_send_material1(attatcgments,dateType);
|
|
|
|
|
|
|
|
|
return ifail;
|
|
|
} |