#pragma warning (disable: 4996) 
#pragma warning (disable: 4819) 
/**
* @headerfile			tcua 头文件
*/

#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 <ics/ics.h>
#include <ics/ics2.h>
#include "common_itk_util.h"

/**
* @headerfile			standard c & cpp header files
*/
#include <stdio.h>
#include <ctype.h>
#include <string.h>
//#include <time.h>
//#include <math.h>
#include <string>
#include <vector>
#include <map>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <time.h>

/**
* @headerfile			user's header files
*/
#include "epm_handler_common.h"
#include "error_handling.h"
#include "common_itk_util.h"
#include "string_helper.h"


using namespace std;
typedef struct 
{
	string name;
	string value;
}CAD_ATTR_STRUCT;
extern "C" int POM_AM__set_application_bypass(logical bypass);



int USERSEVICE_TEST(void * returnValue){
	int ifail = ITK_ok;
	tag_t item;
	
	USERARG_get_tag_argument(&item);
	

	return ITK_ok;
}

int connor_set_release_status(void * returnValue){
	int ifail = ITK_ok;
	tag_t item = NULL_TAG,release_status =NULL_TAG;
	char * release_name = NULL;
	tag_t * release_objs = NULL;
	
	USERARG_get_tag_argument(&item);
	USERARG_get_string_argument(&release_name);

	int temp_count = 1;
	release_objs = (tag_t *)MEM_alloc(temp_count*sizeof(tag_t));
	release_objs[0] = item;

	ITKCALL(ifail = CR_create_release_status(release_name,&release_status));
	ITKCALL(ifail = EPM_add_release_status(release_status,temp_count,release_objs,TRUE));
	
	if(release_name !=NULL){
		MEM_free(release_name);
	}

	return ITK_ok;
}


int ORIGIN_set_bypass(void *returnValue)
{
	
	POM_AM__set_application_bypass(true);
	return  0;
}

int remove_class(void *returnValue)
{
	char * icouid = NULL;
	tag_t icotag = NULLTAG;
	USERARG_get_string_argument(&icouid);
	ITK__convert_uid_to_tag(icouid,&icotag);
	if(icotag!=NULLTAG){
		POM_AM__set_application_bypass(true);
		ITKCALL(ICS_ico_remove(icotag));
		POM_AM__set_application_bypass(false);
	}
	return  0;
}




int ORIGIN_close_bypass(void *returnValue)
{
	POM_AM__set_application_bypass(false);
	return  0;
}

int getDbMsg(void *returnValue)
{
		char * tc_root_dir = getenv("tc_root");
		
		char name[32] = "-u=admin";
		char pwd[32] = "-p=admin";
		char output_file[SS_MAXPATHLEN] = "";
		char jar_file[SS_MAXPATHLEN] = "";
		
		//-----------------------------
		strcpy(jar_file, tc_root_dir);
		strcat(jar_file, "\\bin\\");
		strcat(jar_file, "HX_ProjectDashboard.exe");

		
		//ITKCALL(IMF_export_file(ref_object, temp_file2));
		int   iCnt;
		char *user_lib_env,pTempStr[500];
		char local_path[MAX_PATH] = "";
		char cmd[256] = "";
		//strcpy( cmd, user_lib_env );
		strcpy( cmd, "\"" );
		strcat( cmd, jar_file ); 
		strcat( cmd, "\" \"" ); 
		
		strcat( cmd, name ); 
		strcat( cmd, "\" \"" );
		strcat( cmd, pwd ); 
		
		strcat( cmd, "\"" );
		printf( "\n%s\n",cmd );
		//system( cmd );
		WinExec(cmd,SW_HIDE);

	return  0;
}

//导出数据集文件 
static int export_dataset_file(tag_t dataset,char *ref_name, char *ext, char **filename, char **original_name)
{
	int ifail = ITK_ok;
	tag_t ref_object = NULLTAG,
		datasettype = NULLTAG,
		new_ds = NULLTAG,
		tool = NULLTAG,
		folder_tag = NULLTAG,
		spec_dataset_rev = NULLTAG;
	AE_reference_type_t reference_type;
	tag_t new_file_tag = NULLTAG;
	IMF_file_t file_descriptor;		
	char new_ds_name[WSO_name_size_c + 1] = "";
	char *new_file_name;

	*filename = (char *)MEM_alloc(sizeof(char)*512);
	*original_name = (char *)MEM_alloc(sizeof(char)*512);
	strcpy(*filename, "");
	AE_ask_dataset_latest_rev(dataset, &spec_dataset_rev);
	AE_ask_dataset_named_ref(dataset, ref_name, &reference_type, &ref_object);
	if(ref_object==NULLTAG)
	{
		ECHO("ref_object is NULLTAG\n");
		return 1;
	}
	//WriteLog("\reference_type=%d\n",reference_type);
	if(reference_type == AE_PART_OF)
	{
		char pathname[SS_MAXPATHLEN] = "";
		IMF_ask_file_pathname(ref_object, SS_WNT_MACHINE, pathname);
		char origin_file_name[IMF_filename_size_c + 1] = "";
		IMF_ask_original_file_name(ref_object, origin_file_name);
		strcpy(*original_name, origin_file_name);
		char new_ds_name[WSO_name_size_c + 1] = "";
		char *new_file_name = USER_new_file_name(new_ds_name, ref_name, ext, 0);
		char *temp_dir = getenv("TEMP");
		char temp_file[SS_MAXPATHLEN] = "";
		strcpy(temp_file, temp_dir);
		strcat(temp_file, "\\");
		strcat(temp_file, new_file_name);
		ECHO("temp_file=%s\n",temp_file);

		IMF_export_file(ref_object, temp_file);	
		strcpy(*filename, temp_file);
	}
	return ITK_ok;
}

