#include"kutil.h" #include #include #include #include #include "libxl.h" #include #include #include #include #include #include #include #include #include #include #include #include "libxl.h" #include #include #include #include #include #include #include #include #include "ado.h" using namespace libxl; using namespace std::chrono_literals; using namespace std; #define debug true #define ITK_err 919012 int LD_TaskAssignmentDate(EPM_action_message_t msg) { printf("=========================开始===================\n"); int cnt = 0; char** vals = NULL; //获取首选项的值 PREF_ask_char_values("LD_dbinfo2", &cnt, &vals); //获取当前时间 time_t now = time(0); tm* p = localtime(&now); char dateNow[128] = ""; sprintf_s(dateNow, "%04d%02d%02d%02d%02d%02d", 1900 + p->tm_year, p->tm_mon + 1, p->tm_mday, p->tm_hour, p->tm_min, p->tm_sec); string dateString = dateNow; int ifail = ITK_ok; int attachments_num = 0; tag_t rootTask = NULLTAG, * attachments = NULLTAG; //获取任务对象 EPM_ask_root_task(msg.task, &rootTask); //获取任务目标对象 EPM_ask_attachments(rootTask, EPM_target_attachment, &attachments_num, &attachments); for (int r = 0; r < attachments_num; r++) { char* itemObjId; char* objectType; char* revision_id; AOM_ask_value_string(attachments[r], "object_type", &objectType); printf("objectType===%s\n", objectType); if (strcmp(objectType, "LD6_CusProdFolder") == 0) { //获取前面condition节点的值 tag_t* fnd0ActuatedInteractiveTsks_val; int fnd0ActuatedInteractiveTsks_num = 0; AOM_ask_value_tags(attachments[r], "fnd0ActuatedInteractiveTsks", &fnd0ActuatedInteractiveTsks_num, &fnd0ActuatedInteractiveTsks_val); if (fnd0ActuatedInteractiveTsks_num > 0) { for (int i = 0; i < fnd0ActuatedInteractiveTsks_num; i++) { char* task_type; AOM_ask_value_string(fnd0ActuatedInteractiveTsks_val[i], "task_type", &task_type); printf("task_type===%s\n", task_type); if (strcmp(task_type, "EPMConditionTask") == 0) { char* task_result; AOM_ask_value_string(fnd0ActuatedInteractiveTsks_val[i], "task_result", &task_result); printf("task_result===%s\n", task_result); //连接数据库保存当前名称到数据库 char* folder_uid; ITK__convert_tag_to_uid(attachments[r], &folder_uid);//获取文件夹uid if (open("infodba", "infodba", vals[1], vals[0])) { printf("=========================连接失败===================\n"); } else { //获取当前时间 auto now = std::chrono::system_clock::now(); std::time_t time = std::chrono::system_clock::to_time_t(now); std::tm* ptm = std::localtime(&time); char buf[128]; strftime(buf, sizeof(buf), "%Y-%m-%d", ptm); printf("time===%s\n", buf); //update语句 char sql[200] = ""; sprintf(sql, "UPDATE LD6_NewProdForm_VALUES SET TaskAssignmentDate = '%s' WHERE ClientProductFolderPUID = '%s' AND NewProductTaskItem = '%s'", buf, folder_uid, task_result); printf("sql===%s\n", sql); if (ExecuteSQLNoInputParam(sql) == 0) { printf("=========================修改成功===================\n"); } else { printf("=========================修改失败===================\n"); } } break; } } } } } printf("=========================结束===================\n"); return 0; }