#include "jk_custom.h"
#include "tc_log.h"
#include <res/res_itk.h>
#include "hx_custom.h"


typedef struct{
	string jk8ProductType;//产品类型
	string 	jk8ProjectNO;// 项目编号
	string 	jk8ProjectName;// 项目名称
	string 	jk8ProductModNO;// 产品型号
	string 	jk8ProductIdentifyNO;// 识别号
	string 	jk8ProductName;//产品名称
	string 	jk8BMManufactor;//基表厂家
	string 	jk8BMMaterial;//基表材质
	string 	jk8ContrlCompType;//控制器组件类型
	string 	jk8Note;//备注
	string 	jk8Applicant;//申请人
	string 	jk8RecordDate;//登记日期
	string 	jk8Status;//状态
	string 	jk8ProductTypePMN;//产品类型
	string 	jk8PipeDSpec;//管径规格
	//  string 	jk8CommunicateMode; 通信方式
	string  jk8Feature;//特征
	string  jk8Texture;//材质
	string 	jk8Structure;//结构
	string  jk8Description;//功能描述
}JK_WATER_SUMMARY_STRUCT;
/**
*	设置汇总表属性
*/
void JK_set_water_summary_form_prop(tag_t form_tag,vector<JK_WATER_SUMMARY_STRUCT> bean_vec){
	WriteLog_jk("开始设置汇总表属性\n");
	int i = 0,j=0 ;
	int prop_count = 18;
	char ** values[18];
	if(bean_vec.size() > 0){
		for(i = 0 ;i < prop_count;i++){
			values[i] =(char**) MEM_alloc(sizeof(char*)*bean_vec.size());
			for(j =0;j < bean_vec.size();j++){
				values[i][j] = (char *) MEM_alloc(sizeof(char)*256);
			}
		}
		for(i = 0 ;i < bean_vec.size();i++){
			JK_WATER_SUMMARY_STRUCT bean = bean_vec[i];
			strcpy(values[0][i],bean.jk8ProductTypePMN.c_str());//产品类型
			strcpy(values[1][i],bean.jk8ProjectNO.c_str());// 项目编号
			strcpy(values[2][i],bean.jk8ProjectName.c_str());// 项目名称
			strcpy(values[3][i],bean.jk8ProductModNO.c_str());// 产品型号
			strcpy(values[4][i],bean.jk8ProductIdentifyNO.c_str());// 识别号   5

			strcpy(values[5][i],bean.jk8ProductName.c_str());// 产品名称
			strcpy(values[6][i],bean.jk8BMManufactor.c_str());// 基表厂家
			strcpy(values[7][i],bean.jk8BMMaterial.c_str());// 基表材质
			strcpy(values[8][i],bean.jk8ContrlCompType.c_str());;// 控制器组件类型
			strcpy(values[9][i],bean.jk8Note.c_str());// 备注  10

			strcpy(values[10][i],bean.jk8Applicant.c_str());// 申请人
			strcpy(values[11][i],bean.jk8RecordDate.c_str());// 登记日期
			strcpy(values[12][i],bean.jk8Status.c_str());// 状态
			//strcpy(values[13][i],bean.jk8ProductTypePMN.c_str());// 产品类型
			strcpy(values[13][i],bean.jk8PipeDSpec.c_str());// 管径规格

			//strcpy(values[14][i],bean.jk8CommunicateMode.c_str());// 通信方式
			strcpy(values[14][i],bean.jk8Feature.c_str());// 特征
			strcpy(values[15][i],bean.jk8Texture.c_str());// 材质
			strcpy(values[16][i],bean.jk8Structure.c_str());// 结构
			strcpy(values[17][i],bean.jk8Description.c_str());// 功能描述
			
		}
	}
	
	ITKCALL(AOM_set_value_strings(form_tag,"jk8ProductTypePMN",bean_vec.size(),values[0]));//产品类型
	ITKCALL(AOM_set_value_strings(form_tag,"jk8ProjectNO",bean_vec.size(),values[1]));// 项目编号
	ITKCALL(AOM_set_value_strings(form_tag,"jk8ProjectName",bean_vec.size(),values[2]));// 项目名称
	ITKCALL(AOM_set_value_strings(form_tag,"jk8ProductModNO",bean_vec.size(),values[3]));// 产品型号
	ITKCALL(AOM_set_value_strings(form_tag,"jk8ProductIdentifyNO",bean_vec.size(),values[4]));// 识别号

	ITKCALL(AOM_set_value_strings(form_tag,"jk8ProductName",bean_vec.size(),values[5]));// 产品名称
	ITKCALL(AOM_set_value_strings(form_tag,"jk8BMManufactor",bean_vec.size(),values[6]));// 基表厂家
	ITKCALL(AOM_set_value_strings(form_tag,"jk8BMMaterial",bean_vec.size(),values[7]));// 基表材质
	ITKCALL(AOM_set_value_strings(form_tag,"jk8ContrlCompType",bean_vec.size(),values[8]));// 控制器组件类型
	ITKCALL(AOM_set_value_strings(form_tag,"jk8Note",bean_vec.size(),values[9]));// 备注

	ITKCALL(AOM_set_value_strings(form_tag,"jk8Applicant",bean_vec.size(),values[10]));// 申请人
	ITKCALL(AOM_set_value_strings(form_tag,"jk8RecordDate",bean_vec.size(),values[11]));// 登记日期
	ITKCALL(AOM_set_value_strings(form_tag,"jk8Status",bean_vec.size(),values[12]));// 状态
	//ITKCALL(AOM_set_value_strings(form_tag,"jk8ProductTypePMN",bean_vec.size(),values[13]));// 产品类型
	ITKCALL(AOM_set_value_strings(form_tag,"jk8PipeDSpec",bean_vec.size(),values[13]));// 管径规格

	//ITKCALL(AOM_set_value_strings(form_tag,"jk8CommunicateMode",bean_vec.size(),values[14]));// 通信方式
	ITKCALL(AOM_set_value_strings(form_tag,"jk8Feature",bean_vec.size(),values[14]));// 特征
	ITKCALL(AOM_set_value_strings(form_tag,"jk8Texture",bean_vec.size(),values[15]));// 材质
	ITKCALL(AOM_set_value_strings(form_tag,"jk8Structure",bean_vec.size(),values[16]));// 结构
	ITKCALL(AOM_set_value_strings(form_tag,"jk8FunctionOverview",bean_vec.size(),values[17]));// 功能描述

	ITKCALL(AOM_save(form_tag));
	ITKCALL(AOM_refresh(form_tag,false));
	ITKCALL(AOM_unlock(form_tag,0));
	WriteLog_jk("传递汇总表结束,保存数据完成\n");
	printf("------------传递汇总表0000-----------------");

	//释放资源
	/*for(i = 0 ;i <prop_count;i++){
	for(j =0;j < bean_vec.size();j++){
	MEM_free(values[i][j]);
	values[i][j] = NULL;
	}
	MEM_free(values[i]);
	values[i] = NULL;
	}*/
	printf("------------传递汇总表1111-----------------");
}