//导入数据集
static int import_dataset_file(tag_t dataset, char *ref_name, char *ext, char *fullfilename, char *original_name)
{
	int ifail = ITK_ok;
	tag_t new_file_tag = NULLTAG;
	IMF_file_t file_descriptor = NULL;
	 AOM_refresh( dataset, FALSE );
	char *new_file_name = NULL;
	char new_ds_name[WSO_name_size_c + 1] = "";
	char *filename = NULL;
	new_file_name = USER_new_file_name( new_ds_name, ref_name, ext, 0 );


	filename = strrchr(fullfilename,'\\') + 1;
	if (filename == NULL)
		return ITK_ok;
	ECHO("IMF_import_file\n");
	set_bypass(true);
	IMF_import_file(fullfilename, new_file_name, SS_BINARY,&new_file_tag, &file_descriptor);
	ECHO("IMF_set_original_file_name\n");
	IMF_set_original_file_name(new_file_tag, original_name);

	IMF_close_file( file_descriptor  );
	AOM_save( new_file_tag );
	AOM_unlock( new_file_tag ) ;
	AOM_refresh( new_file_tag, FALSE ) ;

	//添加至命名引用
	set_bypass(true);
	ITKCALL( AOM_lock( dataset ) );
	ECHO("AE_remove_dataset_named_ref\n");
	AE_remove_dataset_named_ref(dataset,ref_name);
	AOM_save(dataset);
	
	ECHO("AE_add_dataset_named_ref\n");
	set_bypass(true);
	AE_add_dataset_named_ref( dataset, ref_name, AE_PART_OF, new_file_tag  );
	
	AOM_save( dataset ) ;
	AOM_unlock( dataset ) ;
	//ITKCALL( AOM_refresh( dataset, FALSE ) );
	return ifail;
}
int create_signinfo_file(char *file_content,char *item_id, char **file_name)
{
	time_t now;
	struct tm *p;
	FILE *filePtr = NULL;

	char *temp_dir = getenv("TEMP");
	char local_path[MAX_PATH] = "";

	time(&now);
	p = localtime(&now);
	if(temp_dir[strlen(temp_dir) - 1] == '\\')
	{
		sprintf_s(local_path, "%s%s-%d-%d-%d-%d-%d-%d.dat", temp_dir,item_id,
			1900+p->tm_year,p->tm_mon+1 ,p->tm_mday+1 ,p->tm_hour,p->tm_min ,p->tm_sec);
	}
	else
	{
		sprintf_s(local_path, "%s\\%s-%d-%d-%d-%d-%d-%d.dat", temp_dir,item_id,
			1900+p->tm_year,p->tm_mon+1 ,p->tm_mday+1 ,p->tm_hour,p->tm_min ,p->tm_sec);
	}

	if((filePtr = fopen(local_path, "wt")) == NULL)
	{
		printf("Can not create the temp dat file!\n");
		return -1;
	}
	*file_name = (char *)MEM_alloc(sizeof(char)*512);
	strcpy((*file_name), local_path);

	fwrite(file_content, sizeof(char), strlen(file_content), filePtr);
	fclose(filePtr);

	return ITK_ok;
}

int signoff_acad(tag_t dataset, char *dat_file)
{



	tag_t spec_dataset_rev = NULLTAG,
		ref_object = NULLTAG;

	AE_reference_type_t reference_type;
		
	AE_ask_dataset_latest_rev(dataset, &spec_dataset_rev);

	char ref_name[WSO_name_size_c + 1] = "JK8_dwg";
	
	AE_ask_dataset_named_ref(spec_dataset_rev, ref_name, &reference_type, &ref_object);
	if(ref_object==NULLTAG)
	{
		printf("\nref_object is NULLTAG\n");
		return ITK_ok;
	}
	printf("\reference_type=%d\n",reference_type);
	if(reference_type == AE_PART_OF)
	{
		char pathname[SS_MAXPATHLEN] = "";
		printf("\n3333333\n");
		IMF_ask_file_pathname(ref_object, SS_WNT_MACHINE, pathname);
		char origin_file_name[IMF_filename_size_c + 1] = "";
		IMF_ask_original_file_name(ref_object, origin_file_name);

		char new_ds_name[WSO_name_size_c + 1] = "";
		char *new_file_name = USER_new_file_name(new_ds_name, ref_name, "dwg", 0);
		char *temp_dir = getenv("TEMP");
		char temp_file[SS_MAXPATHLEN] = "";
		strcpy(temp_file, temp_dir);
		strcat(temp_file, "\\");
		strcat(temp_file, new_file_name);
		printf("\ntemp_file=%s\n",temp_file);

		IMF_export_file(ref_object, temp_file);
		printf("\n555555555\n");

		int   iCnt;
		char *user_lib_env,pTempStr[500];
		char local_path[MAX_PATH] = "";
		char cmd[256] = "";
		//user_lib_env = getenv("TC_USER_LIB"); 
		//strcpy(local_path, user_lib_env);

		//iCnt = strlen(user_lib_env);
		//while( user_lib_env[iCnt] != '\\' )
		//{
		//	iCnt--;
		//}

		//strcpy(pTempStr,"");
		//strcpy(pTempStr,&user_lib_env[iCnt+1]);

		//if( strcmp(pTempStr,"acad_signoff.exe") != 0 )
		//{
		//	strcat( user_lib_env, "\\acad_signoff.exe" ); 
		//}

		//strcpy( cmd, user_lib_env );
		//strcat( user_lib_env, "\\acad_signoff.exe" ); 
		strcpy( cmd, "acad_signoff.exe" );
		strcat( cmd, "   \"" ); 
		strcat( cmd, temp_file ); 
		strcat( cmd, "\"   \"" );
		strcat( cmd, dat_file ); 
		strcat( cmd, "\"" );
		printf( "\n%s\n",cmd );
		system( cmd );

		//strcpy(user_lib_env, local_path);


		tag_t new_file_tag = NULLTAG;
		IMF_file_t file_descriptor;	
		IMF_import_file(temp_file, new_file_name, SS_BINARY, &new_file_tag, &file_descriptor);
		IMF_set_original_file_name(new_file_tag, origin_file_name);
		IMF_close_file(file_descriptor);
		AOM_save(new_file_tag);
		AOM_unlock(new_file_tag);

		AOM_lock(spec_dataset_rev);
		//CALL(AOM_load (spec_dataset_rev));
		AE_remove_dataset_named_ref_by_tag(spec_dataset_rev, ref_name, ref_object);
		AE_insert_dataset_named_ref2(spec_dataset_rev,0, ref_name, AE_PART_OF, new_file_tag);//第一个位置插入新命名引用
		//AE_add_dataset_named_ref(spec_dataset_rev, ref_name, AE_PART_OF, new_file_tag);
		AOM_save(spec_dataset_rev);
		AOM_unlock(spec_dataset_rev);
	}

	return ITK_ok;
}

