|
|
#pragma warning (disable: 4996)
|
|
|
#pragma warning (disable: 4819)
|
|
|
#pragma warning (disable: 4995)
|
|
|
|
|
|
#include <tc/tc.h>
|
|
|
#include "epm_handler_common.h"
|
|
|
|
|
|
#include <ict/ict_userservice.h>
|
|
|
#include <tccore/custom.h>
|
|
|
#include <epm/epm_toolkit_tc_utils.h>
|
|
|
#include <tccore/aom.h>
|
|
|
#include <tccore/aom_prop.h>
|
|
|
#include <tccore/item.h>
|
|
|
#include <bom/bom.h>
|
|
|
#include "ps/ps.h";
|
|
|
#include "ps/vrule.h"
|
|
|
#include "sstream"
|
|
|
#include <tccore/grm.h>
|
|
|
#include "epm/epm.h"
|
|
|
#include "sa/sa.h"
|
|
|
#include "libxl.h"
|
|
|
#include <map>
|
|
|
#include "epm/signoff.h"
|
|
|
#include <ctime>
|
|
|
#include <vector>
|
|
|
#include <locale>
|
|
|
#include <codecvt>
|
|
|
#include "ae/dataset.h"
|
|
|
#include <iostream>
|
|
|
#include <stdlib.h>
|
|
|
#include <tccore/aom.h>
|
|
|
#include <tc/emh.h>
|
|
|
#include <ict/ict_userservice.h>
|
|
|
#include <tc/tc.h>
|
|
|
#include <tccore/tctype.h>
|
|
|
#include <sa/tcfile.h>
|
|
|
#include <ss/ss_errors.h>
|
|
|
#include <ae/datasettype.h>
|
|
|
// #include "hx_custom.h"
|
|
|
// #include "jk_custom.h"
|
|
|
#include "util.h"
|
|
|
|
|
|
void get_current_time(char *date_time)
|
|
|
{
|
|
|
time_t the_time;
|
|
|
struct tm *time_ptr;
|
|
|
char *time_format = "%Y-%m-%d %H-%M-%S ";
|
|
|
|
|
|
the_time = time((time_t *)0);
|
|
|
time_ptr = localtime(&the_time);
|
|
|
strftime(date_time, 128, time_format, time_ptr);
|
|
|
}
|
|
|
// 把char *转换为TCHAR *或WCHAR *
|
|
|
TCHAR convertTemp3[256] = { 0 };
|
|
|
TCHAR convertTemp4[256] = { 0 };
|
|
|
bool convertBufferSwitch2(false);
|
|
|
TCHAR* Char2Tchar(const char* str, int len)
|
|
|
{
|
|
|
#ifdef _UNICODE
|
|
|
TCHAR* temp = convertBufferSwitch2 ? convertTemp3 : convertTemp4;
|
|
|
convertBufferSwitch2 = !convertBufferSwitch2;
|
|
|
memset(temp, 0, sizeof(convertTemp3));
|
|
|
MultiByteToWideChar(CP_UTF8, 0, str, len, temp, 256);
|
|
|
return temp;
|
|
|
#else
|
|
|
return str;
|
|
|
#endif
|
|
|
}
|
|
|
int create_dataset(char *type_name, const char *name, tag_t excelTag)
|
|
|
{
|
|
|
|
|
|
// cout<<"添加命名引用------------------"<<endl;
|
|
|
tag_t spec_dataset_rev = NULLTAG,
|
|
|
ref_object = NULLTAG;
|
|
|
AE_reference_type_t reference_type;
|
|
|
ITKCALL(AE_ask_dataset_latest_rev(excelTag, &spec_dataset_rev));//获得数据集的最新版本
|
|
|
char ref_name[WSO_name_size_c + 1] = "excel";
|
|
|
ITKCALL(AE_ask_dataset_named_ref(spec_dataset_rev, ref_name, &reference_type, &ref_object));//获得数据集命名引用的文件对象
|
|
|
|
|
|
// cout<<"开始添加----------------"<<endl;
|
|
|
//pdf的系统路径
|
|
|
char *temp_dir = getenv("temp");//获得缓存路径
|
|
|
|
|
|
char output_file[SS_MAXPATHLEN] = "";
|
|
|
strcpy(output_file, temp_dir);
|
|
|
strcat(output_file, "\\");
|
|
|
// strcat(output_file, newDatasetName.c_str());
|
|
|
strcat(output_file, name);
|
|
|
|
|
|
// cout<<"名称-----------"<<name<<endl;
|
|
|
tag_t new_file_tag1 = NULLTAG;
|
|
|
IMF_file_t file_descriptor1;
|
|
|
int ifail = 0;
|
|
|
ITKCALL(ifail = IMF_import_file(output_file, name, SS_BINARY, &new_file_tag1, &file_descriptor1));//将缓存路径下生成的文件导入tc,获得tc中的这个文件对象
|
|
|
// ITKCALL(ifail=IMF_set_original_file_name(new_file_tag1, origin_file_name));//设置文件对象的数据集的原始文件名称
|
|
|
ITKCALL(ifail = IMF_set_original_file_name(new_file_tag1, name));//设置文件对象的数据集的原始文件名称
|
|
|
ITKCALL(ifail = IMF_close_file(file_descriptor1));
|
|
|
ITKCALL(ifail = AOM_save(new_file_tag1));
|
|
|
ITKCALL(ifail = AOM_unlock(new_file_tag1));
|
|
|
|
|
|
ITKCALL(ifail = AOM_lock(spec_dataset_rev));
|
|
|
ITKCALL(ifail = AE_remove_dataset_named_ref_by_tag(spec_dataset_rev, ref_name, ref_object));//删除数据集的命名引用对象
|
|
|
ITKCALL(ifail = AE_add_dataset_named_ref(spec_dataset_rev, ref_name, AE_PART_OF, new_file_tag1));
|
|
|
ITKCALL(ifail = AOM_save(spec_dataset_rev));
|
|
|
ITKCALL(ifail = AOM_unlock(spec_dataset_rev));
|
|
|
|
|
|
ITKCALL(AOM_save(excelTag));
|
|
|
return 0;
|
|
|
}
|
|
|
string GenerateGuid()
|
|
|
{
|
|
|
GUID guid;
|
|
|
CoCreateGuid(&guid);
|
|
|
char cBuffer[64] = { 0 };
|
|
|
sprintf_s(cBuffer, sizeof(cBuffer),
|
|
|
"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
|
|
|
guid.Data1, guid.Data2,
|
|
|
guid.Data3, guid.Data4[0],
|
|
|
guid.Data4[1], guid.Data4[2],
|
|
|
guid.Data4[3], guid.Data4[4],
|
|
|
guid.Data4[5], guid.Data4[6],
|
|
|
guid.Data4[7]);
|
|
|
return string(cBuffer);
|
|
|
}
|
|
|
|
|
|
|
|
|
int writeToExcel(int page, tag_t excelTag, const char *zt2_Design, const char *zt2_DesignTime, const char *zt2_Proofread,
|
|
|
const char *zt2_ProofreadTime, const char *zt2_Normalization,
|
|
|
const char *zt2_NormalizationTime, const char *zt2_Review, const char *zt2_ReviewTime,
|
|
|
const char *zt2_Approve, const char *zt2_ApproveTime)
|
|
|
{
|
|
|
int ifail = 0;
|
|
|
libxl::Book* book = nullptr;
|
|
|
book = xlCreateBook();//xls文件用xlCreateBook() 函数打开,xlsx文件是xml结构,所以得用xlCreateXMLBook() 函数来打开。
|
|
|
book->setKey(L"Halil Kural", L"windows-2723210a07c4e90162b26966a8jcdboe");//如果购买了该库,则设置相应的key,若没有购买,则不用这行
|
|
|
// book->setKey(L"TommoT", L"windows-2421220b07c2e10a6eb96768a2p7r6gc");//新版
|
|
|
int n_refs = 0;
|
|
|
tag_t* refs = NULL;
|
|
|
|
|
|
ifail = AE_ask_all_dataset_named_refs(excelTag, "excel", &n_refs, &refs);
|
|
|
if (ifail != ITK_ok) { /* your error logic here */ }
|
|
|
|
|
|
char current_date_time_str[128 + 1] = { "\0" };
|
|
|
get_current_time(current_date_time_str);
|
|
|
|
|
|
|
|
|
string time_now = current_date_time_str;
|
|
|
string sGuid = GenerateGuid();
|
|
|
string datasetName = time_now;
|
|
|
datasetName = datasetName.append(sGuid);
|
|
|
datasetName = datasetName.append(".xls");
|
|
|
time_now = getenv("temp");
|
|
|
time_now = time_now.append("\\").append(datasetName);
|
|
|
|
|
|
cout << "文件路径----------" << time_now << endl;
|
|
|
cout << "-------1----------" << endl;
|
|
|
ifail = AE_export_named_ref(excelTag, "excel", time_now.c_str());
|
|
|
cout << "--------2---------" << endl;
|
|
|
if (ifail != ITK_ok) { /* your error logic here */ }
|
|
|
//检查是否存在单元格名称为“xxxx”
|
|
|
wstringstream excel_path;
|
|
|
|
|
|
// excel_path<<"C:\\TEMP\\export_text.xls";
|
|
|
excel_path << time_now.c_str();
|
|
|
cout << "--------3---------" << endl;
|
|
|
libxl::Sheet* sheet = NULL;
|
|
|
cout << "---------4--------" << endl;
|
|
|
if (book->load(excel_path.str().c_str()))
|
|
|
{
|
|
|
sheet = book->getSheet(0);//获得第1个sheet页
|
|
|
|
|
|
}
|
|
|
|
|
|
cout << "--------5---------" << endl;
|
|
|
//写到表格中
|
|
|
TCHAR array2[100];
|
|
|
cout << "---------6--------" << endl;
|
|
|
cout << "---------page--------" <<page<< endl;
|
|
|
if (page == 0)
|
|
|
{
|
|
|
cout << "---------page=0--------" << endl;
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_Design, -1, array2, 100);
|
|
|
sheet->writeStr(21, 6, array2);
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_DesignTime, -1, array2, 100);
|
|
|
sheet->writeStr(22, 6, array2);
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_Proofread, -1, array2, 100);
|
|
|
sheet->writeStr(21, 9, array2);
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_ProofreadTime, -1, array2, 100);
|
|
|
sheet->writeStr(22, 9, array2);
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_Normalization, -1, array2, 100);
|
|
|
sheet->writeStr(21, 10, array2);
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_NormalizationTime, -1, array2, 100);
|
|
|
sheet->writeStr(22, 10, array2);
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_Review, -1, array2, 100);
|
|
|
sheet->writeStr(21, 12, array2);
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_ReviewTime, -1, array2, 100);
|
|
|
sheet->writeStr(22, 12, array2);
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_Approve, -1, array2, 100);
|
|
|
sheet->writeStr(21, 14, array2);
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_ApproveTime, -1, array2, 100);
|
|
|
sheet->writeStr(22, 14, array2);
|
|
|
}
|
|
|
cout << "-------7----------" << endl;
|
|
|
for (int i = 0; i<page; i++)
|
|
|
{
|
|
|
cout << "---------page>0--------" << endl;
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_Design, -1, array2, 100);
|
|
|
sheet->writeStr(i * 23 + 21, 6, array2);
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_DesignTime, -1, array2, 100);
|
|
|
sheet->writeStr(i * 23 + 22, 6, array2);
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_Proofread, -1, array2, 100);
|
|
|
sheet->writeStr(i * 23 + 21, 9, array2);
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_ProofreadTime, -1, array2, 100);
|
|
|
sheet->writeStr(i * 23 + 22, 9, array2);
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_Normalization, -1, array2, 100);
|
|
|
sheet->writeStr(i * 23 + 21, 10, array2);
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_NormalizationTime, -1, array2, 100);
|
|
|
sheet->writeStr(i * 23 + 22, 10, array2);
|
|
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_Review, -1, array2, 100);
|
|
|
sheet->writeStr(i * 23 + 21, 12, array2);
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_ReviewTime, -1, array2, 100);
|
|
|
sheet->writeStr(i * 23 + 22, 12, array2);
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_Approve, -1, array2, 100);
|
|
|
sheet->writeStr(i * 23 + 21, 14, array2);
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_ApproveTime, -1, array2, 100);
|
|
|
sheet->writeStr(i * 23 + 22, 14, array2);
|
|
|
}
|
|
|
cout << "---------8--------" << endl;
|
|
|
if (book->save(excel_path.str().c_str()))//保存到example.xls
|
|
|
{
|
|
|
//.....
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
std::cout << book->errorMessage() << std::endl;
|
|
|
}
|
|
|
book->release();//释放对象!!!!
|
|
|
//创建数据集,挂到版本的规范关系下
|
|
|
cout << "---------9--------" << endl;
|
|
|
create_dataset("MSExcel", datasetName.c_str(), excelTag);//数据集类型(object_type),数据集名称,版本
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
wstring StringToWString(const string s)
|
|
|
{
|
|
|
setlocale(LC_ALL, "chs");
|
|
|
const char* _Source = s.c_str();
|
|
|
size_t _Dsize = s.size() + 1;
|
|
|
wchar_t *_Dest = new wchar_t[_Dsize];
|
|
|
wmemset(_Dest, 0, _Dsize);
|
|
|
mbstowcs(_Dest, _Source, _Dsize);
|
|
|
wstring result = _Dest;
|
|
|
delete[]_Dest;
|
|
|
setlocale(LC_ALL, "C");
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
wchar_t* c2w(const char *str)
|
|
|
{
|
|
|
int length = strlen(str) + 1;
|
|
|
wchar_t *t = (wchar_t*)malloc(sizeof(wchar_t)*length);
|
|
|
memset(t, 0, length*sizeof(wchar_t));
|
|
|
MultiByteToWideChar(CP_ACP, 0, str, strlen(str), t, length);
|
|
|
return t;
|
|
|
}
|
|
|
|
|
|
|
|
|
//读取excel单元格内容
|
|
|
string get_excel_data(libxl::Sheet *sheet, int row, int col)
|
|
|
{
|
|
|
string result;
|
|
|
double temp;
|
|
|
try
|
|
|
{
|
|
|
libxl::CellType cell_type = sheet->cellType(row, col);
|
|
|
switch (cell_type)
|
|
|
{
|
|
|
case libxl::CELLTYPE_STRING:
|
|
|
result = WStringToString(sheet->readStr(row, col));
|
|
|
break;
|
|
|
case libxl::CELLTYPE_BLANK:
|
|
|
result = "";
|
|
|
break;
|
|
|
case libxl::CELLTYPE_EMPTY:
|
|
|
result = "";
|
|
|
break;
|
|
|
case libxl::CELLTYPE_NUMBER:
|
|
|
temp = sheet->readNum(row, col);
|
|
|
result = temp == (int)temp ? to_string((int)temp) : to_string(temp);
|
|
|
break;
|
|
|
case libxl::CELLTYPE_BOOLEAN:
|
|
|
result = to_string(sheet->readBool(row, col));
|
|
|
break;
|
|
|
case libxl::CELLTYPE_ERROR:
|
|
|
result = "";
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
catch (exception e)
|
|
|
{
|
|
|
// LERROR<<"col num"<<k<<"error:"<<e.what();
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
int writeToExcel2(int page, tag_t excelTag, const char *zt2_Design, const char *zt2_DesignTime, const char *zt2_Proofread,
|
|
|
const char *zt2_ProofreadTime, const char *zt2_Normalization,
|
|
|
const char *zt2_NormalizationTime, const char *zt2_Review, const char *zt2_ReviewTime,
|
|
|
const char *zt2_Approve, const char *zt2_ApproveTime,
|
|
|
const char *zt2_Technology, char *zt2_TechnologyTime)
|
|
|
{
|
|
|
cout << "writeToExcel2 start" << endl;
|
|
|
int ifail = 0;
|
|
|
libxl::Book* book = nullptr;
|
|
|
book = xlCreateBook();//xls文件用xlCreateBook() 函数打开,xlsx文件是xml结构,所以得用xlCreateXMLBook() 函数来打开。
|
|
|
book->setKey(L"Halil Kural", L"windows-2723210a07c4e90162b26966a8jcdboe");//如果购买了该库,则设置相应的key,若没有购买,则不用这行
|
|
|
// book->setKey(L"TommoT", L"windows-2421220b07c2e10a6eb96768a2p7r6gc");//新版
|
|
|
int n_refs = 0;
|
|
|
tag_t* refs = NULL;
|
|
|
|
|
|
ifail = AE_ask_all_dataset_named_refs(excelTag, "excel", &n_refs, &refs);
|
|
|
if (ifail != ITK_ok) { /* your error logic here */ }
|
|
|
|
|
|
char current_date_time_str[128 + 1] = { "\0" };
|
|
|
get_current_time(current_date_time_str);
|
|
|
|
|
|
|
|
|
string time_now = current_date_time_str;
|
|
|
string sGuid = GenerateGuid();
|
|
|
string datasetName = time_now;
|
|
|
datasetName = datasetName.append(sGuid);
|
|
|
datasetName = datasetName.append(".xls");
|
|
|
time_now = getenv("temp");
|
|
|
time_now = time_now.append("\\").append(datasetName);
|
|
|
|
|
|
cout << "文件路径----------" << time_now << endl;
|
|
|
cout << "-------1----------" << endl;
|
|
|
ifail = AE_export_named_ref(excelTag, "excel", time_now.c_str());
|
|
|
cout << "--------2---------" << endl;
|
|
|
if (ifail != ITK_ok) { /* your error logic here */ }
|
|
|
//检查是否存在单元格名称为“xxxx”
|
|
|
wstringstream excel_path;
|
|
|
|
|
|
// excel_path<<"C:\\TEMP\\export_text.xls";
|
|
|
excel_path << time_now.c_str();
|
|
|
cout << "--------3---------" << endl;
|
|
|
libxl::Sheet* sheet = NULL;
|
|
|
cout << "---------4--------" << endl;
|
|
|
if (book->load(excel_path.str().c_str()))
|
|
|
{
|
|
|
sheet = book->getSheet(0);//获得第1个sheet页
|
|
|
cout << "--------读取到excel---------" << endl;
|
|
|
if (sheet)
|
|
|
{
|
|
|
cout << "--------读取到sheet0---------" << endl;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
cout << "--------未读取到sheet0---------" << endl;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
cout << "--------未读取到excel--------" << endl;
|
|
|
}
|
|
|
cout << "--------5---------" << endl;
|
|
|
//写到表格中
|
|
|
TCHAR array2[100];
|
|
|
cout << "---------6--------" << endl;
|
|
|
|
|
|
if (page == 0)
|
|
|
{
|
|
|
cout << "---------page=0--------" << endl;
|
|
|
//编制
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_Design, -1, array2, 100);
|
|
|
ITKCALL(sheet->writeStr(23, 9, array2));
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_DesignTime, -1, array2, 100);
|
|
|
ITKCALL(sheet->writeStr(24, 9, array2));
|
|
|
//校对
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_Proofread, -1, array2, 100);
|
|
|
ITKCALL(sheet->writeStr(23, 10, array2));
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_ProofreadTime, -1, array2, 100);
|
|
|
ITKCALL(sheet->writeStr(24, 10, array2));
|
|
|
//工艺
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_Technology, -1, array2, 100);
|
|
|
ITKCALL(sheet->writeStr(23, 12, array2));
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_TechnologyTime, -1, array2, 100);
|
|
|
ITKCALL(sheet->writeStr(24, 12, array2));
|
|
|
//审定
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_Review, -1, array2, 100);
|
|
|
ITKCALL(sheet->writeStr(23, 14, array2));
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_ReviewTime, -1, array2, 100);
|
|
|
ITKCALL(sheet->writeStr(24, 14, array2));
|
|
|
}
|
|
|
cout << "-------7----------" << endl;
|
|
|
int rowNum = sheet->lastRow();
|
|
|
int colNum = sheet->lastCol();
|
|
|
cout << "lastRow:" << rowNum << endl;
|
|
|
cout << "lastCol:" << colNum << endl;
|
|
|
for (int i = 0; i<page; i++)
|
|
|
{
|
|
|
cout << "-------7-1----------" << endl;
|
|
|
cout << "---------page>0--------" << endl;
|
|
|
MultiByteToWideChar(CP_ACP, 0, "编制测试", -1, array2, 100);
|
|
|
sheet->writeStr(i * 24 + 23, 9, array2);
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_DesignTime, -1, array2, 100);
|
|
|
sheet->writeStr(i * 24 + 24, 9, array2);
|
|
|
MultiByteToWideChar(CP_ACP, 0, "校对测试", -1, array2, 100);
|
|
|
sheet->writeStr(i * 24 + 23, 10, array2);
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_ProofreadTime, -1, array2, 100);
|
|
|
sheet->writeStr(i * 24 + 24, 10, array2);
|
|
|
MultiByteToWideChar(CP_ACP, 0, "工艺测试", -1, array2, 100);
|
|
|
sheet->writeStr(i * 24 + 24, 12, array2);
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_NormalizationTime, -1, array2, 100);
|
|
|
sheet->writeStr(i * 24 + 24, 12, array2);
|
|
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, "审定测试", -1, array2, 100);
|
|
|
sheet->writeStr(i * 24 + 23, 14, array2);
|
|
|
MultiByteToWideChar(CP_ACP, 0, zt2_ReviewTime, -1, array2, 100);
|
|
|
sheet->writeStr(i * 24 + 24, 14, array2);
|
|
|
}
|
|
|
cout << "---------8--------" << endl;
|
|
|
if (book->save(excel_path.str().c_str()))//保存到example.xls
|
|
|
{
|
|
|
//.....
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
std::cout << book->errorMessage() << std::endl;
|
|
|
}
|
|
|
book->release();//释放对象!!!!
|
|
|
//创建数据集,挂到版本的规范关系下
|
|
|
cout << "---------9--------" << endl;
|
|
|
create_dataset("MSExcel", datasetName.c_str(), excelTag);//数据集类型(object_type),数据集名称,版本
|
|
|
cout << "writeToExcel2 end" << endl;
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
|
|
|
int chintSignChange(tag_t task)
|
|
|
{
|
|
|
|
|
|
cout << "chintSignChange start" << endl;
|
|
|
//20200113
|
|
|
POM_AM__set_application_bypass(true);
|
|
|
|
|
|
EPM_decision_t decision = EPM_go;
|
|
|
int ifail = ITK_ok, arg_cnt = 0, i = 0, att_cnt = 0;
|
|
|
|
|
|
//获取根流程节点
|
|
|
int reference_count = 0; tag_t * reference_attachment = NULLTAG;
|
|
|
map<tag_t, string> rev_map;
|
|
|
char *zt2_Design = NULL;
|
|
|
char *zt2_DesignTime = NULL;
|
|
|
char *zt2_Proofread = NULL;
|
|
|
char *zt2_ProofreadTime = NULL;
|
|
|
char *zt2_Normalization = NULL;
|
|
|
char *zt2_NormalizationTime = NULL;
|
|
|
char *zt2_Review = NULL;
|
|
|
char *zt2_ReviewTime = NULL;
|
|
|
char *zt2_Approve = NULL;
|
|
|
char *zt2_ApproveTime = NULL;
|
|
|
char *zt2_Technology = NULL;
|
|
|
char *zt2_TechnologyTime = NULL;
|
|
|
int eCount = 0;
|
|
|
tag_t *eTag = NULLTAG;
|
|
|
// vector.clear();//清空所有元素
|
|
|
//循环目标对象
|
|
|
|
|
|
tag_t targetTag = task;
|
|
|
//如果是版本类型的就查找上层
|
|
|
char * object_type = NULL;
|
|
|
ITKCALL(ifail = AOM_ask_value_string(targetTag, "object_type", &object_type));
|
|
|
cout << i << "--object_type:" << object_type << endl;
|
|
|
if (strstr(object_type, "ZT2_Change") != NULL)
|
|
|
{
|
|
|
//获取对象的上签名属性
|
|
|
|
|
|
AOM_ask_value_string(targetTag, "zt2_Design", &zt2_Design);
|
|
|
AOM_ask_value_string(targetTag, "zt2_DesignTime", &zt2_DesignTime);
|
|
|
AOM_ask_value_string(targetTag, "zt2_Proofread", &zt2_Proofread);
|
|
|
AOM_ask_value_string(targetTag, "zt2_ProofreadTime", &zt2_ProofreadTime);
|
|
|
AOM_ask_value_string(targetTag, "zt2_Normalization", &zt2_Normalization);
|
|
|
AOM_ask_value_string(targetTag, "zt2_NormalizationTime", &zt2_NormalizationTime);
|
|
|
AOM_ask_value_string(targetTag, "zt2_Review", &zt2_Review);
|
|
|
AOM_ask_value_string(targetTag, "zt2_ReviewTime", &zt2_ReviewTime);
|
|
|
AOM_ask_value_string(targetTag, "zt2_Approve", &zt2_Approve);
|
|
|
AOM_ask_value_string(targetTag, "zt2_ApproveTime", &zt2_ApproveTime);
|
|
|
|
|
|
//获取对象的数据集
|
|
|
|
|
|
AOM_ask_value_tags(targetTag, "IMAN_reference", &eCount, &eTag);
|
|
|
for (int j = 0; j<eCount; j++)
|
|
|
{
|
|
|
char *eType = NULL;
|
|
|
AOM_ask_value_string(eTag[j], "object_type", &eType);
|
|
|
|
|
|
if (strcmp(eType, "MSExcel") == 0)
|
|
|
{
|
|
|
int num = 0;
|
|
|
char**values = NULL;
|
|
|
AOM_ask_value_strings(targetTag, "zt2_ChangeDrawingNo", &num, &values);
|
|
|
int modules = num % 5;
|
|
|
int delivery = num / 5;
|
|
|
int page = 0;
|
|
|
if (modules>0)
|
|
|
{
|
|
|
page = delivery + 1;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
page = delivery;
|
|
|
}
|
|
|
writeToExcel(page, eTag[j], zt2_Design, zt2_DesignTime, zt2_Proofread, zt2_ProofreadTime, zt2_Normalization, zt2_NormalizationTime, zt2_Review, zt2_ReviewTime, zt2_Approve, zt2_ApproveTime);
|
|
|
if (values != NULL)
|
|
|
{
|
|
|
for (int t = 0; t<num; t++)
|
|
|
{
|
|
|
if (values[t] != NULL)
|
|
|
{
|
|
|
MEM_free(values[t]);
|
|
|
values[t] = NULL;
|
|
|
}
|
|
|
}
|
|
|
values = NULL;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
DOFREE(eType);
|
|
|
}
|
|
|
}
|
|
|
else if (strstr(object_type, "ZT2_SCXXCDTZD") != NULL)
|
|
|
{
|
|
|
//获取对象的上签名属性
|
|
|
|
|
|
AOM_ask_value_string(targetTag, "zt2_Design", &zt2_Design);
|
|
|
AOM_ask_value_string(targetTag, "zt2_DesignTime", &zt2_DesignTime);
|
|
|
AOM_ask_value_string(targetTag, "zt2_Proofread", &zt2_Proofread);
|
|
|
AOM_ask_value_string(targetTag, "zt2_ProofreadTime", &zt2_ProofreadTime);
|
|
|
AOM_ask_value_string(targetTag, "zt2_Normalization", &zt2_Normalization);
|
|
|
AOM_ask_value_string(targetTag, "zt2_NormalizationTime", &zt2_NormalizationTime);
|
|
|
AOM_ask_value_string(targetTag, "zt2_Review", &zt2_Review);
|
|
|
AOM_ask_value_string(targetTag, "zt2_ReviewTime", &zt2_ReviewTime);
|
|
|
AOM_ask_value_string(targetTag, "zt2_Approve", &zt2_Approve);
|
|
|
AOM_ask_value_string(targetTag, "zt2_ApproveTime", &zt2_ApproveTime);
|
|
|
AOM_ask_value_string(targetTag, "zt2_Technology", &zt2_Technology);
|
|
|
AOM_ask_value_string(targetTag, "zt2_TechnologyTime", &zt2_TechnologyTime);
|
|
|
//获取对象的数据集
|
|
|
|
|
|
AOM_ask_value_tags(targetTag, "IMAN_reference", &eCount, &eTag);
|
|
|
cout << "ZT2_SCXXCDTZD--eCount:" << eCount << endl;
|
|
|
for (int j = 0; j<eCount; j++)
|
|
|
{
|
|
|
char *eType = NULL;
|
|
|
AOM_ask_value_string(eTag[j], "object_type", &eType);
|
|
|
cout << j << "--eType:" << eType << endl;
|
|
|
if (strcmp(eType, "MSExcel") == 0)
|
|
|
{
|
|
|
int num = 0;
|
|
|
char**values = NULL;
|
|
|
|
|
|
writeToExcel2(1, eTag[j], zt2_Design, zt2_DesignTime, zt2_Proofread, zt2_ProofreadTime,
|
|
|
zt2_Normalization, zt2_NormalizationTime, zt2_Review, zt2_ReviewTime,
|
|
|
zt2_Approve, zt2_ApproveTime, zt2_Technology, zt2_TechnologyTime);
|
|
|
if (values != NULL)
|
|
|
{
|
|
|
for (int t = 0; t<num; t++)
|
|
|
{
|
|
|
if (values[t] != NULL)
|
|
|
{
|
|
|
MEM_free(values[t]);
|
|
|
values[t] = NULL;
|
|
|
}
|
|
|
}
|
|
|
values = NULL;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
DOFREE(eType);
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
if (object_type != NULL)
|
|
|
{
|
|
|
MEM_free(object_type);
|
|
|
object_type = NULL;
|
|
|
}
|
|
|
|
|
|
|
|
|
DOFREE(eTag);
|
|
|
DOFREE(zt2_Design);
|
|
|
DOFREE(zt2_DesignTime);
|
|
|
DOFREE(zt2_Proofread);
|
|
|
DOFREE(zt2_ProofreadTime);
|
|
|
DOFREE(zt2_Normalization);
|
|
|
DOFREE(zt2_NormalizationTime);
|
|
|
DOFREE(zt2_Review);
|
|
|
DOFREE(zt2_ReviewTime);
|
|
|
DOFREE(zt2_Approve);
|
|
|
DOFREE(zt2_ApproveTime);
|
|
|
DOFREE(zt2_Technology);
|
|
|
DOFREE(zt2_TechnologyTime);
|
|
|
cout << "chintSignChange end" << endl;
|
|
|
// CloseLog_jk();
|
|
|
POM_AM__set_application_bypass(false);
|
|
|
return 0;
|
|
|
} |