/**
*
* 获取汇总表的属性 pcb
* 将表单16个数组属性写入到二维数组中，写入实体类
*/
void JK_get_water_summary_form_prop(tag_t form_tag,vector<JK_WATER_SUMMARY_STRUCT> &bean_vec,int * isOk){
	int prop_count = 18;
	int count[18],sum_count =0;
	char ** form_value[18];
	//POM_AM__set_application_bypass(true);
	*isOk = 1;
	printf("获取汇总表单【%d】的属性\n",form_tag);
	ITKCALL(AOM_ask_value_strings(form_tag,"jk8ProductTypePMN",&count[0],&form_value[0]));//产品类型
	sum_count = count[0];
	ITKCALL(AOM_ask_value_strings(form_tag,"jk8ProjectNO",&count[1],&form_value[1]));// 项目编号
	ITKCALL(AOM_ask_value_strings(form_tag,"jk8ProjectName",&count[2],&form_value[2]));// 项目名称
	ITKCALL(AOM_ask_value_strings(form_tag,"jk8ProductModNO",&count[3],&form_value[3]));// 产品型号
	ITKCALL(AOM_ask_value_strings(form_tag,"jk8ProductIdentifyNO",&count[4],&form_value[4]));// 识别号
	ITKCALL(AOM_ask_value_strings(form_tag,"jk8ProductName",&count[5],&form_value[5]));// 产品名称
	ITKCALL(AOM_ask_value_strings(form_tag,"jk8BMManufactor",&count[6],&form_value[6]));// 基表厂家
	ITKCALL(AOM_ask_value_strings(form_tag,"jk8BMMaterial",&count[7],&form_value[7]));// 基表材质
	ITKCALL(AOM_ask_value_strings(form_tag,"jk8ContrlCompType",&count[8],&form_value[8]));// 控制器组件类型
	ITKCALL(AOM_ask_value_strings(form_tag,"jk8Note",&count[9],&form_value[9]));// 备注
	ITKCALL(AOM_ask_value_strings(form_tag,"jk8Applicant",&count[10],&form_value[10]));// 申请人
	ITKCALL(AOM_ask_value_strings(form_tag,"jk8RecordDate",&count[11],&form_value[11]));// 登记日期
	ITKCALL(AOM_ask_value_strings(form_tag,"jk8Status",&count[12],&form_value[12]));// 状态
	//ITKCALL(AOM_ask_value_strings(form_tag,"jk8ProductTypePMN",&count[13],&form_value[13]));// 产品类型
	ITKCALL(AOM_ask_value_strings(form_tag,"jk8PipeDSpec",&count[13],&form_value[13]));// 管径规格
	// ITKCALL(AOM_ask_value_strings(form_tag,"jk8CommunicateMode",&count[14],&form_value[14]));通信方式
	ITKCALL(AOM_ask_value_strings(form_tag,"jk8Feature",&count[14],&form_value[14]));// 特征
	ITKCALL(AOM_ask_value_strings(form_tag,"jk8Texture",&count[15],&form_value[15]));// 材质
	ITKCALL(AOM_ask_value_strings(form_tag,"jk8Structure",&count[16],&form_value[16]));// 结构
	ITKCALL(AOM_ask_value_strings(form_tag,"jk8FunctionOverview",&count[17],&form_value[17]));// 功能描述
	for(int i  = 0 ;i < (prop_count-1);i++){
		if(count[i] !=count[i+1]){
			*isOk = 0;
			printf("属性不正确=>\n");
		}
	}
	printf("222222222222222222=>\n");
	if( *isOk ==1){
		printf("3333333333333333=>\n");
		for(int i = 0 ;i <sum_count;i++ ){
			JK_WATER_SUMMARY_STRUCT bean ;
//			bean.jk8ProductType.assign(form_value[0][i]);//产品类型
			bean.jk8ProductTypePMN.assign(form_value[0][i]);//产品类型
			bean.jk8ProjectNO.assign(form_value[1][i]);// 项目编号
			bean.jk8ProjectName.assign(form_value[2][i]);// 项目名称
			bean.jk8ProductModNO.assign(form_value[3][i]);// 产品型号
			bean.jk8ProductIdentifyNO.assign(form_value[4][i]);// 识别号   5
			bean.jk8ProductName.assign(form_value[5][i]);// 产品名称   6
			bean.jk8BMManufactor.assign(form_value[6][i]);// 基表厂家   6
			bean.jk8BMMaterial.assign(form_value[7][i]);// 基表材质  6
			bean.jk8ContrlCompType.assign(form_value[8][i]);// 控制器组件类型   6
			bean.jk8Note.assign(form_value[9][i]);// 备注   6
			bean.jk8Applicant.assign(form_value[10][i]);// 申请人   6
			bean.jk8RecordDate.assign(form_value[11][i]);// 登记日期   6
			bean.jk8Status.assign(form_value[12][i]);// 状态   6
			//bean.jk8ProductTypePMN.assign(form_value[13][i]);// 产品类型  6
			bean.jk8PipeDSpec.assign(form_value[13][i]);// 管径规格   6
			//bean.jk8CommunicateMode.assign(form_value[14][i]);// 通信方式   6
			bean.jk8Feature.assign(form_value[14][i]);// 特征  6
			bean.jk8Texture.assign(form_value[15][i]);// 材质  6
			bean.jk8Structure.assign(form_value[16][i]);// 结构   6
			bean.jk8Description.assign(form_value[17][i]);// 功能描述   6

			bean_vec.push_back(bean);
		}
	}
	printf("444444444444444=>\n");
	//清空取到的表单属性的值
	for(int i = 0 ;i < prop_count; i++){
		for(int j = 0;j < count[i];j++){
			if(form_value[i][j]!=NULL){
				MEM_free(form_value[i][j]);
				form_value[i][j] =NULL;
			}
		}
		if(form_value[i]!=NULL){
			MEM_free(form_value[i]);
			form_value[i] = NULL;
		}
	}
	//POM_AM__set_application_bypass(false);
	printf("555555555555=>\n");

}
/**
* 获取四张扩展表的属性
*
*/
void JK_get_water_form_prop(tag_t form_tag,JK_WATER_SUMMARY_STRUCT &bean,char *form_type){
	char * form_value[16];
	int prop_count = 16;
	WriteLog_jk("开始获取单张表属性 \n");
	tag_t user_tag =NULLTAG;
	ITKCALL(AOM_ask_value_tag(form_tag,"owning_user",&user_tag));
	if(user_tag!=NULLTAG)
	{
		ITKCALL(AOM_ask_value_string(user_tag,"user_name",&form_value[10]))//TODO 申请人
	}else{
		form_value[10] = (char *)MEM_alloc(sizeof(char)*128);
	}
	form_value[11] = (char *)MEM_alloc(sizeof(char)*128);//TODO 登记日期
	//ITKCALL(AOM_ask_value_string(form_tag,"jk8RecordDate",&form_value[14]));// 登记日期
	time_t now;
	struct tm *p;
	time(&now);
	p = localtime(&now);
	sprintf(form_value[11], "%d年%d月%d日", 1900+p->tm_year,p->tm_mon+1 ,p->tm_mday );
	cout<<"1-----------"<<endl;
	if(strcmp(form_type , "JK8WaterPModAppForm")==0){//新产品型号、识别号申请表

		for (int i = 0; i < prop_count; i++)
		{
		/*	if((i!=4)&&(i!=9)&&1<i<17||i==20||i==22){
				form_value[i] = (char *)MEM_alloc(sizeof(char)*128);
				strcpy(form_value[i],"");// 状态  默认为空
			}*/

		}

		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductTypePMN",&form_value[0]));// 产品类型
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProjectNO",&form_value[1]));// 项目编号
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProjectName",&form_value[2]));// 项目名称
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductModNO",&form_value[3]));// 产品型号
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductIdentifyNO",&form_value[4]));// 识别号

		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductName",&form_value[5]));// 产品名称
		ITKCALL(AOM_ask_value_string(form_tag,"jk8BMManufactor",&form_value[6]));// 基表厂家
		ITKCALL(AOM_ask_value_string(form_tag,"jk8BMMaterial",&form_value[7]));// 基表材质
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ContrlCompType",&form_value[8]));// 控制器组件类型
		//ITKCALL(AOM_ask_value_string(form_tag,"jk8Note",&form_value[9]));// 备注(无此属性)
//		ITKCALL(AOM_ask_value_string(form_tag,"jk8Applicant",&form_value[10]));// 申请人
//		ITKCALL(AOM_ask_value_string(form_tag,"jk8RecordDate",&form_value[11]));// 登记日期
		//ITKCALL(AOM_ask_value_string(form_tag,"jk8Status",&form_value[12]));// 状态(无此属性)
		//ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductTypePMN",&form_value[13]));// 产品类型
		ITKCALL(AOM_ask_value_string(form_tag,"jk8PipeDSpec",&form_value[13]));// 管径规格
		ITKCALL(AOM_ask_value_string(form_tag,"jk8CommunicateMode",&form_value[14]));// 通信方式
		ITKCALL(AOM_ask_value_string(form_tag,"jk8Structure",&form_value[15]));// 结构

		
		form_value[9] = (char *)MEM_alloc(sizeof(char)*128);
		strcpy(form_value[9],"");// 状态  默认为空
		form_value[12] = (char *)MEM_alloc(sizeof(char)*128);
		strcpy(form_value[12],"");// 状态  默认为空

		bean.jk8ProductTypePMN.assign(form_value[0]);
		bean.jk8ProjectNO.assign(form_value[1]);
		bean.jk8ProjectName.assign(form_value[2]);
		bean.jk8ProductModNO.assign(form_value[3]);
		bean.jk8ProductIdentifyNO.assign(form_value[4]);

		bean.jk8ProductName.assign(form_value[5]);
		bean.jk8BMManufactor.assign(form_value[6]);
		bean.jk8BMMaterial.assign(form_value[7]);
		bean.jk8ContrlCompType.assign(form_value[8]);
		bean.jk8Note.assign(form_value[9]);

		bean.jk8Applicant.assign(form_value[10]);
		bean.jk8RecordDate.assign(form_value[11]);
		bean.jk8Status.assign(form_value[12]);
		bean.jk8PipeDSpec.assign(form_value[13]);
	//	bean.jk8CommunicateMode.assign(form_value[14]);

		bean.jk8Structure.assign(form_value[15]);
	}else if(strcmp(form_type , "JK8NWPIdenNOAppForm")==0)//新产品识别号申请表
	{
		cout<<"2-----------"<<endl;
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductTypePMN",&form_value[0]));// 产品类型
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProjectNO",&form_value[1]));// 项目编号
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProjectName",&form_value[2]));// 项目名称
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductModNO",&form_value[3]));// 产品型号
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductIdentifyNO",&form_value[4]));// 识别号

		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductName",&form_value[5]));// 产品名称
		ITKCALL(AOM_ask_value_string(form_tag,"jk8BMManufactor",&form_value[6]));// 基表厂家
		ITKCALL(AOM_ask_value_string(form_tag,"jk8BMMaterial",&form_value[7]));// 基表材质
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ContrlCompType",&form_value[8]));// 控制器组件类型
		//ITKCALL(AOM_ask_value_string(form_tag,"jk8Note",&form_value[9]));// 备注(无此属性)
//		ITKCALL(AOM_ask_value_string(form_tag,"jk8Applicant",&form_value[10]));// 申请人
//		ITKCALL(AOM_ask_value_string(form_tag,"jk8RecordDate",&form_value[11]));// 登记日期
		//ITKCALL(AOM_ask_value_string(form_tag,"jk8Status",&form_value[12]));// 状态(无此属性)
		//ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductTypePMN",&form_value[13]));// 产品类型
		ITKCALL(AOM_ask_value_string(form_tag,"jk8PipeDSpec",&form_value[13]));// 管径规格
		ITKCALL(AOM_ask_value_string(form_tag,"jk8CommunicateMode",&form_value[14]));// 通信方式
		ITKCALL(AOM_ask_value_string(form_tag,"jk8Structure",&form_value[15]));// 结构

		cout<<"3-----------"<<endl;
		form_value[9] = (char *)MEM_alloc(sizeof(char)*128);
		strcpy(form_value[9],"");// 状态  默认为空
		form_value[12] = (char *)MEM_alloc(sizeof(char)*128);
		strcpy(form_value[12],"");// 状态  默认为空

		bean.jk8ProductTypePMN.assign(form_value[0]);
		bean.jk8ProjectNO.assign(form_value[1]);
		bean.jk8ProjectName.assign(form_value[2]);
		bean.jk8ProductModNO.assign(form_value[3]);
		bean.jk8ProductIdentifyNO.assign(form_value[4]);

		bean.jk8ProductName.assign(form_value[5]);
		bean.jk8BMManufactor.assign(form_value[6]);
		bean.jk8BMMaterial.assign(form_value[7]);
		bean.jk8ContrlCompType.assign(form_value[8]);
		bean.jk8Note.assign(form_value[9]);

		bean.jk8Applicant.assign(form_value[10]);
		bean.jk8RecordDate.assign(form_value[11]);
		bean.jk8Status.assign(form_value[12]);
		bean.jk8PipeDSpec.assign(form_value[13]);
	//	bean.jk8CommunicateMode.assign(form_value[14]);

		bean.jk8Structure.assign(form_value[15]);
		cout<<"4-----------"<<endl;
	}else if(strcmp(form_type , "JK8WSpecPINOAppForm")==0)//特殊要求识别号申请表
	{
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductTypePIN",&form_value[0]));// 产品类型
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProjectNO",&form_value[1]));// 项目编号
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProjectName",&form_value[2]));// 项目名称
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductModNO",&form_value[3]));// 产品型号
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductIdentifyNO",&form_value[4]));// 识别号

		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductName",&form_value[5]));// 产品名称
		ITKCALL(AOM_ask_value_string(form_tag,"jk8BMManufactor",&form_value[6]));// 基表厂家
		ITKCALL(AOM_ask_value_string(form_tag,"jk8BMMaterial",&form_value[7]));// 基表材质
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ContrlCompType",&form_value[8]));// 控制器组件类型
		//ITKCALL(AOM_ask_value_string(form_tag,"jk8Note",&form_value[9]));// 备注(无此属性)
//		ITKCALL(AOM_ask_value_string(form_tag,"jk8Applicant",&form_value[10]));// 申请人
//		ITKCALL(AOM_ask_value_string(form_tag,"jk8RecordDate",&form_value[11]));// 登记日期
		//ITKCALL(AOM_ask_value_string(form_tag,"jk8Status",&form_value[12]));// 状态(无此属性)
		//ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductTypePMN",&form_value[13]));// 产品类型
		ITKCALL(AOM_ask_value_string(form_tag,"jk8PipeDSpec",&form_value[13]));// 管径规格
		ITKCALL(AOM_ask_value_string(form_tag,"jk8CommunicateMode",&form_value[14]));// 通信方式
		ITKCALL(AOM_ask_value_string(form_tag,"jk8Structure",&form_value[15]));// 结构

		
		form_value[9] = (char *)MEM_alloc(sizeof(char)*128);
		strcpy(form_value[9],"");// 状态  默认为空
		form_value[12] = (char *)MEM_alloc(sizeof(char)*128);
		strcpy(form_value[12],"");// 状态  默认为空

		bean.jk8ProductTypePMN.assign(form_value[0]);
		bean.jk8ProjectNO.assign(form_value[1]);
		bean.jk8ProjectName.assign(form_value[2]);
		bean.jk8ProductModNO.assign(form_value[3]);
		bean.jk8ProductIdentifyNO.assign(form_value[4]);

		bean.jk8ProductName.assign(form_value[5]);
		bean.jk8BMManufactor.assign(form_value[6]);
		bean.jk8BMMaterial.assign(form_value[7]);
		bean.jk8ContrlCompType.assign(form_value[8]);
		bean.jk8Note.assign(form_value[9]);

		bean.jk8Applicant.assign(form_value[10]);
		bean.jk8RecordDate.assign(form_value[11]);
		bean.jk8Status.assign(form_value[12]);
		bean.jk8PipeDSpec.assign(form_value[13]);
	//	bean.jk8CommunicateMode.assign(form_value[14]);

		bean.jk8Structure.assign(form_value[15]);
	}else if(strcmp(form_type , "JK8DWPIdenNOAppForm")==0)//衍生产品识别号申请表
	{
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductType",&form_value[0]));// 产品类型
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProjectNO",&form_value[1]));// 项目编号
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProjectName",&form_value[2]));// 项目名称
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductModNO",&form_value[3]));// 产品型号
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductIdentifyNO",&form_value[4]));// 识别号

		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductName",&form_value[5]));// 产品名称
		ITKCALL(AOM_ask_value_string(form_tag,"jk8BMManufactor",&form_value[6]));// 基表厂家
		ITKCALL(AOM_ask_value_string(form_tag,"jk8BMMaterial",&form_value[7]));// 基表材质
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ContrlCompType",&form_value[8]));// 控制器组件类型
		//ITKCALL(AOM_ask_value_string(form_tag,"jk8Note",&form_value[9]));// 备注(无此属性)
//		ITKCALL(AOM_ask_value_string(form_tag,"jk8Applicant",&form_value[10]));// 申请人
//		ITKCALL(AOM_ask_value_string(form_tag,"jk8RecordDate",&form_value[11]));// 登记日期
		//ITKCALL(AOM_ask_value_string(form_tag,"jk8Status",&form_value[12]));// 状态(无此属性)
		//ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductTypePMN",&form_value[13]));// 产品类型
		ITKCALL(AOM_ask_value_string(form_tag,"jk8PipeDSpec",&form_value[13]));// 管径规格
		ITKCALL(AOM_ask_value_string(form_tag,"jk8CommunicateMode",&form_value[14]));// 通信方式
		ITKCALL(AOM_ask_value_string(form_tag,"jk8Structure",&form_value[15]));// 结构

		
		form_value[9] = (char *)MEM_alloc(sizeof(char)*128);
		strcpy(form_value[9],"");// 状态  默认为空
		form_value[12] = (char *)MEM_alloc(sizeof(char)*128);
		strcpy(form_value[12],"");// 状态  默认为空

		bean.jk8ProductTypePMN.assign(form_value[0]);
		bean.jk8ProjectNO.assign(form_value[1]);
		bean.jk8ProjectName.assign(form_value[2]);
		bean.jk8ProductModNO.assign(form_value[3]);
		bean.jk8ProductIdentifyNO.assign(form_value[4]);

		bean.jk8ProductName.assign(form_value[5]);
		bean.jk8BMManufactor.assign(form_value[6]);
		bean.jk8BMMaterial.assign(form_value[7]);
		bean.jk8ContrlCompType.assign(form_value[8]);
		bean.jk8Note.assign(form_value[9]);

		bean.jk8Applicant.assign(form_value[10]);
		bean.jk8RecordDate.assign(form_value[11]);
		bean.jk8Status.assign(form_value[12]);
		bean.jk8PipeDSpec.assign(form_value[13]);
	//	bean.jk8CommunicateMode.assign(form_value[14]);

		bean.jk8Structure.assign(form_value[15]);
	}



	//释放资源
	for(int i = 0 ;i <prop_count;i++){
		if(form_value[i]!=NULL){
			MEM_free(form_value[i]);
			form_value[i] = NULL;
		}
	}
}