int signoff_msword(tag_t dataset, char *dat_file,char *ext)
{
	tag_t spec_dataset_rev = NULLTAG , ref_object = NULLTAG;
	AE_reference_type_t reference_type;
	//printf("\n111111111111\n");
	AE_ask_dataset_latest_rev(dataset, &spec_dataset_rev);

	char ref_name[WSO_name_size_c + 1] = "Fnd0word";
	//printf("\n22222222222\n");
	AE_ask_dataset_named_ref(spec_dataset_rev, ref_name, &reference_type, &ref_object);
	if(reference_type == AE_PART_OF)
	{
		//printf("\n3333333333333\n");
		char pathname[SS_MAXPATHLEN] = "";
		IMF_ask_file_pathname(ref_object, SS_WNT_MACHINE, pathname);
		char origin_file_name[IMF_filename_size_c + 1] = "";
		IMF_ask_original_file_name(ref_object, origin_file_name);
		//printf("\n44444444444444\n");
		char new_ds_name[WSO_name_size_c + 1] = "";
		char *new_file_name = USER_new_file_name(new_ds_name, ref_name, ext, 0);
		char *temp_dir = getenv("temp");
		temp_dir="E:\\TEMP";
		//printf("\n555555555555\n");
		char temp_file[SS_MAXPATHLEN] = "";
		strcpy(temp_file, temp_dir);
		strcat(temp_file, "\\");
		strcat(temp_file, new_file_name);

		IMF_export_file(ref_object, temp_file);
		//printf("\n66666666666666\n");

		int   iCnt;
		char *user_lib_env,pTempStr[500];
		char local_path[MAX_PATH] = "";
		char cmd[256] = "";
		//user_lib_env = getenv("TC_USER_LIB"); 
		//strcpy(local_path, user_lib_env);

		//iCnt = strlen(user_lib_env);
		//while( user_lib_env[iCnt] != '\\' )
		//{
		//	iCnt--;
		//}

		//strcpy(pTempStr,"");
		//strcpy(pTempStr,&user_lib_env[iCnt+1]);

		//if( strcmp(pTempStr,"SubstMacros-MSWord.wsf") != 0 )
		//{
		//	strcat( user_lib_env, "\\SubstMacros-MSWord.wsf" ); 
		//}

		//strcpy( cmd, user_lib_env );
		strcpy( cmd, "SubstMacros-MSWord.wsf" );
		strcat( cmd, " \"" ); 
		strcat( cmd, temp_file ); 
		strcat( cmd, "\" \"" );
		strcat( cmd, dat_file ); 
		strcat( cmd, "\"" );
		printf( "\n%s\n",cmd );
		system( cmd );
//printf("\n777777777777\n");
		//strcpy(user_lib_env, local_path);


		tag_t new_file_tag = NULLTAG;
		IMF_file_t file_descriptor;	
		IMF_import_file(temp_file, new_file_name, SS_BINARY, &new_file_tag, &file_descriptor);
		IMF_set_original_file_name(new_file_tag, origin_file_name);
		IMF_close_file(file_descriptor);
		AOM_save(new_file_tag);
		AOM_unlock(new_file_tag);

		AOM_lock(spec_dataset_rev);
		
		AE_remove_dataset_named_ref_by_tag(spec_dataset_rev, ref_name, ref_object);
		
		AE_add_dataset_named_ref(spec_dataset_rev, ref_name, AE_PART_OF, new_file_tag);
		AOM_save(spec_dataset_rev);
		AOM_unlock(spec_dataset_rev);
	}
	return ITK_ok;
}

int signoff_pdf(tag_t dataset, char *dat_file,char *ext)
{
	tag_t spec_dataset_rev = NULLTAG,
		ref_object = NULLTAG;

	AE_reference_type_t reference_type;
printf("\n111111111111\n");
	AE_ask_dataset_latest_rev(dataset, &spec_dataset_rev);

	char ref_name[WSO_name_size_c + 1] = "PDF_Reference";
	printf("\n22222222222\n");
	AE_ask_dataset_named_ref(spec_dataset_rev, ref_name, &reference_type, &ref_object);
	if(reference_type == AE_PART_OF)
	{
		printf("\n3333333333333\n");
		char pathname[SS_MAXPATHLEN] = "";
		IMF_ask_file_pathname(ref_object, SS_WNT_MACHINE, pathname);
		char origin_file_name[IMF_filename_size_c + 1] = "";
		IMF_ask_original_file_name(ref_object, origin_file_name);
		printf("\n44444444444444\n");
		char new_ds_name[WSO_name_size_c + 1] = "";
		char *new_file_name = USER_new_file_name(new_ds_name, ref_name, ext, 0);
		char *temp_dir = getenv("temp");
		temp_dir="E:\\TEMP";
		printf("\n555555555555\n");
		char temp_file[SS_MAXPATHLEN] = "";
		char temp_file2[SS_MAXPATHLEN] = "";
		strcpy(temp_file, temp_dir);
		strcat(temp_file, "\\");
		strcat(temp_file, new_file_name);

		IMF_export_file(ref_object, temp_file);
		sprintf(temp_file2,"%s.pdf",temp_file);
		//printf("\n66666666666666\n");

		int   iCnt;
		char *user_lib_env,pTempStr[500];
		char local_path[MAX_PATH] = "";
		char cmd[256] = "";
		char * tc_root_dir = getenv("tc_root");
		//user_lib_env = getenv("TC_USER_LIB"); 
		//strcpy(local_path, user_lib_env);

		//iCnt = strlen(user_lib_env);
		//while( user_lib_env[iCnt] != '\\' )
		//{
		//	iCnt--;
		//}

		//strcpy(pTempStr,"");
		//strcpy(pTempStr,&user_lib_env[iCnt+1]);

		//if( strcmp(pTempStr,"SubstMacros-MSWord.wsf") != 0 )
		//{
		//	strcat( user_lib_env, "\\SubstMacros-MSWord.wsf" ); 
		//}
		strcpy( cmd, "java -jar " );
		strcat( cmd, tc_root_dir );
		strcat( cmd, "\\bin\\JK_PDFSignoff.jar" );
		strcat( cmd, " \"" ); 
		strcat( cmd,  dat_file); 
		strcat( cmd, "\" \"" );
		strcat( cmd,  temp_file); 
		strcat( cmd, "\" \"" );
		strcat( cmd,  temp_file2);
		strcat( cmd, "\"" );
		printf( "\n%s\n",cmd );
		system( cmd );
//printf("\n777777777777\n");
		//strcpy(user_lib_env, local_path);


		tag_t new_file_tag = NULLTAG;
		IMF_file_t file_descriptor;	
		IMF_import_file(temp_file2, new_file_name, SS_BINARY, &new_file_tag, &file_descriptor);
		IMF_set_original_file_name(new_file_tag, origin_file_name);
		IMF_close_file(file_descriptor);
		AOM_save(new_file_tag);
		AOM_unlock(new_file_tag);

		AOM_lock(spec_dataset_rev);
		
		AE_remove_dataset_named_ref_by_tag(spec_dataset_rev, ref_name, ref_object);
		
		AE_add_dataset_named_ref(spec_dataset_rev, ref_name, AE_PART_OF, new_file_tag);
		AOM_save(spec_dataset_rev);
		AOM_unlock(spec_dataset_rev);
	}

	return ITK_ok;
}


