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.

88 lines
2.5 KiB

#include "util.h"
int jd_check_ID_wllx(EPM_rule_message_t msg) {
POM_AM__set_application_bypass(true);
tag_t root_task, *attachments;
int att_cnt;
//获得根节点
EPM_ask_root_task(msg.task, &root_task);
//获得根任务下的组件
EPM_ask_attachments(root_task, EPM_target_attachment, &att_cnt, &attachments);
//判断参数是否符合要求
bool isTransit = true;
std::string names = "ID:{";
for (int i = 0; i < att_cnt; i++) {
if (isTypeOf(attachments[i], "ItemRevision")) {
int form_att;
tag_t *forms;
AOM_ask_value_tags(attachments[i], "IMAN_master_form_rev", &form_att, &forms);
char *item_id;
//获取当前对象的 object_string
AOM_ask_value_string(attachments[i], "item_id", &item_id);
//转换截取后判断是否以什么开头 是则不能发起流程
std::string taskName = item_id;
string str = taskName.substr(0, 1);
const char *p = str.c_str();
char *wllx;
AOM_ask_value_string(forms[0], "jd2_wllx", &wllx);
if ((strcmp(p, "1") == 0) || (strcmp(p, "2") == 0)) {
if (strcmp(wllx, "ZR01") != 0) {
isTransit = false;
names.append(taskName).append(";");
}
} else if (strcmp(p, "3") == 0) {
if (strcmp(wllx, "ZH01") != 0) {
isTransit = false;
names.append(taskName).append(";");
}
} else if (strcmp(p, "4") == 0) {
char *lxs[8] = { "ZF01" ,"ZF02" ,"ZF03" ,"ZF04" ,"ZF05" ,"ZF06" ,"ZF07" };
char **lx = lxs;
bool isTrue = false;
for (int i = 0; lx && lx[i]; i++) {
if (strcmp(wllx, lx[i]) == 0) {
isTrue = true;
break;
}
}
if (!isTrue) {
isTransit = false;
names.append(taskName).append(";");
}
} else if (strcmp(p, "Y") == 0) {
if (strcmp(wllx, "ZY01") != 0) {
isTransit = false;
names.append(taskName).append(";");
}
} else if (strcmp(p, "9") == 0) {
str = taskName.substr(0, 2);
p = str.c_str();
if (strcmp(p, "99") == 0) {
if (strcmp(wllx, "ZZ01") != 0) {
isTransit = false;
names.append(taskName).append(";");
}
} else if (strcmp(p, "98") == 0) {
if (strcmp(wllx, "ZC01") != 0) {
isTransit = false;
names.append(taskName).append(";");
}
}
}
}
}
names.append("}");
if (!isTransit) {
std::string massage = "与物料类型不一致";
names.append(massage);
const char *p = names.c_str();
cout << "Exception:" << p << endl;
POM_AM__set_application_bypass(false);
return EMH_store_error_s1(EMH_severity_error, EMH_IDGENERATION_ERROR_BASE, p);
}
POM_AM__set_application_bypass(false);
return EPM_go;
}