You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
116 lines
3.1 KiB
116 lines
3.1 KiB
#include <tc\folder.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <iostream>
|
|
#include <fstream>
|
|
#include <tc\preferences.h>
|
|
#include <winsock2.h>
|
|
#include <tc/prm.h>
|
|
#include <comdef.h>
|
|
#include <windows.h>
|
|
#include "epm_handler_common.h"
|
|
|
|
#include "RB_AutoSignServer.h";
|
|
#define DOFREE(obj) \
|
|
{ \
|
|
if(obj) \
|
|
{ \
|
|
MEM_free(obj); \
|
|
obj = NULL; \
|
|
} \
|
|
}
|
|
|
|
//ÌáÈ¡Á÷³Ì½Úµã×Ô¶¯Ìø¹ý
|
|
int RB_AutoSignServer(void *returnValue)
|
|
{
|
|
int ifail = 0;
|
|
char * myResult = NULL,
|
|
*myType = NULL;
|
|
char * signoffUid = NULL;
|
|
char * parentUid = NULL;
|
|
string resultString;
|
|
tag_t parentTag = NULLTAG, signoffTag = NULLTAG;
|
|
POM_AM__set_application_bypass(true);
|
|
ITKCALL(ifail = USERARG_get_string_argument(&signoffUid));
|
|
ITKCALL(ifail = USERARG_get_string_argument(&parentUid));
|
|
myResult = (char *)MEM_alloc(8 * sizeof(char));
|
|
printf("signoffUid=%s\n", signoffUid);
|
|
printf("parentUid=%s\n", parentUid);
|
|
tc_strcpy(myResult, "-1");
|
|
ITK__convert_uid_to_tag(parentUid, &parentTag);
|
|
if (parentTag == NULLTAG) {
|
|
tc_strcpy(myResult, "0");
|
|
}
|
|
ITK__convert_uid_to_tag(signoffUid, &signoffTag);
|
|
if (signoffTag == NULLTAG) {
|
|
tc_strcpy(myResult, "0");
|
|
}
|
|
char * taskname = NULL, *type = NULL;
|
|
ITKCALL(AOM_ask_value_string(parentTag, "object_type", &type));
|
|
printf("name=%s\n", taskname);
|
|
printf("type=%s\n", type);
|
|
if (strcmp(type, "EPMReviewTask") == 0)
|
|
{
|
|
//int num = 0;
|
|
//tag_t *sub_tags = NULL;
|
|
//ITKCALL(EPM_ask_sub_tasks(task_tag, &num, &sub_tags));
|
|
//for (int j = 0; j < num; j++)
|
|
//{
|
|
//char * taskname2 = NULL, *type2 = NULL;
|
|
//ITKCALL(EPM_ask_name2(sub_tags[j], &taskname2));
|
|
//ITKCALL(AOM_ask_value_string(sub_tags[j], "object_type", &type2));
|
|
//if (strcmp(type2, "EPMPerformSignoffTask") == 0)
|
|
//{
|
|
//printf("name2=%s,type2=%s\n", taskname2, type2);
|
|
ITKCALL(EPM_promote_task(parentTag, ""));
|
|
//}
|
|
//DOFREE(taskname2);
|
|
//DOFREE(type2);
|
|
|
|
// }
|
|
//DOFREE(sub_tags);
|
|
}
|
|
DOFREE(taskname);
|
|
DOFREE(type);
|
|
POM_AM__set_application_bypass(false);
|
|
/*if (parentTag != NULLTAG && signoffTag != NULLTAG) {
|
|
POM_AM__set_application_bypass(true);
|
|
char *realState = NULL;
|
|
logical isPexist = false;
|
|
logical isAexist = false;
|
|
ITKCALL(POM_instance_exists(parentTag, &isPexist));
|
|
ITKCALL(POM_instance_exists(signoffTag, &isAexist));
|
|
if (isPexist && isAexist) {
|
|
ITKCALL(ifail = AOM_refresh(parentTag, 0));
|
|
ITKCALL(ifail = AOM_refresh(signoffTag, 0));
|
|
ITKCALL(AOM_ask_value_string(parentTag, "real_state", &realState));
|
|
printf("realState=%s\n", realState);
|
|
if (strcmp(realState, "Started") == 0) {
|
|
ITKCALL(ifail = EPM_set_task_decision2(parentTag, signoffTag, CR_approve_decision, "Ìø¹ý"));
|
|
if (ifail == ITK_ok) {
|
|
tc_strcpy(myResult, "0");
|
|
printf("Ö´ÐÐÌø¹ý³É¹¦£¬Ìø¹ý");
|
|
}
|
|
else {
|
|
printf("Ö´ÐÐÌø¹ýʧ°Ü£¬²»Ìø¹ý");
|
|
}
|
|
//MEM_free(realState);
|
|
//realState = NULL;
|
|
}
|
|
else if (strcmp(realState, "Completed") == 0) {
|
|
tc_strcpy(myResult, "0");
|
|
printf("½Úµã״̬ΪÍê³É£¬Ìø¹ý\n");
|
|
}
|
|
MEM_free(realState);
|
|
realState = NULL;
|
|
POM_AM__set_application_bypass(false);
|
|
}
|
|
else {
|
|
tc_strcpy(myResult, "0");
|
|
printf("¶ÔÏó²»´æÔÚ£¬Ìø¹ý\n");
|
|
}
|
|
}
|
|
*/
|
|
*((char**)returnValue) = myResult;
|
|
return 0;
|
|
} |