int signoff_msexcel(tag_t dataset, char *dat_file, char *ext)
{
	tag_t spec_dataset_rev = NULLTAG,
		ref_object = NULLTAG;

	AE_reference_type_t reference_type;

	AE_ask_dataset_latest_rev(dataset, &spec_dataset_rev);

	char ref_name[WSO_name_size_c + 1] = "excel";
	AE_ask_dataset_named_ref(spec_dataset_rev, ref_name, &reference_type, &ref_object);
	if(reference_type == AE_PART_OF)
	{
		char pathname[SS_MAXPATHLEN] = "";
		IMF_ask_file_pathname(ref_object, SS_WNT_MACHINE, pathname);
		char origin_file_name[IMF_filename_size_c + 1] = "";
		IMF_ask_original_file_name(ref_object, origin_file_name);

		char new_ds_name[WSO_name_size_c + 1] = "";
		char *new_file_name = USER_new_file_name(new_ds_name, ref_name, ext, 0);
		char *temp_dir = getenv("temp");
		temp_dir="E:\\TEMP";
		char temp_file[SS_MAXPATHLEN] = "";
		strcpy(temp_file, temp_dir);
		strcat(temp_file, "\\");
		strcat(temp_file, new_file_name);

		IMF_export_file(ref_object, temp_file);


		int   iCnt;
		char *user_lib_env,pTempStr[500];
		char local_path[MAX_PATH] = "";
		char cmd[256] = "";
		/*user_lib_env = getenv("TC_USER_LIB"); 
		strcpy(local_path, user_lib_env);

		iCnt = strlen(user_lib_env);
		while( user_lib_env[iCnt] != '\\' )
		{
			iCnt--;
		}
		strcpy(pTempStr,"");
		strcpy(pTempStr,&user_lib_env[iCnt+1]);

		if( strcmp(pTempStr,"SubstMacros-MSExcel.wsf") != 0 )
		{
			strcat( user_lib_env, "\\SubstMacros-MSExcel.wsf" ); 
		}*/
		//strcpy( cmd, user_lib_env );
		strcpy( cmd, "SubstMacros-MSExcel.wsf" );
		strcat( cmd, " \"" ); 
		strcat( cmd, temp_file ); 
		strcat( cmd, "\" \"" );
		strcat( cmd, dat_file ); 
		strcat( cmd, "\"" );
		printf( "\n%s\n",cmd );
		system( cmd );

		//strcpy(user_lib_env, local_path);


		tag_t new_file_tag = NULLTAG;
		IMF_file_t file_descriptor;	
		IMF_import_file(temp_file, new_file_name, SS_BINARY, &new_file_tag, &file_descriptor);
		IMF_set_original_file_name(new_file_tag, origin_file_name);
		IMF_close_file(file_descriptor);
		AOM_save(new_file_tag);
		AOM_unlock(new_file_tag);

		AOM_lock(spec_dataset_rev);
		//CALL(AOM_load (dataset));
		//CALL(AOM_load(spec_dataset_rev));
		AE_remove_dataset_named_ref_by_tag(spec_dataset_rev, ref_name, ref_object);
		AE_add_dataset_named_ref(spec_dataset_rev, ref_name, AE_PART_OF, new_file_tag);
		AOM_save(spec_dataset_rev);
		AOM_unlock(spec_dataset_rev);
	}

	return ITK_ok;
}
/*************************************************************************************************
* jf_signoff_dataset()
*
* Description:
*    This handler will set signoff infomation to properties of form
*
* Syntax:
*         jf-signoff-dataset 
*			[-debug=true|false]
*
*		  -SignName: jf3bianzhi=设计;jf3drawing=绘图;jf3review=审核;jf3reviewdate=审核日期
*              
*         
*		  -bypass
* Placement:
*    no request
*
**************************************************************************************************/
int jf_signoff_dataset( EPM_action_message_t msg )
{
	int ifail = ITK_ok, rcode = 0;
	//参数相关
	char arg1value[1024] = "",arg2value[1024] = "",arg3value[1024]="",arg4value[1024]="",
		signcounter_info[1024] = "", *value = NULL;
	char *argflag =NULL,*argvalue=NULL ,*arg = NULL;
	BOOL bypass = FALSE;
	int arg_cnt = 0;
	//流程节点相关
	tag_t root_task = NULLTAG,*sub_tasks = NULL,current_task = NULLTAG,type_tag = NULLTAG;
	int sub_task_count = 0;
	char root_task_name[128]="",task_name[128] = "";
	int occur_of_counts = 0;
	tag_t *taskAttches = NULLTAG;
	char tgt_type[WSO_name_size_c+1]="",type_class[TCTYPE_class_name_size_c+1]="";
	////循环内部变量
	tag_t cur_task = NULLTAG;
	char task_type[WSO_name_size_c+1] = "";
	//循环变量
	int i=0, j=0, k=0, count = 0, n = 0;
	//节点信息变量
	char sign_info[2048]="";
	//节点循环处理变量
	tag_t itemrevision = NULLTAG,master_form_rel_type = NULLTAG;
	char rev_id[ITEM_id_size_c+1]="";
	char item_id[ITEM_id_size_c+1]="";
	int form_count = 0;
	tag_t *form_list = NULL,master_form = NULLTAG;
	char local_path[128]="";
	//编制节点
	int s=0;
	char *timeinfo2="";
	EPM_decision_t decision = EPM_nogo;
	tag_t aUserTag,responsibleParty;
	char *userName;
	date_t decision_date;
	char person_name[SA_name_size_c + 1] = "";
	char *prop_name="last_mod_date";
	//会签相关
	int n_prop=0, q = 0;
	char **prop_names=NULL, hq_name[128] = "", hq_time_name[128] = "", *hq_value=NULL;
	char exclude_type[256]="", item_type[ITEM_type_size_c+ 1]= "";
	tag_t item = NULLTAG;
	logical is_sign = false;

	map<string,CAD_ATTR_STRUCT> sign_map;
	vector<string> prop_vec;
	current_task = msg.task;
	//CreateLogFile("PLA8_signoff",&txtfile);
	ECHO("=========================================================\n");
	ECHO("jf_signoff_dataset 开始执行\n");
	ECHO("=========================================================\n");
	
	arg_cnt = TC_number_of_arguments(msg.arguments);
	ECHO("参数个数为：%d\n",arg_cnt);
	POM_AM__set_application_bypass(true);
	if (arg_cnt > 0)
	{
		for (i=0;i<arg_cnt;i++)
		{
			arg = TC_next_argument(msg.arguments);
			ifail = ITK_ask_argument_named_value((const char*)arg, &argflag, &argvalue);
			if (stricmp(argflag, "SignName") == 0)
			{
				if(argvalue != NULL)
				{
					//strcpy(arg1value,argvalue);
					vector<string> ans,ans1;
					Split(argvalue,";",ans);
					for( j = 0; j <ans.size(); j++ )
					{
						CAD_ATTR_STRUCT	one_elem;
						Split(ans[j],"=",ans1);
						if( ans1.size() > 1 )
						{
							one_elem.name = ans1[1];
							sign_map.insert(pair<string,CAD_ATTR_STRUCT>(ans1[0],one_elem));
						}
					}
				}
			}
			else if(stricmp(argflag,"bypass") == 0)
			{
				bypass = TRUE;
			}
			//else if(stricmp(argflag,"exclude_type") == 0)
			//{
			//	if(argvalue != NULL)
			//	{
			//		strcpy(exclude_type,argvalue);
			//	}
			//} 

		}
		MEM_free(argflag);
		MEM_free(argvalue);
	}

	//获取属性
	 EPM_ask_root_task( msg.task, &root_task );
	 EPM_ask_sub_tasks( root_task, &sub_task_count, &sub_tasks); 
	EPM_ask_attachments(root_task, EPM_target_attachment, &occur_of_counts, &taskAttches);
	ECHO("%d target attachment found",occur_of_counts);
		
	for( count=0; count<occur_of_counts; count++ )
	{
		ECHO("the %dth work",count);
		TCTYPE_ask_object_type(taskAttches[count], &type_tag);
		ifail = TCTYPE_ask_class_name(type_tag, type_class);
		ECHO("type_class : %s",type_class);
			
		//过滤掉非版本对象
		if (((strstr(type_class,"Revision") != NULL) || (strstr(type_class,"revision") != NULL))
			&&(strstr(type_class,"Master") == NULL) &&(strstr(type_class,"master") == NULL)
			&& (strstr(type_class,"BOM") ==NULL) && (strstr(type_class,"bom") ==NULL) && (strstr(type_class,"Bom") == NULL))	
		{
			itemrevision = taskAttches[count];
			ITEM_ask_rev_id(itemrevision,rev_id);
			ITEM_ask_item_of_rev( itemrevision, &item);
			ITEM_ask_id(item, item_id);
			GRM_find_relation_type( TC_master_form_rtype, &master_form_rel_type  );
			GRM_list_secondary_objects_only(itemrevision, master_form_rel_type, &form_count, &form_list );
			if( form_count ==0 )
			{
				ECHO("未找到签名form,继续...");
				continue;
			}
			master_form = itemrevision;// form_list[0]; 
			map<string,CAD_ATTR_STRUCT>::iterator it;
			for( it = sign_map.begin(); it != sign_map.end(); it ++ )
			{
				CAD_ATTR_STRUCT one_elem;
				AOM_ask_value_string( master_form, it->first.c_str(), &value);
				one_elem.name = it->second.name;
				one_elem.value.assign(value);
				it->second = one_elem;
			}
			DOFREE(form_list);
			//将form属性写入文本文件
			string info;
			map<string,CAD_ATTR_STRUCT>::iterator buf_it;
			for( it = sign_map.begin(); it != sign_map.end(); it ++ )
			{
				info.append(it->second.name);
				info.append("=");
				info.append(it->second.value);
				info.append("|");
			}
			ECHO("\n info: %s",info.c_str());
			char *data_file = NULL;
			create_signinfo_file((char*)info.c_str(),item_id, &data_file);
			if( data_file == NULL )
			{

				continue;
			}
			ECHO("\n 创建文本文件%s\n",data_file);
			//获得数据集
			tag_t relation_type=NULLTAG;
			//tag_t attach_relation_type = NULLTAG;
			GRM_find_relation_type(TC_specification_rtype, &relation_type);
			tag_t *secondary_objects=NULLTAG;
			int ds_count = 0;
			char *dataset_type = NULL, *desc_value=NULL,*file_path = NULL,*desc_path;
			
			GRM_list_secondary_objects_only(itemrevision, relation_type, &ds_count, &secondary_objects);
			for (int j = 0; j < ds_count; j++)
			{
				printf("进1\n");
				AOM_ask_value_string(secondary_objects[j], "object_type", &dataset_type);
				int des_count=0;
				tag_t *dess=NULL;
				char  *name;
				if(!(strcmp(dataset_type, "JK8_AutoCAD") == 0||
					strcmp(dataset_type, "MSWord") ==0||
					strcmp(dataset_type, "MSWordX") ==0||
					strcmp(dataset_type, "MSExcel") ==0||
					strcmp(dataset_type, "MSExcelX") ==0||
					strcmp(dataset_type, "PDF") ==0)){
						if(dataset_type!=NULL){
							MEM_free(dataset_type);
							dataset_type =NULL;
						}
				
					continue;
				}




				AOM_ask_value_tags(secondary_objects[j], "ref_list", &des_count,&dess);
				if(des_count<1){
					printf("该数据集引用数量错误\n");
					continue;
				}
				
				printf("开始判断类型\n");
				if(strcmp(dataset_type, "JK8_AutoCAD") == 0) 
				{
					printf("cad类型\n");
				//	ECHO("导出dwg...\n");
				//	POM_AM__set_application_bypass(true);
				//	ifail = export_dataset_file(dataset_list[j], "PDF_Reference", "dwg", &filename,&original_name);
					if( data_file != NULL )
					signoff_acad(secondary_objects[j],data_file);
				}
				else if(strcmp(dataset_type, "MSWord") ==0 )
				{
					AOM_ask_value_string(dess[0], "original_file_name", &name);
					printf("name=%s\n",name);
					if ((strstr(name,"docx") != NULL)||(strstr(name,"xlsx") != NULL)){
						printf("后缀为docx或xlsx退出\n");
						continue;
					}
					signoff_msword(secondary_objects[j],data_file,"doc");
				}
				else if(strcmp(dataset_type, "MSWordX") ==0)
				{
					AOM_ask_value_string(dess[0], "original_file_name", &name);
					printf("name=%s\n",name);
					if ((strstr(name,"docx") != NULL)||(strstr(name,"xlsx") != NULL)){
						printf("后缀为docx或xlsx退出\n");
						continue;
					}
					signoff_msword(secondary_objects[j],data_file,"docm");
				}
				else if(strcmp(dataset_type, "MSExcel") ==0 )
				{
					AOM_ask_value_string(dess[0], "original_file_name", &name);
					printf("name=%s\n",name);
					if ((strstr(name,"docx") != NULL)||(strstr(name,"xlsx") != NULL)){
						printf("后缀为docx或xlsx退出\n");
						continue;
					}
					signoff_msexcel(secondary_objects[j],data_file,"xls");
				}
				else if(strcmp(dataset_type, "MSExcelX") ==0)
				{
					AOM_ask_value_string(dess[0], "original_file_name", &name);
					printf("name=%s\n",name);
					if ((strstr(name,"docx") != NULL)||(strstr(name,"xlsx") != NULL)){
						printf("后缀为docx或xlsx退出\n");
						continue;
					}
					signoff_msexcel(secondary_objects[j],data_file,"xlsm");
				}else if(strcmp(dataset_type, "PDF") ==0){
					signoff_pdf(secondary_objects[j],data_file,"pdf");
				}
				MEM_free(dataset_type);

			}
			DOFREE(secondary_objects);

			GRM_find_relation_type(TC_attaches_rtype, &relation_type);

			GRM_list_secondary_objects_only(itemrevision, relation_type, &ds_count, &secondary_objects);
			for (int j = 0; j < ds_count; j++)
			{
				printf("进2\n");
				AOM_ask_value_string(secondary_objects[j], "object_type", &dataset_type);
				int des_count=0;
				tag_t *dess=NULL;
				char  *name;

				if(!(strcmp(dataset_type, "JK8_AutoCAD") == 0||
					strcmp(dataset_type, "MSWord") ==0||
					strcmp(dataset_type, "MSWordX") ==0||
					strcmp(dataset_type, "MSExcel") ==0||
					strcmp(dataset_type, "MSExcelX") ==0||
					strcmp(dataset_type, "PDF") ==0)){
						if(dataset_type!=NULL){
							MEM_free(dataset_type);
							dataset_type =NULL;
						}
				
					continue;
				}
				AOM_ask_value_tags(secondary_objects[j], "ref_list", &des_count,&dess);
				if(des_count<1){
					printf("该数据集引用数量错误\n");
					continue;
				}
				
				if(strcmp(dataset_type, "JK8_AutoCAD") == 0) 
				{
				//	ECHO("导出dwg...\n");
				//	POM_AM__set_application_bypass(true);
				//	ifail = export_dataset_file(dataset_list[j], "PDF_Reference", "dwg", &filename,&original_name);
					if( data_file != NULL )
					signoff_acad(secondary_objects[j],data_file);
				}
				else if(strcmp(dataset_type, "MSWord") ==0 )
				{
					AOM_ask_value_string(dess[0], "original_file_name", &name);
					printf("name=%s\n",name);
					if ((strstr(name,"docx") != NULL)||(strstr(name,"xlsx") != NULL)){
						printf("后缀为docx或xlsx退出\n");
						continue;
					}
					signoff_msword(secondary_objects[j],data_file,"doc");
				}
				else if(strcmp(dataset_type, "MSWordX") ==0)
				{
					AOM_ask_value_string(dess[0], "original_file_name", &name);
					printf("name=%s\n",name);
					if ((strstr(name,"docx") != NULL)||(strstr(name,"xlsx") != NULL)){
						printf("后缀为docx或xlsx退出\n");
						continue;
					}
					signoff_msword(secondary_objects[j],data_file,"docx");
				}
				else if(strcmp(dataset_type, "MSExcel") ==0 )
				{
					AOM_ask_value_string(dess[0], "original_file_name", &name);
					printf("name=%s\n",name);
					if ((strstr(name,"docx") != NULL)||(strstr(name,"xlsx") != NULL)){
						printf("后缀为docx或xlsx退出\n");
						continue;
					}
					signoff_msexcel(secondary_objects[j],data_file,"xls");
				}
				else if(strcmp(dataset_type, "MSExcelX") ==0)
				{
					AOM_ask_value_string(dess[0], "original_file_name", &name);
					printf("name=%s\n",name);
					if ((strstr(name,"docx") != NULL)||(strstr(name,"xlsx") != NULL)){
						printf("后缀为docx或xlsx退出\n");
						continue;
					}
					signoff_msexcel(secondary_objects[j],data_file,"xlsx");
				}else if(strcmp(dataset_type, "PDF") ==0){
					signoff_pdf(secondary_objects[j],data_file,"pdf");
				}
				MEM_free(dataset_type);
			}

			DOFREE(secondary_objects);

			GRM_find_relation_type("IMAN_Rendering", &relation_type);

			GRM_list_secondary_objects_only(itemrevision, relation_type, &ds_count, &secondary_objects);
			for (int j = 0; j < ds_count; j++)
			{
				printf("进3\n");
				AOM_ask_value_string(secondary_objects[j], "object_type", &dataset_type);
				int des_count=0;
				tag_t *dess=NULL;
				char  *name;

				if(!(strcmp(dataset_type, "JK8_AutoCAD") == 0||
					strcmp(dataset_type, "MSWord") ==0||
					strcmp(dataset_type, "MSWordX") ==0||
					strcmp(dataset_type, "MSExcel") ==0||
					strcmp(dataset_type, "MSExcelX") ==0||
					strcmp(dataset_type, "PDF") ==0)){
						if(dataset_type!=NULL){
							MEM_free(dataset_type);
							dataset_type =NULL;
						}
				
					continue;
				}
				AOM_ask_value_tags(secondary_objects[j], "ref_list", &des_count,&dess);
				if(des_count<1){
					printf("该数据集引用数量错误\n");
					continue;
				}
				if(strcmp(dataset_type, "JK8_AutoCAD") == 0) 
				{
				//	ECHO("导出dwg...\n");
				//	POM_AM__set_application_bypass(true);
				//	ifail = export_dataset_file(dataset_list[j], "PDF_Reference", "dwg", &filename,&original_name);
					if( data_file != NULL )
					signoff_acad(secondary_objects[j],data_file);
				}
				else if(strcmp(dataset_type, "MSWord") ==0 )
				{
					AOM_ask_value_string(dess[0], "original_file_name", &name);
					printf("name=%s\n",name);
					if ((strstr(name,"docx") != NULL)||(strstr(name,"xlsx") != NULL)){
						printf("后缀为docx或xlsx退出\n");
						continue;
					}
					signoff_msword(secondary_objects[j],data_file,"doc");
				}
				else if(strcmp(dataset_type, "MSWordX") ==0)
				{
					AOM_ask_value_string(dess[0], "original_file_name", &name);
					printf("name=%s\n",name);
					if ((strstr(name,"docx") != NULL)||(strstr(name,"xlsx") != NULL)){
						printf("后缀为docx或xlsx退出\n");
						continue;
					}
					signoff_msword(secondary_objects[j],data_file,"docx");
				}
				else if(strcmp(dataset_type, "MSExcel") ==0 )
				{
					AOM_ask_value_string(dess[0], "original_file_name", &name);
					printf("name=%s\n",name);
					if ((strstr(name,"docx") != NULL)||(strstr(name,"xlsx") != NULL)){
						printf("后缀为docx或xlsx退出\n");
						continue;
					}
					signoff_msexcel(secondary_objects[j],data_file,"xls");
				}
				else if(strcmp(dataset_type, "MSExcelX") ==0)
				{
					AOM_ask_value_string(dess[0], "original_file_name", &name);
					printf("name=%s\n",name);
					if ((strstr(name,"docx") != NULL)||(strstr(name,"xlsx") != NULL)){
						printf("后缀为docx或xlsx退出\n");
						continue;
					}
					signoff_msexcel(secondary_objects[j],data_file,"xlsx");
				}else if(strcmp(dataset_type, "PDF") ==0){
					signoff_pdf(secondary_objects[j],data_file,"pdf");
				}
				MEM_free(dataset_type);
			}
			DOFREE(secondary_objects);

		}
	}
	POM_AM__set_application_bypass(false);
	DOFREE(taskAttches);
	ECHO("=========================================================\n");
	ECHO("jf_signoff_dataset 执行结束\n");
	ECHO("=========================================================\n");
	return rcode;
}


