|
|
#include "util.h"
|
|
|
#include <boost/algorithm/string/predicate.hpp>
|
|
|
#include <boost/lexical_cast.hpp>
|
|
|
|
|
|
|
|
|
void checkCGLX(tag_t bomline, bool *flag, vector<string> *res) {
|
|
|
int child_cnt;
|
|
|
tag_t *childrens;
|
|
|
ITKCALL(BOM_line_ask_child_lines(bomline, &child_cnt, &childrens));
|
|
|
if (child_cnt == 0) {
|
|
|
return;
|
|
|
}
|
|
|
for (int i = 0;i < child_cnt;i++) {
|
|
|
char *cglx, *item_id, *rev_id;
|
|
|
tag_t rev, *form;
|
|
|
int form_cnt;
|
|
|
AOM_ask_value_string(childrens[i], "bl_item_item_id", &item_id);
|
|
|
AOM_ask_value_string(childrens[i], "bl_rev_item_revision_id",
|
|
|
&rev_id);
|
|
|
ITEM_find_rev(item_id, rev_id, &rev);
|
|
|
AOM_ask_value_tags(rev, "IMAN_master_form_rev", &form_cnt, &form);
|
|
|
AOM_ask_value_string(form[0], "jd2_cglx", &cglx);
|
|
|
cout << "check item_id:" << item_id << endl;
|
|
|
cout << "cglx:" << cglx << endl;
|
|
|
*flag = *flag&&tc_strlen(cglx) > 0;
|
|
|
if (tc_strlen(cglx) == 0) {
|
|
|
char *rev_name;
|
|
|
AOM_ask_value_string(rev, "object_string", &rev_name);
|
|
|
(*res).push_back(rev_name);
|
|
|
}
|
|
|
checkCGLX(childrens[i], flag, res);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
int jd_check_99_cglx(EPM_rule_message_t msg) {
|
|
|
int att_cnt;
|
|
|
tag_t root_task, *attachments;
|
|
|
EPM_ask_root_task(msg.task, &root_task);
|
|
|
EPM_ask_attachments(root_task, EPM_target_attachment, &att_cnt, &attachments);
|
|
|
|
|
|
for (int i = 0;i < att_cnt;i++) {
|
|
|
char *item_id;
|
|
|
AOM_ask_value_string(attachments[i], "item_id", &item_id);
|
|
|
cout << "item_id:" << item_id << endl;
|
|
|
if (!isTypeOf(attachments[i], "ItemRevision") || !boost::starts_with(item_id, "99")) {
|
|
|
continue;
|
|
|
}
|
|
|
tag_t window, top_line, item, *childrens;
|
|
|
int child_cnt;
|
|
|
ITKCALL(ITEM_ask_item_of_rev(attachments[i], &item));
|
|
|
ITKCALL(BOM_create_window(&window));
|
|
|
ITKCALL(BOM_set_window_top_line(window, item, attachments[i], NULLTAG, &top_line));
|
|
|
ITKCALL(BOM_line_ask_child_lines(top_line, &child_cnt, &childrens));
|
|
|
if (child_cnt == 0) {
|
|
|
continue;
|
|
|
}
|
|
|
bool flag = true;
|
|
|
vector<string> res;
|
|
|
checkCGLX(top_line, &flag, &res);
|
|
|
ITKCALL(BOM_close_window(window));
|
|
|
cout << "flag:" << boolalpha << flag << endl;
|
|
|
if (!flag) {
|
|
|
|
|
|
string msg = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><EFBFBD>д<EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n";
|
|
|
for (int ii = 0;ii < res.size();ii++) {
|
|
|
msg.append(res[ii]);
|
|
|
msg.append("\n");
|
|
|
}
|
|
|
return EMH_store_error_s1(EMH_severity_error, EMH_AE_error_base, msg.c_str());
|
|
|
}
|
|
|
}
|
|
|
return EPM_go;
|
|
|
|
|
|
} |