|
|
|
|
|
#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 <io.h>
|
|
|
#include <ae/dataset.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 "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 Connor_set_bypass(void* returnValue)
|
|
|
{
|
|
|
POM_AM__set_application_bypass(true);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
int Connor_close_bypass(void* returnValue)
|
|
|
{
|
|
|
POM_AM__set_application_bypass(false);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
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;
|
|
|
}
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>
|
|
|
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_name2(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);
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
set_bypass(true);
|
|
|
ITKCALL(AOM_lock(dataset));
|
|
|
ECHO("AE_remove_dataset_named_ref\n");
|
|
|
AE_remove_dataset_named_ref2(dataset, ref_name);
|
|
|
AOM_save(dataset);
|
|
|
|
|
|
ECHO("AE_add_dataset_named_ref\n");
|
|
|
set_bypass(true);
|
|
|
AE_add_dataset_named_ref2(dataset, ref_name, AE_PART_OF, new_file_tag);
|
|
|
|
|
|
AOM_save(dataset);
|
|
|
AOM_unlock(dataset);
|
|
|
//ITKCALL( AOM_refresh( dataset, FALSE ) );
|
|
|
return ifail;
|
|
|
}
|
|
|
//static int import_excel(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_name2(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);
|
|
|
//
|
|
|
// //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
// set_bypass(true);
|
|
|
// ITKCALL(AOM_lock(dataset));
|
|
|
// ECHO("AE_remove_dataset_named_ref\n");
|
|
|
// AE_remove_dataset_named_ref2(dataset, ref_name);
|
|
|
// AOM_save(dataset);
|
|
|
//
|
|
|
// ECHO("AE_add_dataset_named_ref\n");
|
|
|
// set_bypass(true);
|
|
|
// AE_add_dataset_named_ref2(dataset, ref_name, AE_PART_OF, new_file_tag);
|
|
|
//
|
|
|
// AOM_save(dataset);
|
|
|
// AOM_unlock(dataset);
|
|
|
// //ITKCALL( AOM_refresh( dataset, FALSE ) );
|
|
|
// return ifail;
|
|
|
//}
|
|
|
|
|
|
//int importExcel2(tag_t rev_tag, tag_t rel_tag, const char* pdfFile, char* datasetName, tag_t dataset) {
|
|
|
// tag_t* rfTags, datasetTag = NULLTAG, relation = NULLTAG;
|
|
|
// int ifail = ITK_ok, rfCount = 0;
|
|
|
// char type_class[WSO_object_type_size_c + 1], * pdfDatasetName;
|
|
|
//
|
|
|
// ITKCALL(ifail = GRM_create_relation(rev_tag, datasetTag, rel_tag, NULLTAG, &relation));
|
|
|
// ITKCALL(GRM_save_relation(relation));
|
|
|
// //set_bypass(false);
|
|
|
// if (ifail == ITK_ok) {
|
|
|
// printf("<22><><EFBFBD>ص<EFBFBD><D8B5>汾<EFBFBD>³ɹ<C2B3>\n");
|
|
|
// }
|
|
|
// else {
|
|
|
// printf("<22><><EFBFBD>ص<EFBFBD><D8B5>汾<EFBFBD><E6B1BE>ʧ<EFBFBD><CAA7>\n");
|
|
|
// return -1;
|
|
|
// }
|
|
|
//
|
|
|
// char* pdfFile2 = new char[255];
|
|
|
// strcpy(pdfFile2, pdfFile);
|
|
|
// ITKCALL(ifail = import_excel(datasetTag, "PDF_Reference", "pdf", pdfFile2, pdfName));
|
|
|
// if (ifail != ITK_ok) {
|
|
|
// //WriteLog(dwgName, "<22>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC>ļ<EFBFBD>ʧ<EFBFBD><CAA7>");
|
|
|
// printf("<22>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC>ļ<EFBFBD>ʧ<EFBFBD><CAA7>\n");
|
|
|
// }
|
|
|
//}
|
|
|
|
|
|
int importPdf2(tag_t rev_tag, tag_t rel_tag, const char* pdfFile, char* datasetName, char* pdfName, tag_t owner_user) {
|
|
|
tag_t* rfTags, datasetTag = NULLTAG, relation = NULLTAG;
|
|
|
int ifail = ITK_ok, rfCount = 0;
|
|
|
char type_class[WSO_object_type_size_c + 1], * pdfDatasetName;
|
|
|
if (datasetTag == NULLTAG) {
|
|
|
printf("û<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD>PDF<EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>%s<><73><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>д<EFBFBD><D0B4><EFBFBD>\n", datasetName);
|
|
|
tag_t pdfTypeTag = NULLTAG, tool = NULLTAG;
|
|
|
ITKCALL(ifail = AE_find_datasettype2("PDF", &pdfTypeTag));
|
|
|
ITKCALL(ifail = AE_create_dataset_with_id(pdfTypeTag, datasetName, "", "", "A", &datasetTag));//modify 2019 12 31 pdfname->datasetName 2020/10/15<31><35><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD>dwg
|
|
|
ITKCALL(ifail = AE_ask_datasettype_def_tool(pdfTypeTag, &tool));
|
|
|
ITKCALL(ifail = AE_set_dataset_tool(datasetTag, tool));
|
|
|
ITKCALL(ifail = POM_set_owning_user(datasetTag, owner_user));
|
|
|
ITKCALL(ifail = AE_set_dataset_format2(datasetTag, "PDF_Reference"));
|
|
|
ITKCALL(ifail = AOM_save(datasetTag));
|
|
|
ITKCALL(ifail = POM_set_owning_user(datasetTag, owner_user));
|
|
|
ITKCALL(ifail = AOM_save(datasetTag));
|
|
|
if (datasetTag == NULLTAG) {
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>\n");
|
|
|
return -1;
|
|
|
}
|
|
|
else {
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>\n");
|
|
|
//set_bypass(true)
|
|
|
|
|
|
ITKCALL(ifail = GRM_create_relation(rev_tag, datasetTag, rel_tag, NULLTAG, &relation));
|
|
|
ITKCALL(GRM_save_relation(relation));
|
|
|
//set_bypass(false);
|
|
|
if (ifail == ITK_ok) {
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><EFBFBD>汾<EFBFBD>³ɹ<EFBFBD>\n");
|
|
|
}
|
|
|
else {
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><EFBFBD>汾<EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>\n");
|
|
|
return -1;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
printf("<EFBFBD>ҵ<EFBFBD>PDF<EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>%s<><73><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>и<EFBFBD><D0B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>\n", pdfName);
|
|
|
}
|
|
|
char* pdfFile2 = new char[255];
|
|
|
strcpy(pdfFile2, pdfFile);
|
|
|
ITKCALL(ifail = import_dataset_file(datasetTag, "PDF_Reference", "pdf", pdfFile2, pdfName));
|
|
|
if (ifail != ITK_ok) {
|
|
|
//WriteLog(dwgName, "<22>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC>ļ<EFBFBD>ʧ<EFBFBD><CAA7>");
|
|
|
printf("<EFBFBD>ϴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD><EFBFBD>\n");
|
|
|
}
|
|
|
|
|
|
return ifail;
|
|
|
}
|
|
|
|
|
|
int signoff_msword(tag_t item_rev_tag, tag_t dataset, tag_t rel_tag, char* dat_file, char* ext)
|
|
|
{
|
|
|
tag_t spec_dataset_rev = NULLTAG, ref_object = NULLTAG, owner_user = NULLTAG;
|
|
|
AE_reference_type_t reference_type;
|
|
|
char* value = NULL;
|
|
|
//printf("\n111111111111\n");
|
|
|
AE_ask_dataset_latest_rev(dataset, &spec_dataset_rev);
|
|
|
AOM_ask_value_string(dataset, "object_name", &value);
|
|
|
AOM_ask_owner(dataset, &owner_user);
|
|
|
|
|
|
char ref_name[WSO_name_size_c + 1] = "word";
|
|
|
//printf("\n22222222222\n");
|
|
|
ITKCALL(AE_ask_dataset_named_ref2(spec_dataset_rev, ref_name, &reference_type, &ref_object));
|
|
|
if (ref_object == NULLTAG)
|
|
|
{
|
|
|
strcpy(ref_name, "Fnd0word");
|
|
|
ITKCALL(AE_ask_dataset_named_ref2(spec_dataset_rev, ref_name, &reference_type, &ref_object));
|
|
|
}
|
|
|
if (reference_type == AE_PART_OF)
|
|
|
{
|
|
|
//printf("\n3333333333333\n");
|
|
|
int ifail = ITK_ok;
|
|
|
char* pathname = NULL;
|
|
|
IMF_ask_file_pathname2(ref_object, SS_WNT_MACHINE, &pathname);
|
|
|
char* origin_file_name = NULL;
|
|
|
IMF_ask_original_file_name2(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] = "\0";
|
|
|
strcpy(temp_file, temp_dir);
|
|
|
strcat(temp_file, "\\");
|
|
|
strcat(temp_file, value);
|
|
|
/*if (strstr(temp_file, ".docx") != NULL) {
|
|
|
char temp_file_temp[SS_MAXPATHLEN] = "\0";
|
|
|
strncpy(temp_file_temp, temp_file, strlen(temp_file) - 5);
|
|
|
sprintf(temp_file2, "%s.pdf", temp_file_temp);
|
|
|
}
|
|
|
else if (strstr(temp_file, ".docm") != NULL) {
|
|
|
char temp_file_temp[SS_MAXPATHLEN] = "\0";
|
|
|
strncpy(temp_file_temp, temp_file, strlen(temp_file) - 5);
|
|
|
sprintf(temp_file2, "%s.pdf", temp_file_temp);
|
|
|
}
|
|
|
else if (strstr(temp_file, ".doc") != NULL) {
|
|
|
char temp_file_temp[SS_MAXPATHLEN] = "\0";
|
|
|
strncpy(temp_file_temp, temp_file, strlen(temp_file) - 4);
|
|
|
sprintf(temp_file2, "%s.pdf", temp_file_temp);
|
|
|
}
|
|
|
else {
|
|
|
sprintf(temp_file2, "%s.pdf", temp_file);
|
|
|
}*/
|
|
|
|
|
|
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, "C:\\<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD><EFBFBD>\\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);
|
|
|
Sleep(1000);
|
|
|
//printf("\n8888888888888\n");
|
|
|
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_name2(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_tag2(spec_dataset_rev, ref_name, ref_object);
|
|
|
|
|
|
AE_add_dataset_named_ref2(spec_dataset_rev, ref_name, AE_PART_OF, new_file_tag);
|
|
|
AOM_save(spec_dataset_rev);
|
|
|
AOM_unlock(spec_dataset_rev);
|
|
|
|
|
|
if (remove(temp_file) == 0) {
|
|
|
printf("Removed %s.", temp_file);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
printf("ɾ<EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD> %s.", temp_file);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
return ITK_ok;
|
|
|
}
|
|
|
|
|
|
int signoff_msexcel(tag_t item_rev_tag, tag_t dataset, tag_t rel_tag, char* dat_file, char* ext)
|
|
|
{
|
|
|
tag_t spec_dataset_rev = NULLTAG,
|
|
|
ref_object = NULLTAG,
|
|
|
owner_user = NULLTAG;
|
|
|
int ifail = ITK_ok;
|
|
|
char* value = NULL;
|
|
|
|
|
|
AE_reference_type_t reference_type;
|
|
|
|
|
|
AE_ask_dataset_latest_rev(dataset, &spec_dataset_rev);
|
|
|
AOM_ask_value_string(dataset, "object_name", &value);
|
|
|
AOM_ask_owner(dataset, &owner_user);
|
|
|
|
|
|
char ref_name[WSO_name_size_c + 1] = "excel";
|
|
|
ITKCALL(AE_ask_dataset_named_ref2(spec_dataset_rev, ref_name, &reference_type, &ref_object));
|
|
|
if (reference_type == AE_PART_OF)
|
|
|
{
|
|
|
char* pathname = NULL;
|
|
|
IMF_ask_file_pathname2(ref_object, SS_WNT_MACHINE, &pathname);
|
|
|
char* origin_file_name = NULL;
|
|
|
IMF_ask_original_file_name2(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] = "";
|
|
|
char temp_file2[SS_MAXPATHLEN] = "\0";
|
|
|
strcpy(temp_file, temp_dir);
|
|
|
strcat(temp_file, "\\");
|
|
|
strcat(temp_file, value);
|
|
|
|
|
|
/*if (strstr(temp_file, ".xlsx") != NULL) {
|
|
|
char temp_file_temp[SS_MAXPATHLEN] = "\0";
|
|
|
strncpy(temp_file_temp, temp_file, strlen(temp_file) - 5);
|
|
|
sprintf(temp_file2, "%s.pdf", temp_file_temp);
|
|
|
}
|
|
|
else if (strstr(temp_file, ".xls") != NULL) {
|
|
|
char temp_file_temp[SS_MAXPATHLEN] = "\0";
|
|
|
strncpy(temp_file_temp, temp_file, strlen(temp_file) - 4);
|
|
|
sprintf(temp_file2, "%s.pdf", temp_file_temp);
|
|
|
}
|
|
|
else if (strstr(temp_file, ".xlsm") != NULL) {
|
|
|
char temp_file_temp[SS_MAXPATHLEN] = "\0";
|
|
|
strncpy(temp_file_temp, temp_file, strlen(temp_file) - 5);
|
|
|
sprintf(temp_file2, "%s.pdf", temp_file_temp);
|
|
|
}
|
|
|
else {
|
|
|
sprintf(temp_file2, "%s.pdf", temp_file);
|
|
|
}*/
|
|
|
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, "C:\\<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD><EFBFBD>\\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);
|
|
|
|
|
|
Sleep(1000);
|
|
|
/*strcpy(cmd, "java -jar C:\\<5C><><EFBFBD><EFBFBD>ǩ<EFBFBD><C7A9>\\exceltopdf.jar");
|
|
|
strcat(cmd, " \"");
|
|
|
strcat(cmd, temp_file);
|
|
|
strcat(cmd, "\" \"");
|
|
|
strcat(cmd, temp_file2);
|
|
|
strcat(cmd, "\"");
|
|
|
printf("\n%s\n", cmd);
|
|
|
system(cmd);*/
|
|
|
//printf("\n8888888888888\n");
|
|
|
|
|
|
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_name2(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_tag2(spec_dataset_rev, ref_name, ref_object);
|
|
|
|
|
|
AE_add_dataset_named_ref2(spec_dataset_rev, ref_name, AE_PART_OF, new_file_tag);
|
|
|
AOM_save(spec_dataset_rev);
|
|
|
AOM_unlock(spec_dataset_rev);
|
|
|
|
|
|
if (remove(temp_file) == 0) {
|
|
|
printf("Removed %s.", temp_file);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
printf("ɾ<EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD> %s.", temp_file);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return ITK_ok;
|
|
|
}
|
|
|
|
|
|
int BH_Mapping_Att(EPM_action_message_t msg)
|
|
|
{
|
|
|
int ifail = ITK_ok, rcode = 0;
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
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;
|
|
|
//<2F><><EFBFBD>̽ڵ<CCBD><DAB5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
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 = NULL;
|
|
|
////ѭ<><D1AD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD>
|
|
|
tag_t cur_task = NULLTAG;
|
|
|
char task_type[WSO_name_size_c + 1] = "";
|
|
|
//ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
int i = 0, j = 0, k = 0, count = 0, n = 0;
|
|
|
//<2F>ڵ<EFBFBD><DAB5><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
|
|
char sign_info[2048] = "";
|
|
|
//<2F>ڵ<EFBFBD>ѭ<EFBFBD><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
tag_t itemrevision = NULLTAG, master_form_rel_type = NULLTAG, item = NULLTAG;
|
|
|
char* rev_id = NULL;
|
|
|
char* item_id = NULL;
|
|
|
char* item_type2 = NULL;
|
|
|
int form_count = 0;
|
|
|
tag_t* form_list = NULL, master_form = NULLTAG, * release = NULL;
|
|
|
char local_path[128] = "";
|
|
|
//<2F><><EFBFBD>ƽڵ<C6BD>
|
|
|
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";
|
|
|
//<2F><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>
|
|
|
int n_prop = 0, q = 0, num = 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] = "", Property[128] = "", Item_type[128] = "", dataset_type[128] = "";
|
|
|
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("LB_signoff_dataset <20><>ʼִ<CABC><D6B4>\n");
|
|
|
ECHO("=========================================================\n");
|
|
|
struct tm* p;
|
|
|
char date_string[2000];
|
|
|
time_t now;
|
|
|
time(&now);
|
|
|
p = localtime(&now);
|
|
|
sprintf(date_string, "%4d-%d-%-d %d:%d:%d", 1900 + p->tm_year, p->tm_mon + 1, p->tm_mday, p->tm_hour, p->tm_min, p->tm_sec);
|
|
|
ECHO("ʱ<EFBFBD><EFBFBD>:%s\n", date_string);
|
|
|
|
|
|
arg_cnt = TC_number_of_arguments(msg.arguments);
|
|
|
ECHO("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>%d\n", arg_cnt);
|
|
|
POM_AM__set_application_bypass(true);
|
|
|
vector<string> ans, ans1, typelx;
|
|
|
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, "Item_type") == 0)
|
|
|
{
|
|
|
if (argvalue != NULL)
|
|
|
{
|
|
|
strcpy(Item_type, argvalue);
|
|
|
}
|
|
|
}
|
|
|
else if (strcmp(argflag, "Property") == 0)
|
|
|
{
|
|
|
|
|
|
if (argvalue != NULL) {
|
|
|
strcpy(Property, argvalue);
|
|
|
Split(argvalue, ";", ans);
|
|
|
}
|
|
|
}
|
|
|
else if (stricmp(argflag, "dataset_type") == 0)
|
|
|
{
|
|
|
if (argvalue != NULL) {
|
|
|
strcpy(dataset_type, argvalue);
|
|
|
Split(argvalue, ";", typelx);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
MEM_free(argflag);
|
|
|
MEM_free(argvalue);
|
|
|
}
|
|
|
tag_t sx = NULLTAG;
|
|
|
PROP_value_type_t a;
|
|
|
char* valuetype, * object_name;
|
|
|
ECHO("item_type:%s\n", Item_type);
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|
|
ECHO("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
ITKCALL(EPM_ask_root_task(msg.task, &root_task));
|
|
|
ITKCALL(EPM_ask_sub_tasks(root_task, &sub_task_count, &sub_tasks));
|
|
|
ITKCALL(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_name2(type_tag, &type_class);
|
|
|
ECHO("type_class : %s", type_class);
|
|
|
//<2F><><EFBFBD>˵<EFBFBD><CBB5>ǰ汾<C7B0><E6B1BE><EFBFBD><EFBFBD>
|
|
|
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_id2(itemrevision, &rev_id);
|
|
|
ITEM_ask_rev_type2(itemrevision, &item_type2);
|
|
|
ECHO("item_type====================================%s", item_type);
|
|
|
ITEM_ask_item_of_rev(itemrevision, &item);
|
|
|
ITEM_ask_id2(item, &item_id);
|
|
|
|
|
|
if (strcmp(Item_type, "Item") == 0)
|
|
|
{
|
|
|
|
|
|
for (int i = 0; i < ans.size(); i++)
|
|
|
{
|
|
|
ITKCALL(AOM_ask_value_type(item, ans[i].c_str(), &a, &valuetype));
|
|
|
ECHO("PROP_value_type_t2 a=%d\n", a);
|
|
|
if (a == 8)
|
|
|
{
|
|
|
AOM_ask_value_string(item, ans[i].c_str(), &object_name);
|
|
|
ans1.push_back(object_name);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else if (strcmp(Item_type, "ItemRevision") == 0)
|
|
|
{
|
|
|
for (int i = 0; i < ans.size(); i++)
|
|
|
{
|
|
|
ITKCALL(AOM_ask_value_type(itemrevision, ans[i].c_str(), &a, &valuetype));
|
|
|
ECHO("PROP_value_type_t2 a=%d\n", a);
|
|
|
if (a == 8)
|
|
|
{
|
|
|
AOM_ask_value_string(itemrevision, ans[i].c_str(), &object_name);
|
|
|
ans1.push_back(object_name);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else if (strcmp(Item_type, "ItemRevisionMaster") == 0)
|
|
|
{
|
|
|
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("δ<EFBFBD>ҵ<EFBFBD>ǩ<EFBFBD><EFBFBD>form,<2C><><EFBFBD><EFBFBD>...");
|
|
|
continue;
|
|
|
}
|
|
|
master_form = form_list[0];
|
|
|
for (int i = 0; i < ans.size(); i++)
|
|
|
{
|
|
|
ITKCALL(AOM_ask_value_type(master_form, ans[i].c_str(), &a, &valuetype));
|
|
|
ECHO("PROP_value_type_t2 a=%d\n", a);
|
|
|
if (a == 8)
|
|
|
{
|
|
|
AOM_ask_value_string(master_form, ans[i].c_str(), &object_name);
|
|
|
ans1.push_back(object_name);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
string info;
|
|
|
for (int j = 0; j < ans1.size(); j++)
|
|
|
{
|
|
|
info.append(ans[j]);
|
|
|
info.append("=");
|
|
|
info.append(ans1[j]);
|
|
|
info.append("|");
|
|
|
}
|
|
|
ECHO("\n info1: %s", info.c_str());
|
|
|
char* data_file1 = NULL;
|
|
|
create_signinfo_file((char*)info.c_str(), item_id, &data_file1);
|
|
|
if (data_file1 == NULL)
|
|
|
{
|
|
|
printf("<EFBFBD>ɹ<EFBFBD>");
|
|
|
}
|
|
|
ECHO("\n <20><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1>ļ<EFBFBD>%s\n", data_file1);
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>
|
|
|
tag_t relation_type = NULLTAG;
|
|
|
tag_t relation_type1 = NULLTAG;
|
|
|
//tag_t attach_relation_type = NULLTAG;
|
|
|
GRM_find_relation_type(TC_specification_rtype, &relation_type);
|
|
|
tag_t* secondary_objects = NULLTAG;
|
|
|
tag_t* secondary_objects1 = NULLTAG;
|
|
|
int ds_count = 0;
|
|
|
int ds_count1 = 0;
|
|
|
char* dataset_type1 = NULL, * desc_value = NULL, * file_path = NULL, * desc_path;
|
|
|
|
|
|
//GRM_list_secondary_objects_only(itemrevision, relation_type, &ds_count, &secondary_objects);
|
|
|
ITKCALL(AOM_ask_value_tags(itemrevision, TC_specification_rtype, &ds_count, &secondary_objects));
|
|
|
for (int j = 0; j < ds_count; j++)
|
|
|
{
|
|
|
printf("<EFBFBD><EFBFBD>1\n");
|
|
|
AOM_ask_value_string(secondary_objects[j], "object_type", &dataset_type1);
|
|
|
int des_count = 0;
|
|
|
tag_t* dess = NULL;
|
|
|
char* name;
|
|
|
if (typelx.size() > 1)
|
|
|
{
|
|
|
if (!(strcmp(dataset_type1, "MSWord") == 0 ||
|
|
|
strcmp(dataset_type1, "MSWordX") == 0 ||
|
|
|
strcmp(dataset_type1, "MSExcel") == 0 ||
|
|
|
strcmp(dataset_type1, "MSExcelX") == 0)) {
|
|
|
if (dataset_type1 != NULL) {
|
|
|
MEM_free(dataset_type1);
|
|
|
dataset_type1 = NULL;
|
|
|
}
|
|
|
continue;
|
|
|
}
|
|
|
AOM_ask_value_tags(secondary_objects[j], "ref_list", &des_count, &dess);
|
|
|
if (des_count < 1) {
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
continue;
|
|
|
}
|
|
|
printf("<EFBFBD><EFBFBD>ʼ<EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
if (strcmp(dataset_type1, "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("<22><>Ϊdocx<63><78>xlsx<73>˳<EFBFBD>\n");
|
|
|
continue;
|
|
|
}*/
|
|
|
signoff_msword(itemrevision, secondary_objects[j], relation_type, data_file1, "doc");
|
|
|
}
|
|
|
else if (strcmp(dataset_type1, "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("<22><>Ϊdocx<63><78>xlsx<73>˳<EFBFBD>\n");
|
|
|
continue;
|
|
|
}*/
|
|
|
if ((strstr(name, "docx")) != NULL) {
|
|
|
signoff_msword(itemrevision, secondary_objects[j], relation_type, data_file1, "docx");
|
|
|
}
|
|
|
if ((strstr(name, "docm")) != NULL) {
|
|
|
signoff_msword(itemrevision, secondary_objects[j], relation_type, data_file1, "docm");
|
|
|
}
|
|
|
}else if (strcmp(dataset_type1, "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("<22><>Ϊdocx<63><78>xlsx<73>˳<EFBFBD>\n");
|
|
|
continue;
|
|
|
}*/
|
|
|
signoff_msexcel(itemrevision, secondary_objects[j], relation_type, data_file1, "xls");
|
|
|
}
|
|
|
else if (strcmp(dataset_type1, "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("<22><>Ϊdocx<63><78>xlsx<73>˳<EFBFBD>\n");
|
|
|
continue;
|
|
|
}*/
|
|
|
if ((strstr(name, "xlsx")) != NULL) {
|
|
|
signoff_msexcel(itemrevision, secondary_objects[j], relation_type, data_file1, "xlsx");
|
|
|
}
|
|
|
if ((strstr(name, "xlsm")) != NULL) {
|
|
|
signoff_msexcel(itemrevision, secondary_objects[j], relation_type, data_file1, "xlsm");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (strcmp(dataset_type, "word") == 0)
|
|
|
{
|
|
|
if (!(strcmp(dataset_type1, "MSWord") == 0 || strcmp(dataset_type1, "MSWordX") == 0))
|
|
|
{
|
|
|
if (dataset_type1 != NULL) {
|
|
|
MEM_free(dataset_type1);
|
|
|
dataset_type1 = NULL;
|
|
|
}
|
|
|
continue;
|
|
|
}
|
|
|
AOM_ask_value_tags(secondary_objects[j], "ref_list", &des_count, &dess);
|
|
|
if (des_count < 1) {
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
continue;
|
|
|
}
|
|
|
printf("<EFBFBD><EFBFBD>ʼ<EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
if (strcmp(dataset_type1, "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("<22><>Ϊdocx<63><78>xlsx<73>˳<EFBFBD>\n");
|
|
|
continue;
|
|
|
}*/
|
|
|
signoff_msword(itemrevision, secondary_objects[j], relation_type, data_file1, "doc");
|
|
|
}
|
|
|
else if (strcmp(dataset_type1, "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("<22><>Ϊdocx<63><78>xlsx<73>˳<EFBFBD>\n");
|
|
|
continue;
|
|
|
}*/
|
|
|
if ((strstr(name, "docx")) != NULL) {
|
|
|
signoff_msword(itemrevision, secondary_objects[j], relation_type, data_file1, "docx");
|
|
|
}
|
|
|
if ((strstr(name, "docm")) != NULL) {
|
|
|
signoff_msword(itemrevision, secondary_objects[j], relation_type, data_file1, "docm");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else if (strcmp(dataset_type, "excel") == 0)
|
|
|
{
|
|
|
if (!(strcmp(dataset_type1, "MSExcel") == 0 || strcmp(dataset_type1, "MSExcelX") == 0))
|
|
|
{
|
|
|
if (dataset_type1 != NULL) {
|
|
|
MEM_free(dataset_type1);
|
|
|
dataset_type1 = NULL;
|
|
|
}
|
|
|
continue;
|
|
|
}
|
|
|
AOM_ask_value_tags(secondary_objects[j], "ref_list", &des_count, &dess);
|
|
|
if (des_count < 1) {
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
continue;
|
|
|
}
|
|
|
printf("<EFBFBD><EFBFBD>ʼ<EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
if (strcmp(dataset_type1, "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("<22><>Ϊdocx<63><78>xlsx<73>˳<EFBFBD>\n");
|
|
|
continue;
|
|
|
}*/
|
|
|
signoff_msexcel(itemrevision, secondary_objects[j], relation_type, data_file1, "xls");
|
|
|
}
|
|
|
else if (strcmp(dataset_type1, "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("<22><>Ϊdocx<63><78>xlsx<73>˳<EFBFBD>\n");
|
|
|
continue;
|
|
|
}*/
|
|
|
if ((strstr(name, "xlsx")) != NULL) {
|
|
|
signoff_msexcel(itemrevision, secondary_objects[j], relation_type, data_file1, "xlsx");
|
|
|
}
|
|
|
if ((strstr(name, "xlsm")) != NULL) {
|
|
|
signoff_msexcel(itemrevision, secondary_objects[j], relation_type, data_file1, "xlsm");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
POM_AM__set_application_bypass(false);
|
|
|
DOFREE(taskAttches);
|
|
|
ECHO("=========================================================\n");
|
|
|
ECHO("jf_signoff_dataset ִ<>н<EFBFBD><D0BD><EFBFBD>\n");
|
|
|
ECHO("=========================================================\n");
|
|
|
return rcode;
|
|
|
}
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֲ
|
|
|
int Connor_Data_Transplant(EPM_action_message_t msg) {
|
|
|
|
|
|
ECHO("=========================================================\n");
|
|
|
ECHO("Connor_Data_Transplant <20><>ʼִ<CABC><D6B4>\n");
|
|
|
ECHO("=========================================================\n");
|
|
|
int ifail = ITK_ok, rcode = 0;
|
|
|
tag_t task_tag = NULLTAG;
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD>Ǹ<EFBFBD>ʲô<CAB2><C3B4>
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD>\n");
|
|
|
POM_AM__set_application_bypass(true);
|
|
|
task_tag = msg.task;
|
|
|
if (task_tag == NULLTAG) {
|
|
|
goto end;
|
|
|
}
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>
|
|
|
tag_t* flowTargets = NULLTAG;
|
|
|
int targetNum = 0;
|
|
|
ITKCALL(ifail = AOM_ask_value_tags(task_tag, "root_target_attachments", &targetNum, &flowTargets));
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
tag_t* flowReferences = NULLTAG;
|
|
|
int referenceNum = 0;
|
|
|
ITKCALL(ifail = AOM_ask_value_tags(task_tag, "root_reference_attachments", &referenceNum, &flowReferences));
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
char* reference_type = NULL;
|
|
|
ITKCALL(ifail = AOM_ask_value_string(flowReferences[0], "object_type", &reference_type));
|
|
|
|
|
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
//tag_t* uploadDataSets = NULLTAG;
|
|
|
//int dataCount = 0;
|
|
|
//ITKCALL(ifail = AOM_ask_value_tags(flowTargets[0], "contents", &dataCount, &uploadDataSets));//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD>ݼ<EFBFBD>
|
|
|
if (targetNum > 0) {
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>ʱ<EFBFBD>ļ<EFBFBD><C4BC>ж<EFBFBD><D0B6><EFBFBD>
|
|
|
char* value;
|
|
|
char* folderUID;
|
|
|
ITKCALL(PREF_ask_char_value("BH_Upload_USER", 0, &value));//<2F><>ȡ<EFBFBD><C8A1>ѡ<EFBFBD><D1A1><EFBFBD>ĵ<EFBFBD>һ<EFBFBD><D2BB>ֵ
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>|<7C>ָ<EFBFBD><D6B8>ĵڶ<C4B5><DAB6><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
|
|
const char* d = "|";
|
|
|
if (value != NULL) {
|
|
|
folderUID = strtok(value, d);
|
|
|
folderUID = strtok(NULL, d);
|
|
|
}
|
|
|
else {
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD>Ϊ<EFBFBD>丳ֵ\n");
|
|
|
goto end;
|
|
|
}
|
|
|
tag_t temp_folder;
|
|
|
ITK__convert_uid_to_tag(folderUID, &temp_folder);
|
|
|
|
|
|
for (int i = 0; i < targetNum; i++) {
|
|
|
//tag_t temp_test;
|
|
|
//ITK__convert_uid_to_tag("wJtJGAvXpVL7kA", &temp_test);
|
|
|
//ת<><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ
|
|
|
tag_t user_tag, group_tag;
|
|
|
ITKCALL(ifail = AOM_ask_value_tag(flowReferences[0], "owning_user", &user_tag));//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD>û<EFBFBD>
|
|
|
ITKCALL(ifail = AOM_ask_value_tag(flowReferences[0], "owning_group", &group_tag));
|
|
|
|
|
|
ITKCALL(AOM_lock(flowTargets[i]));
|
|
|
if (group_tag == NULLTAG) {
|
|
|
ITKCALL(POM_set_owning_user(flowTargets[i], user_tag));
|
|
|
}
|
|
|
else {
|
|
|
AOM_set_ownership(flowTargets[i], user_tag, group_tag);
|
|
|
//AOM_set_ownership(temp_test, user_tag, group_tag);
|
|
|
/*ITKCALL(POM_set_owning_user(flowTargets[i], user_tag));
|
|
|
ITKCALL(POM_set_owning_group(flowTargets[i], group_tag));*/
|
|
|
//ITKCALL(POM_set_owners(1, &flowTargets[i], user_tag, group_tag));
|
|
|
//ITKCALL(POM_set_owners(1, &temp_test, user_tag, group_tag));
|
|
|
|
|
|
}
|
|
|
AOM_save(flowTargets[i]);
|
|
|
ITKCALL(AOM_unlock(flowTargets[i]));
|
|
|
ITKCALL(ifail = AOM_refresh(flowTargets[i], FALSE));
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>ļ<EFBFBD><C4BC>еĹ<D0B5>ϵ,<2C><><EFBFBD><EFBFBD>ʱ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD>
|
|
|
FL_remove(temp_folder, flowTargets[i]);
|
|
|
AOM_save(temp_folder);
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
|
|
AOM_set_value_string(flowTargets[i], "object_desc", "");
|
|
|
|
|
|
//<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õĶ<C3B5><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
tag_t typeTag = NULLTAG, relationTag = NULLTAG;
|
|
|
if (strstr(reference_type, "Folder") != NULL) {
|
|
|
//ITKCALL(GRM_find_relation_type("contents", &typeTag));
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µĶ<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
FL_insert(flowReferences[0], flowTargets[i], 999);
|
|
|
AOM_save(flowReferences[0]);
|
|
|
//AOM_refresh(flowReferences[0],0);
|
|
|
}
|
|
|
else {
|
|
|
ITKCALL(GRM_find_relation_type("IMAN_specification", &typeTag));
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µĶ<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>汾\n");
|
|
|
ITKCALL(GRM_create_relation(flowReferences[0], flowTargets[i], typeTag, NULLTAG, &relationTag));//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ
|
|
|
ITKCALL(GRM_save_relation(relationTag));//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ
|
|
|
}
|
|
|
|
|
|
}
|
|
|
//ˢ<><CBA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>ļ<EFBFBD><C4BC>ж<EFBFBD><D0B6><EFBFBD>
|
|
|
ITKCALL(ifail = AOM_refresh(temp_folder, FALSE));
|
|
|
ITKCALL(ifail = AOM_refresh(flowReferences[0], FALSE));
|
|
|
|
|
|
}
|
|
|
DOFREE(flowTargets);
|
|
|
DOFREE(flowReferences);
|
|
|
|
|
|
printf("ִ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
printf("<EFBFBD>س<EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD>\n");
|
|
|
POM_AM__set_application_bypass(false);
|
|
|
end:
|
|
|
ECHO("=========================================================\n");
|
|
|
ECHO("Connor_Data_Transplant ִ<>н<EFBFBD><D0BD><EFBFBD>\n");
|
|
|
ECHO("=========================================================\n");
|
|
|
return rcode;
|
|
|
|
|
|
}
|
|
|
|
|
|
|