/**
* 获取四张扩展表的属性
* 识别号分割
*/
void JK_get_water_form_propSplit(tag_t form_tag,vector<JK_WATER_SUMMARY_STRUCT> &list_bean ,char *form_type){
	char * form_value[18];
	int prop_count = 18;
	WriteLog_jk("开始获取单张表属性 \n");
	tag_t user_tag =NULLTAG;
	ITKCALL(AOM_ask_value_tag(form_tag,"owning_user",&user_tag));
	if(user_tag!=NULLTAG)
	{
		ITKCALL(AOM_ask_value_string(user_tag,"user_name",&form_value[10]))//TODO 申请人
	}else{
		form_value[10] = (char *)MEM_alloc(sizeof(char)*128);
	}
	form_value[11] = (char *)MEM_alloc(sizeof(char)*128);//TODO 登记日期
	//ITKCALL(AOM_ask_value_string(form_tag,"jk8RecordDate",&form_value[14]));// 登记日期
	time_t now;
	struct tm *p;
	time(&now);
	p = localtime(&now);
	sprintf(form_value[11], "%d年%d月%d日", 1900+p->tm_year,p->tm_mon+1 ,p->tm_mday );
	cout<<"1-----------"<<endl;
	if(strcmp(form_type , "JK8WaterPModAppForm")==0){//新产品型号、识别号申请表
		//初始化bean
		JK_WATER_SUMMARY_STRUCT bean ;
		for (int i = 0; i < prop_count; i++)
		{
		/*	if((i!=4)&&(i!=9)&&1<i<17||i==20||i==22){
				form_value[i] = (char *)MEM_alloc(sizeof(char)*128);
				strcpy(form_value[i],"");// 状态  默认为空
			}*/

		}

		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductTypePMN",&form_value[0]));// 产品类型
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProjectNO",&form_value[1]));// 项目编号
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProjectName",&form_value[2]));// 项目名称
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductModNO",&form_value[3]));// 产品型号
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductIdentifyNO",&form_value[4]));// 识别号

		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductName",&form_value[5]));// 产品名称
		ITKCALL(AOM_ask_value_string(form_tag,"jk8BMManufactor",&form_value[6]));// 基表厂家
		ITKCALL(AOM_ask_value_string(form_tag,"jk8BMMaterial",&form_value[7]));// 基表材质
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ContrlCompType",&form_value[8]));// 控制器组件类型
		//ITKCALL(AOM_ask_value_string(form_tag,"jk8Note",&form_value[9]));// 备注(无此属性)
//		ITKCALL(AOM_ask_value_string(form_tag,"jk8Applicant",&form_value[10]));// 申请人
//		ITKCALL(AOM_ask_value_string(form_tag,"jk8RecordDate",&form_value[11]));// 登记日期
		//ITKCALL(AOM_ask_value_string(form_tag,"jk8Status",&form_value[12]));// 状态(无此属性)
		//ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductTypePMN",&form_value[13]));// 产品类型
		ITKCALL(AOM_ask_value_string(form_tag,"jk8PipeDSpec",&form_value[13]));// 管径规格
	//	ITKCALL(AOM_ask_value_string(form_tag,"jk8CommunicateMode",&form_value[14]));// 通信方式
		ITKCALL(AOM_ask_value_string(form_tag,"jk8Feature",&form_value[14]));// 特征
		ITKCALL(AOM_ask_value_string(form_tag,"jk8Texture",&form_value[15]));// 材质
		ITKCALL(AOM_ask_value_string(form_tag,"jk8Structure",&form_value[16]));// 结构
		ITKCALL(AOM_ask_value_string(form_tag,"jk8FunctionOverview",&form_value[17]));// 功能描述

		form_value[9] = (char *)MEM_alloc(sizeof(char)*128);
		strcpy(form_value[9],"");// 状态  默认为空
		form_value[12] = (char *)MEM_alloc(sizeof(char)*128);
		strcpy(form_value[12],"");// 状态  默认为空

		bean.jk8ProductTypePMN.assign(form_value[0]);
		bean.jk8ProjectNO.assign(form_value[1]);
		bean.jk8ProjectName.assign(form_value[2]);
		bean.jk8ProductModNO.assign(form_value[3]);
		bean.jk8ProductIdentifyNO.assign(form_value[4]);

		bean.jk8ProductName.assign(form_value[5]);
		bean.jk8BMManufactor.assign(form_value[6]);
		bean.jk8BMMaterial.assign(form_value[7]);
		bean.jk8ContrlCompType.assign(form_value[8]);
		bean.jk8Note.assign(form_value[9]);

		bean.jk8Applicant.assign(form_value[10]);
		bean.jk8RecordDate.assign(form_value[11]);
		bean.jk8Status.assign(form_value[12]);
		bean.jk8PipeDSpec.assign(form_value[13]);
	//	bean.jk8CommunicateMode.assign(form_value[14]);
		bean.jk8Feature.assign(form_value[14]);
		bean.jk8Texture.assign(form_value[15]);
		bean.jk8Structure.assign(form_value[16]);
		bean.jk8Description.assign(form_value[17]);

		//split管径规格，创建多个bean
		vector<string> vec_gjgg;
		vector<string> vec_xh;
		vector<string> vec_sbh;
		Split(form_value[13], ",", vec_gjgg);
		Split(form_value[3], ",", vec_xh);
		Split(form_value[4], ",", vec_sbh);
		if(vec_gjgg.size() == vec_xh.size() && vec_gjgg.size() == vec_sbh.size()){
		   for(int i = 0 ;i < vec_gjgg.size();i++){
			   bean.jk8ProductModNO.assign(vec_xh[i]); 
		       bean.jk8PipeDSpec.assign(vec_gjgg[i]); 
			   bean.jk8ProductIdentifyNO.assign(vec_sbh[i]); 
		       list_bean.push_back(bean);
		   }
		}
	//	printf("vec_gjgg.size()=====%d",vec_gjgg.size());
	//	printf("first.list_bean.size()=====%d",list_bean.size());
		
		//split管径规格，创建多个bean
	/*	vector<string> vec_split;
		Split(form_value[13], ",", vec_split);
	    for(int i = 0 ;i < vec_split.size();i++){
		   bean.jk8PipeDSpec.assign(vec_split[i]); 
		   list_bean.push_back(bean);
		}   */
	}else if(strcmp(form_type , "JK8NWPIdenNOAppForm")==0)//新产品识别号申请表
	{
		//初始化bean
		JK_WATER_SUMMARY_STRUCT bean ;
		cout<<"2-----------"<<endl;
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductTypePMN",&form_value[0]));// 产品类型
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProjectNO",&form_value[1]));// 项目编号
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProjectName",&form_value[2]));// 项目名称
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductModNO",&form_value[3]));// 产品型号
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductIdentifyNO",&form_value[4]));// 识别号

		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductName",&form_value[5]));// 产品名称
		ITKCALL(AOM_ask_value_string(form_tag,"jk8BMManufactor",&form_value[6]));// 基表厂家
		ITKCALL(AOM_ask_value_string(form_tag,"jk8BMMaterial",&form_value[7]));// 基表材质
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ContrlCompType",&form_value[8]));// 控制器组件类型
		//ITKCALL(AOM_ask_value_string(form_tag,"jk8Note",&form_value[9]));// 备注(无此属性)
//		ITKCALL(AOM_ask_value_string(form_tag,"jk8Applicant",&form_value[10]));// 申请人
//		ITKCALL(AOM_ask_value_string(form_tag,"jk8RecordDate",&form_value[11]));// 登记日期
		//ITKCALL(AOM_ask_value_string(form_tag,"jk8Status",&form_value[12]));// 状态(无此属性)
		//ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductTypePMN",&form_value[13]));// 产品类型
		ITKCALL(AOM_ask_value_string(form_tag,"jk8PipeDSpec",&form_value[13]));// 管径规格
		ITKCALL(AOM_ask_value_string(form_tag,"jk8CommunicateMode",&form_value[14]));// 通信方式
		ITKCALL(AOM_ask_value_string(form_tag,"jk8Structure",&form_value[15]));// 结构

		cout<<"3-----------"<<endl;
		form_value[9] = (char *)MEM_alloc(sizeof(char)*128);
		strcpy(form_value[9],"");// 状态  默认为空
		form_value[12] = (char *)MEM_alloc(sizeof(char)*128);
		strcpy(form_value[12],"");// 状态  默认为空

		bean.jk8ProductTypePMN.assign(form_value[0]);
		bean.jk8ProjectNO.assign(form_value[1]);
		bean.jk8ProjectName.assign(form_value[2]);
		bean.jk8ProductModNO.assign(form_value[3]);
		bean.jk8ProductIdentifyNO.assign(form_value[4]);

		bean.jk8ProductName.assign(form_value[5]);
		bean.jk8BMManufactor.assign(form_value[6]);
		bean.jk8BMMaterial.assign(form_value[7]);
		bean.jk8ContrlCompType.assign(form_value[8]);
		bean.jk8Note.assign(form_value[9]);

		bean.jk8Applicant.assign(form_value[10]);
		bean.jk8RecordDate.assign(form_value[11]);
		bean.jk8Status.assign(form_value[12]);
		bean.jk8PipeDSpec.assign(form_value[13]);
		//	bean.jk8CommunicateMode.assign(form_value[14]);
		bean.jk8Feature.assign(form_value[14]);
		bean.jk8Texture.assign(form_value[15]);
		bean.jk8Structure.assign(form_value[16]);
		bean.jk8Description.assign(form_value[17]);

		
		//split管径规格，创建多个bean
   	/*	vector<string> vec_gjgg;
		vector<string> vec_xh;
		Split(form_value[13], ",", vec_gjgg);
		Split(form_value[3], ",", vec_xh);
		if(vec_gjgg.size() == vec_xh.size()){
		   for(int i = 0 ;i < vec_gjgg.size();i++){
			   bean.jk8ProductModNO.assign(vec_xh[i]); 
		       bean.jk8PipeDSpec.assign(vec_gjgg[i]); 
		       list_bean.push_back(bean);
		   }
		}    */
	    list_bean.push_back(bean);

	}else if(strcmp(form_type , "JK8WSpecPINOAppForm")==0)//特殊要求识别号申请表
	{
		//初始化bean
		JK_WATER_SUMMARY_STRUCT bean ;
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductTypePIN",&form_value[0]));// 产品类型
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProjectNO",&form_value[1]));// 项目编号
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProjectName",&form_value[2]));// 项目名称
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductModNO",&form_value[3]));// 产品型号
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductIdentifyNO",&form_value[4]));// 识别号

		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductName",&form_value[5]));// 产品名称
		ITKCALL(AOM_ask_value_string(form_tag,"jk8BMManufactor",&form_value[6]));// 基表厂家
		ITKCALL(AOM_ask_value_string(form_tag,"jk8BMMaterial",&form_value[7]));// 基表材质
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ContrlCompType",&form_value[8]));// 控制器组件类型
		//ITKCALL(AOM_ask_value_string(form_tag,"jk8Note",&form_value[9]));// 备注(无此属性)
//		ITKCALL(AOM_ask_value_string(form_tag,"jk8Applicant",&form_value[10]));// 申请人
//		ITKCALL(AOM_ask_value_string(form_tag,"jk8RecordDate",&form_value[11]));// 登记日期
		//ITKCALL(AOM_ask_value_string(form_tag,"jk8Status",&form_value[12]));// 状态(无此属性)
		//ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductTypePMN",&form_value[13]));// 产品类型
		ITKCALL(AOM_ask_value_string(form_tag,"jk8PipeDSpec",&form_value[13]));// 管径规格
		ITKCALL(AOM_ask_value_string(form_tag,"jk8CommunicateMode",&form_value[14]));// 通信方式
		ITKCALL(AOM_ask_value_string(form_tag,"jk8Structure",&form_value[15]));// 结构

		
		form_value[9] = (char *)MEM_alloc(sizeof(char)*128);
		strcpy(form_value[9],"");// 状态  默认为空
		form_value[12] = (char *)MEM_alloc(sizeof(char)*128);
		strcpy(form_value[12],"");// 状态  默认为空

		bean.jk8ProductTypePMN.assign(form_value[0]);
		bean.jk8ProjectNO.assign(form_value[1]);
		bean.jk8ProjectName.assign(form_value[2]);
		bean.jk8ProductModNO.assign(form_value[3]);
		bean.jk8ProductIdentifyNO.assign(form_value[4]);

		bean.jk8ProductName.assign(form_value[5]);
		bean.jk8BMManufactor.assign(form_value[6]);
		bean.jk8BMMaterial.assign(form_value[7]);
		bean.jk8ContrlCompType.assign(form_value[8]);
		bean.jk8Note.assign(form_value[9]);

		bean.jk8Applicant.assign(form_value[10]);
		bean.jk8RecordDate.assign(form_value[11]);
		bean.jk8Status.assign(form_value[12]);
		bean.jk8PipeDSpec.assign(form_value[13]);
		//	bean.jk8CommunicateMode.assign(form_value[14]);
		bean.jk8Feature.assign(form_value[14]);
		bean.jk8Texture.assign(form_value[15]);
		bean.jk8Structure.assign(form_value[16]);
		bean.jk8Description.assign(form_value[17]);

	    list_bean.push_back(bean);

	}else if(strcmp(form_type , "JK8DWPIdenNOAppForm")==0)//衍生产品识别号申请表
	{
		//初始化bean
		JK_WATER_SUMMARY_STRUCT bean ;
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductType",&form_value[0]));// 产品类型
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProjectNO",&form_value[1]));// 项目编号
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProjectName",&form_value[2]));// 项目名称
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductModNO",&form_value[3]));// 产品型号
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductIdentifyNO",&form_value[4]));// 识别号

		ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductName",&form_value[5]));// 产品名称
		ITKCALL(AOM_ask_value_string(form_tag,"jk8BMManufactor",&form_value[6]));// 基表厂家
		ITKCALL(AOM_ask_value_string(form_tag,"jk8BMMaterial",&form_value[7]));// 基表材质
		ITKCALL(AOM_ask_value_string(form_tag,"jk8ContrlCompType",&form_value[8]));// 控制器组件类型
		//ITKCALL(AOM_ask_value_string(form_tag,"jk8Note",&form_value[9]));// 备注(无此属性)
//		ITKCALL(AOM_ask_value_string(form_tag,"jk8Applicant",&form_value[10]));// 申请人
//		ITKCALL(AOM_ask_value_string(form_tag,"jk8RecordDate",&form_value[11]));// 登记日期
		//ITKCALL(AOM_ask_value_string(form_tag,"jk8Status",&form_value[12]));// 状态(无此属性)
		//ITKCALL(AOM_ask_value_string(form_tag,"jk8ProductTypePMN",&form_value[13]));// 产品类型
		ITKCALL(AOM_ask_value_string(form_tag,"jk8PipeDSpec",&form_value[13]));// 管径规格
		ITKCALL(AOM_ask_value_string(form_tag,"jk8CommunicateMode",&form_value[14]));// 通信方式
		ITKCALL(AOM_ask_value_string(form_tag,"jk8Structure",&form_value[15]));// 结构

		
		form_value[9] = (char *)MEM_alloc(sizeof(char)*128);
		strcpy(form_value[9],"");// 状态  默认为空
		form_value[12] = (char *)MEM_alloc(sizeof(char)*128);
		strcpy(form_value[12],"");// 状态  默认为空

		bean.jk8ProductTypePMN.assign(form_value[0]);
		bean.jk8ProjectNO.assign(form_value[1]);
		bean.jk8ProjectName.assign(form_value[2]);
		bean.jk8ProductModNO.assign(form_value[3]);
		bean.jk8ProductIdentifyNO.assign(form_value[4]);

		bean.jk8ProductName.assign(form_value[5]);
		bean.jk8BMManufactor.assign(form_value[6]);
		bean.jk8BMMaterial.assign(form_value[7]);
		bean.jk8ContrlCompType.assign(form_value[8]);
		bean.jk8Note.assign(form_value[9]);

		bean.jk8Applicant.assign(form_value[10]);
		bean.jk8RecordDate.assign(form_value[11]);
		bean.jk8Status.assign(form_value[12]);
		bean.jk8PipeDSpec.assign(form_value[13]);
		//	bean.jk8CommunicateMode.assign(form_value[14]);
		bean.jk8Feature.assign(form_value[14]);
		bean.jk8Texture.assign(form_value[15]);
		bean.jk8Structure.assign(form_value[16]);
		bean.jk8Description.assign(form_value[17]);

		list_bean.push_back(bean);

	}


	//释放资源
	for(int i = 0 ;i <prop_count;i++){
		if(form_value[i]!=NULL){
			MEM_free(form_value[i]);
			form_value[i] = NULL;
		}
	}
	//printf("second.list_bean.size()=====%d",list_bean.size());
}