int JK_bypass(EPM_action_message_t msg){
	ECHO("==================bypass START =======================\n");
	int ifail = ITK_ok, arg_cnt;
	char *argflag =NULL,*argvalue=NULL ,*arg = NULL;
	int i=0, j=0;
	BOOL bypass = FALSE;
	arg_cnt = TC_number_of_arguments(msg.arguments);
	ECHO("参数个数为：%d\n",arg_cnt);
	POM_AM__set_application_bypass(true);
	if (arg_cnt > 0)
	{
		for (i=0;i<arg_cnt;i++)
		{
			arg = TC_next_argument(msg.arguments);
			ifail = ITK_ask_argument_named_value((const char*)arg, &argflag, &argvalue);
			if(stricmp(argflag,"bypass") == 0)
			{
				if(stricmp(argvalue,"true") == 0){
					bypass=TRUE;
				}else if(stricmp(argvalue,"false") == 0){
					bypass = FALSE;
				}
			}

		}

		if(argflag!=NULL){
			MEM_free(argflag);
			argflag=NULL;
		}
		if(argvalue!=NULL){
			MEM_free(argvalue);
			argvalue=NULL;
		}
	}
	printf("bypass=%d /n",bypass);
	POM_AM__set_application_bypass(bypass);
	
	ECHO("==================bypass END =======================\n");
	return ifail;
}

