#include "epm_handler_common.h" #include "jk_custom_erp.h" #include "jk_custom.h" #include #include #include #include #include #include #include #include #include "ps/ps.h" #include "ps/vrule.h" #include "sstream" #include #include "epm/epm.h" #include "sa/sa.h" #include #include "epm/signoff.h" #include #include #include #include #include "ae/dataset.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include
#include #include #include #include #include "libxl.h" extern "C" int POM_AM__set_application_bypass(logical bypass); using namespace std; int searchItemRev(string item_id,string item_rev,vector &vector) { cout<<"版本----"<tm_sec ; for(int n=0;n errMap; vector type_vec;//存放所有的要去除的发布状态 vector itemRev;//存放所有的要去除状态的版本 arg_cnt = TC_number_of_arguments(msg.arguments); ECHO("参数个数为:%d\n",arg_cnt); if (arg_cnt > 0) { for (i=0;i(key_id,HANDLER_ARGUMENT_ERROR)); } } } // //获取目标对象 task_tag = msg.task; if(task_tag == NULLTAG) { return EPM_nogo; } EPM_ask_root_task(task_tag, &root_task_tag); EPM_ask_attachments(root_task_tag, EPM_target_attachment, &att_cnt, &attachments); for(i = 0 ;i < att_cnt;i++){ tag_t excelTag = attachments[i]; //获取对象的类型 PSBOMViewRevision ITKCALL( WSOM_ask_object_type(excelTag, type_class)); ECHO("对象类型%s\n",type_class); if(strcmp(type_class,"MSExcel")==0) { // ITK__convert_uid_to_tag("T1exiQYYYvbLjA",&excelTag); libxl::Book* book = nullptr; book = xlCreateBook();//xls文件用xlCreateBook() 函数打开,xlsx文件是xml结构,所以得用xlCreateXMLBook() 函数来打开。 book->setKey(L"Halil Kural", L"windows-2723210a07c4e90162b26966a8jcdboe");//如果购买了该库,则设置相应的key,若没有购买,则不用这行 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_date_and_time(current_date_time_str); string time_now=current_date_time_str; time_now="E:\\TEMP\\"+time_now+".xls"; cout<<"文件路径----------"<load(excel_path.str().c_str())) { cout<<"88888888"<getSheet(0);//获得第1个sheet页 int lastRow=sheet->lastRow(); cout<<"共有"<cellType(i, 0))&&IsCellEmpty(sheet->cellType(i, 1))){ string value0=ws2s(sheet->readStr(i, 0));//虚拟件id string value1=ws2s(sheet->readStr(i, 1));//虚拟件技术型号 cout<1&&value1.length()>1 ) { searchItemRev(value0,value1,itemRev); } }else { continue; } } } if (book->save(excel_path.str().c_str()))//保存到example.xls { //..... } else { std::cout << book->errorMessage() << std::endl; } book->release();//释放对象!!!! } } //把所有的版本去除状态 //删除物料和版本的状态 cout<<"mark1"<