int jk_water_summary(EPM_rule_message_t msg)
{
	
	char tc_log_file_name[512];
	time_t				now;
	struct				tm *p;
	time(&now);
	p = localtime(&now);

	//sprintf(startDate,"%04d-%d-%02d 00:00", 1900+p->tm_year,p->tm_mon+1 ,p->tm_mday);
	//sprintf(endDate,"%04d-%d-%02d 23:59", 1900+p->tm_year,p->tm_mon+1 ,p->tm_mday);
	sprintf(tc_log_file_name, "%s\\jk_water_hzb_log_[%d-%d-%d-%d-%02d].txt",getenv("TEMP"),1900+p->tm_year,p->tm_mon+1 ,p->tm_mday,p->tm_hour,p->tm_min  );
	printf("tc_log_file_name=%s\n",tc_log_file_name);
	CreateLogFile_jk(tc_log_file_name);

	EPM_decision_t decision = EPM_go;
	int ifail = ITK_ok,arg_cnt = 0,i = 0,att_cnt = 0;
	tag_t task_tag = NULLTAG ,rootTask_tag = NULLTAG, *attachments =NULL,summary_form_tag = NULLTAG;
	char *arg = NULL,*argflag = NULL, *argvalue = NULL,type_class[WSO_object_type_size_c+1] ="\0",*form_value = NULL;
	vector<JK_WATER_SUMMARY_STRUCT> bean_vec;
	//用来获取汇总表的PUID
	vector<string> pref_vec;
	getPrefStrings("JK_WATER_SQB_FORM_PUID",TC_preference_site, pref_vec);//w6UxvPI4YvbLjA  
	if(pref_vec.size() > 0){
		ITK__convert_uid_to_tag(pref_vec[0].c_str(),&summary_form_tag);
		if(summary_form_tag == NULLTAG){
			WriteLog_jk("PUID[%s]不能转换成对象\n",pref_vec[0].c_str());
			CloseLog_jk();
			printf("PUID[%s]不能转换成对象\n",pref_vec[0].c_str());
			return EPM_nogo;
		}
		printf("找到了汇总表\n");
		int isOk = 1;
		logical  is_reserved;
		POM_AM__set_application_bypass(true);
		ITKCALL(RES_is_checked_out(summary_form_tag,&is_reserved));
		if (is_reserved)
		{
			WriteLog_jk("汇总表签出,开始签入\n");
			ITKCALL(RES_checkin(summary_form_tag));
		}
		ITKCALL(AOM_lock(summary_form_tag));
		ITKCALL(AOM_refresh(summary_form_tag,false));
		POM_AM__set_application_bypass(false);
		JK_get_water_summary_form_prop(summary_form_tag,bean_vec,&isOk);   //将汇总表的数据装载
		if(isOk == 0){
			ITKCALL(AOM_unlock(summary_form_tag));
			printf("PUID[%s]表单属性不正确\n",pref_vec[0].c_str());
			WriteLog_jk("PUID[%s]表单属性不正确\n",pref_vec[0].c_str());
			CloseLog_jk();
			return EPM_nogo;
		}
	}else{
		printf("请配置首选项[JK_WATER_SQB_FORM_PUID]\n");
		WriteLog_jk("请配置首选项[JK_WATER_SQB_FORM_PUID]\n");
		CloseLog_jk();
		return EPM_nogo;
	}

	//获取当前触发的任务
	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));
	//循环目标对象
	for(i = 0;i < att_cnt ; i++){
		//获取对象的类型
		/**********************************************
		*	对象类型：JK8DerPIdenNOAppForm
		*	对象类型：JK8SpecPINOAppForm
		*	对象类型：JK8NewPIdenNOAppForm
		*	对象类型：JK8NPModINOAppForm
		*	对象类型：JK8ExtPIdenNOAppForm
		**********************************************/
		ITKCALL( WSOM_ask_object_type(attachments[i], type_class));
		WriteLog_jk("对象类型：%s \n",type_class);
		printf("对象类型：%s \n",type_class);
		if(strcmp(type_class,"JK8DWPIdenNOAppForm") ==0 //衍生产品识别号申请表
			||strcmp(type_class,"JK8WSpecPINOAppForm") ==0 //特殊要求产品识别号申请表
			||strcmp(type_class,"JK8NWPIdenNOAppForm") ==0 //新产品识别号申请表
			||strcmp(type_class,"JK8WaterPModAppForm") ==0//新产品型号与识别号申请表
			)
		{    
			WriteLog_jk("对象类型符合,开始执行代码 \n");
			char *name_fo;
			ITKCALL(AOM_ask_value_string(attachments[i],"object_name",&name_fo));
			WriteLog_jk("对象名称：%s \n",name_fo);

			char *sbhstr,*cpxhstr;
			if(strcmp(type_class,"JK8WaterPModAppForm") ==0){
				ITKCALL(AOM_ask_value_string(attachments[i],"jk8ProductModNO",&cpxhstr));// 产品型号
				if(strcmp(cpxhstr,"") ==0){
					printf("产品型号为空,无法传递\n");
					ITKCALL(AOM_unlock(summary_form_tag));
					WriteLog_jk("产品型号为空,无法传递\n");
					CloseLog_jk();
					return EPM_nogo;
				}	
			}else{
				ITKCALL(AOM_ask_value_string(attachments[i],"jk8ProductIdentifyNO",&sbhstr));// 识别号

				if(strcmp(sbhstr,"") ==0){
					printf("识别号为空,无法传递\n");
					ITKCALL(AOM_unlock(summary_form_tag));
					WriteLog_jk("识别号为空,无法传递\n");
					CloseLog_jk();
					return EPM_nogo;
				}
				
			}

		/**	JK_WATER_SUMMARY_STRUCT bean ;
			//获取单张表的属性
			JK_get_water_form_prop(attachments[i],bean,type_class);
			cout<<"5-----------"<<endl;
			bean_vec.push_back(bean);      */

			//add---start   添加集合bean      12/11
			vector<JK_WATER_SUMMARY_STRUCT> list_bean;
			JK_get_water_form_propSplit(attachments[i],list_bean,type_class);
	//		printf("third.list_bean.size===%d\n",list_bean.size());  
			cout<<"5-----------"<<endl;
			//将list_vec中的元素添加到bean_vec中
			bean_vec.insert(bean_vec.end(),list_bean.begin(),list_bean.end());
			
	//		printf("first.bean_vec.size===%d\n",bean_vec.size());  
	
			//end
		}

	}

	POM_AM__set_application_bypass(true);
	cout<<"6-----------"<<endl;
	JK_set_water_summary_form_prop(summary_form_tag,bean_vec);
	printf("bean_vec.size===%d",bean_vec.size());
	printf("------------传递汇总表2222-----------------");
	POM_AM__set_application_bypass(false);

	if(attachments!=NULL)
	{
		MEM_free(attachments);
		attachments = NULL;
	}
	WriteLog_jk("------------传递汇总表结束-----------------");
	CloseLog_jk();
	printf("------------传递汇总表完成-----------------");
	return decision;
}