int check_target_null( EPM_rule_message_t msg ){
	ECHO("==================检查流程目标中的文件夹中间是否有对象 START =======================\n");
	int ifail = EPM_go,count = 0,i = 0;
	tag_t root_task = NULL_TAG;
	tag_t * attachments = NULL;
	ITKCALL(EPM_ask_root_task(msg.task,&root_task));
	ITKCALL(EPM_ask_attachments(root_task,EPM_target_attachment,&count,&attachments));
	for(i = 0 ;i < count;i++){
		tag_t type_tag = NULL_TAG;
		ITKCALL(TCTYPE_ask_object_type(attachments[i],&type_tag));
		tag_t folder_type = NULLTAG;
		ITKCALL(TCTYPE_find_type("Folder","",&folder_type));
		if(folder_type != NULLTAG){
			//printf(" find Folder type ok !!!! \n");
			logical isok = FALSE;
			ITKCALL(TCTYPE_is_type_of(type_tag,folder_type,&isok));
			if(isok){
				int contents_count = 0;
				tag_t * contents_tags = NULL;
				ITKCALL(AOM_ask_value_tags(attachments[i],"contents",&contents_count,&contents_tags));
				if(contents_count == 0){
					ifail = EPM_nogo;
					//break;
				}
			//  else
			//	{
			//		for(int j = 0 ; j < contents_count;j++){
			//			int release_count = 0;
			//			tag_t * release_tags = NULL;
			//			ITKCALL(AOM_ask_value_tags(contents_tags[j],"release_status_list",&release_count,&release_tags));
			//			if(release_count == 0){
			//				ifail = EPM_nogo;
			//				//break;
			//			}else{
			//				ifail = EPM_go;
			//			}
			//			if(release_tags!=NULL){
			//				MEM_free(release_tags);
			//				release_tags = NULL;
			//			}
			//			if(ifail == EPM_nogo){
			//				break;
			//			}
			//		}
			//		
			//	}
				if(contents_tags!=NULL){
					MEM_free(contents_tags);
					contents_tags = NULL;
				}
				if(ifail == EPM_nogo){
					break;
				}
			}
		}
	}
	if(attachments!=NULL){
		MEM_free(attachments);
		attachments = NULL;
	}
	ECHO("==================检查流程目标中的文件夹中间是否有对象 END =======================\n");
	return ifail;
}


