#include "util.h" void judge(tag_t top,string &status,stringstream &ss) { int line_cnt; tag_t *lines; char *val; BOM_line_ask_child_lines(top, &line_cnt, &lines); for (int j = 0; j < line_cnt; j++) { AOM_UIF_ask_value(lines[j], "jd2_last_release_status", &val); printf("status:%s\n", val); string temp = val; if (temp.length()>0&&status.find(val) == -1) { AOM_ask_value_string(lines[j], "bl_rev_object_string", &val); ss << val << ','; } judge(lines[j], status, ss); } } int bs_bom_check(EPM_rule_message_t msg) { int ifail = EPM_go, att_count, line_cnt; tag_t rootTask, *attachments, win, top, *lines; char *val; EPM_ask_root_task(msg.task, &rootTask); EPM_ask_attachments(rootTask, EPM_target_attachment, &att_count, &attachments); TC_argument_list_t * arguments = msg.arguments; int arg_cnt = TC_number_of_arguments(arguments), status = 0; vector types; map paras; stringstream ss; for (auto i = 0; i < arg_cnt; i++) { char *temp_key, *temp_val; ITK_ask_argument_named_value(TC_next_argument(arguments), &temp_key, &temp_val); paras[temp_key] = temp_val; } split(paras["type"].c_str(),",", &types); printf("check status:%s\n", paras["status"].c_str()); BOM_create_window(&win); for (int i = 0; i < att_count; i++) { bool pass = false; for (int j = 0; j < types.size(); j++) { if (isTypeOf(attachments[i], types[j].c_str())) { pass = true; break; } } if (!pass) continue; printf("begin check \n"); char *hl; AOM_ask_value_string(attachments[i], "jd2_ishl", &hl); printf("hl:%s\n", hl); if(tc_strcmp(hl,"สว")==0) { continue; } BOM_set_window_top_line(win, NULLTAG, attachments[i], NULLTAG, &top); AOM_UIF_ask_value(top, "jd2_last_release_status", &val); if (tc_strlen(val) && paras["status"].find(val) == -1) { AOM_ask_value_string(top, "bl_rev_object_string", &val); ss << val << ','; } judge(top, paras["status"], ss); printf("end check \n"); } BOM_close_window(win); if (ss.str().length()) { ss<< paras["prompt"]; EMH_store_error_s1(EMH_severity_user_error, EMH_PROP_error_base, ss.str().c_str()); ifail = EPM_nogo; } return ifail; }