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.
JK_ITK/jf_itk/historicalDataAddMark.cpp

117 lines
3.0 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 "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 historicalDataAddMark(EPM_action_message_t msg)
{
int ifail=ITK_ok;
tag_t task_tag = NULLTAG, rootTask_tag = NULLTAG, *attachments = NULLTAG;
int arg_cnt = 0, att_cnt = 0;
char* object_type ;
char * argflag = NULL ,
*argvalue =NULL ,
*arg = NULL ,
statusMark[1024]="\0";
tag_t release_stat = NULLTAG;
vector<tag_t> attatcgments;
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);
//获取参数的名称和值
ifail = ITK_ask_argument_named_value((const char*)arg, &argflag, &argvalue);
//给状态标记设置真实值
if(stricmp(argflag, "addStatus_mark") == 0)
{
if(argvalue != NULL)
{
strcpy(statusMark,argvalue);
}
}
}
MEM_free(argflag);
MEM_free(argvalue);
}
ITKCALL(ifail=RELSTAT_create_release_status(statusMark, &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 (int 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)
{
//TODO 给物料添加状态
POM_AM__set_application_bypass(true);
ITKCALL(ifail=RELSTAT_add_release_status(release_stat, 1, &attachments[i], true));
POM_AM__set_application_bypass(false);
}
}
return ifail;
}