int JK_class_null( EPM_rule_message_t msg ){
	ECHO("==================检查流程目标中的物料是否发送分类 START =======================\n");
	int ifail = EPM_go , 
		arg_cnt = 0 , 
		i = 0 ,
		att_cnt = 0;

	tag_t task_tag  = NULLTAG , 
		root_task_tag =NULLTAG , 
		*attachments = NULL;
	

	char * argflag = NULL ,
		*argvalue =NULL ,
		*arg = NULL , 
		arg_value[1024] = "\0",
		type_class[WSO_object_type_size_c+1] ="\0",
		errs[1024] = "\0";
	vector<string> type_vec;

	//获取handler参数的个数
	arg_cnt = TC_number_of_arguments(msg.arguments);
	ECHO("参数个数为：%d\n",arg_cnt);
	if (arg_cnt > 0)
	{
		for (i=0;i<arg_cnt;i++)
		{
			//获取下一个参数（从0开始）
			arg = TC_next_argument(msg.arguments);
			//获取参数的名称和值
			ITK_ask_argument_named_value((const char*)arg, &argflag, &argvalue);
			//需要检查哪些对象的类型
			if (stricmp(argflag, "include_type") == 0)
			{
				if(argvalue != NULL)
				{
					strcpy(arg_value,argvalue);
					Split(arg_value,",",type_vec);
				}else{
					string key_id;
					key_id.assign("缺少include_type参数");
				}
			}
			
		}
		MEM_free(argflag);
		MEM_free(argvalue);
	}



	task_tag = msg.task;
	if(task_tag == NULLTAG)
	{
		
		return EPM_nogo;
	}
	EPM_ask_root_task(task_tag, &root_task_tag);
	EPM_ask_attachments(root_task_tag, EPM_target_attachment, &att_cnt, &attachments);
	for(i = 0 ;i < att_cnt;i++){
		tag_t target_tag = attachments[i];
		//获取对象的类型
		ITKCALL( WSOM_ask_object_type(target_tag, type_class));
		ECHO("对象类型%s\n",type_class);
		string type_str ;
		type_str.assign(type_class);
		vector<string>::iterator it;
		it = find(type_vec.begin(),type_vec.end(),type_str);
		if(it == type_vec.end()){
			ECHO("此类型不包含在include_type中\n");
			//strcpy(errs,"存在类型不符的对象!!!");
			//ifail=EPM_nogo ;
			break;
		}
		/*char * item_id_temp = NULL;
		ITKCALL(AOM_ask_value_string(target_tag,"item_id",&item_id_temp));
		if(strstr(item_id_temp,"E-") !=NULL ){
			ECHO("E-开头的物料不需要传递\n");
			strcpy(errs,"E-开头的物料不需要传递!!!");
			if(item_id_temp !=NULL){
				MEM_free(item_id_temp);
				item_id_temp = NULL;
			}
			ifail=EPM_nogo ;
			break;
		}*/
		logical isclassed = false;
		logical isFilter = false;
		tag_t classification_object = NULLTAG;

		ITKCALL(ICS_is_wsobject_classified(target_tag,&isclassed));//判断是否已经分类

		if(isclassed){
			//char * icOid = NULL;
			//ITKCALL(ICS_ask_classification_object(target_tag,&classification_object));

			//ITKCALL(ICS_ico_ask_class(classification_object,&icsID));
			printf("\n 已发送到分类 \n");
		}else{
			strcpy(errs,"物料没有发送至分类库，请联系系统管理员！!!");
			printf("\n 没有发送到分类 \n");
			ifail=EPM_nogo ;
			break;
		}
		
		/*if(item_id_temp !=NULL){
			MEM_free(item_id_temp);
			item_id_temp = NULL;
		}*/
	}
	

	if(ifail==EPM_nogo){
		//PROP_unable_to_set_cp_value  ERROR_ERRORSTORE_NOERRORS//
		EMH_store_error_s1(EMH_severity_user_error,919002,errs);//错误弹窗
	}
	

	ECHO("==================检查流程目标中的物料是否发送分类 END =======================\n");
	return ifail;
}

/**
* 签名通知节点
*/
int tm_sign_tongzhi2( EPM_rule_message_t msg ){
	ECHO("==================检查流程目标中的文件夹中间是否有对象 START =======================\n");
	int ifail = EPM_nogo,count = 0,i = 0;
	tag_t root_task = NULL_TAG;
	tag_t * attachments = NULL;
	ITKCALL(EPM_ask_root_task(msg.task,&root_task));
	ITKCALL(EPM_ask_attachments(root_task,EPM_target_attachment,&count,&attachments));
	for(i = 0 ;i < count;i++){
		tag_t type_tag = NULL_TAG;
		ITKCALL(TCTYPE_ask_object_type(attachments[i],&type_tag));
		tag_t folder_type = NULLTAG;
		ITKCALL(TCTYPE_find_type("Folder","",&folder_type));
		if(folder_type != NULLTAG){
			//printf(" find Folder type ok !!!! \n");
			logical isok = FALSE;
			ITKCALL(TCTYPE_is_type_of(type_tag,folder_type,&isok));
			if(isok){
				int contents_count = 0;
				tag_t * contents_tags = NULL;
				ITKCALL(AOM_ask_value_tags(attachments[i],"contents",&contents_count,&contents_tags));
				if(contents_count == 0){
					ifail = EPM_nogo;
					//break;
				}
			//	else{
			//		for(int j = 0 ; j < contents_count;j++){
			//			int release_count = 0;
			//			tag_t * release_tags = NULL;
			//			ITKCALL(AOM_ask_value_tags(contents_tags[j],"release_status_list",&release_count,&release_tags));
			//			//if(release_count == 0){
			//			//	ifail = EPM_nogo;
			//			//	//break;
			//			//}else{
			//			//	ifail = EPM_go;
			//			//}
			//			if(release_tags!=NULL){
			//				MEM_free(release_tags);
			//				release_tags = NULL;
			//			}
			//			if(ifail == EPM_nogo){
			//				break;
			//			}
			//		}
			//		
			//	}
				if(contents_tags!=NULL){
					MEM_free(contents_tags);
					contents_tags = NULL;
				}
				if(ifail == EPM_nogo){
					break;
				}
			}
		}
	}
	if(attachments!=NULL){
		MEM_free(attachments);
		attachments = NULL;
	}
	ECHO("==================检查流程目标中的文件夹中间是否有对象 END =======================\n");
	return ifail;
}
