重复id判断

main
李岩峰 5 years ago
parent 92d37adde5
commit 4ab9bd0d4f

@ -191,13 +191,16 @@ int bs_sap_material(EPM_action_message_t msg)
} }
void get_bom(System::Collections::Generic::List<System::Collections::Generic::Dictionary<String^, String^>^> ^a_list,tag_t line,char *werks,char *stlan,string pid, tag_t relation_type,boolean is_hl,boolean is_judge) void get_bom(System::Collections::Generic::List<System::Collections::Generic::Dictionary<String^, String^>^> ^a_list,tag_t line,char *werks,char *stlan,string pid, tag_t relation_type,boolean is_hl,boolean is_judge,vector<string> &bom_ids)
{ {
int line_cnt; int line_cnt;
tag_t *lines; tag_t *lines;
BOM_line_ask_child_lines(line, &line_cnt, &lines); BOM_line_ask_child_lines(line, &line_cnt, &lines);
char *id; char *id;
AOM_UIF_ask_value(line, "bl_item_item_id", &id); AOM_UIF_ask_value(line, "bl_item_item_id", &id);
if (find(bom_ids.begin(), bom_ids.end(), id) != bom_ids.end())
return;
bom_ids.push_back(id);
if(a_list->Count==0) if(a_list->Count==0)
{ {
pid = pid.length()>0?pid:id; pid = pid.length()>0?pid:id;
@ -299,7 +302,7 @@ void get_bom(System::Collections::Generic::List<System::Collections::Generic::Di
{ {
printf("obj:%s pid:%s\n", obj_str, id); printf("obj:%s pid:%s\n", obj_str, id);
} }
get_bom(a_list, lines[j], werks, stlan, pid.length()>0 ? pid : id, relation_type, child_is_hl, is_judge); get_bom(a_list, lines[j], werks, stlan, pid.length()>0 ? pid : id, relation_type, child_is_hl, is_judge,bom_ids);
continue; continue;
} }
// if (tc_strcmp(val1, "F") == 0 && tc_strlen(val2) == 0) // if (tc_strcmp(val1, "F") == 0 && tc_strlen(val2) == 0)
@ -310,7 +313,7 @@ void get_bom(System::Collections::Generic::List<System::Collections::Generic::Di
} }
a_list->Add(dic); a_list->Add(dic);
get_bom(a_list, lines[j], werks, stlan,"",relation_type, child_is_hl, is_judge); get_bom(a_list, lines[j], werks, stlan,"",relation_type, child_is_hl, is_judge,bom_ids);
} }
} }
@ -365,6 +368,7 @@ int bs_sap_bom(EPM_action_message_t msg)
} }
} }
printf("has _99:%d\n", has_99); printf("has _99:%d\n", has_99);
vector<string> bom_ids;
for (int i = 0; i < att_count; i++) for (int i = 0; i < att_count; i++)
{ {
if (isTypeOf(attachments[i], "PSBOMViewRevision")) if (isTypeOf(attachments[i], "PSBOMViewRevision"))
@ -382,6 +386,9 @@ int bs_sap_bom(EPM_action_message_t msg)
continue; continue;
GRM_list_secondary_objects_only(rev, relation_type, &rel_cnt, &rels); GRM_list_secondary_objects_only(rev, relation_type, &rel_cnt, &rels);
AOM_ask_value_string(rev, "item_id", &id); AOM_ask_value_string(rev, "item_id", &id);
if (find(bom_ids.begin(), bom_ids.end(), id) != bom_ids.end())
continue;
if(has_99) if(has_99)
{ {
if (id[0] != '9' || id[1] != '9') if (id[0] != '9' || id[1] != '9')
@ -401,7 +408,7 @@ int bs_sap_bom(EPM_action_message_t msg)
if (tc_strlen(werks)==0||tc_strlen(stlan)==0) if (tc_strlen(werks)==0||tc_strlen(stlan)==0)
continue; continue;
boolean is_judege = id[0] == '9'&&id[1] == '9'; boolean is_judege = id[0] == '9'&&id[1] == '9';
get_bom(a_list, top_line, werks, stlan,"", relation_type,is_hl,is_judege); get_bom(a_list, top_line, werks, stlan,"", relation_type,is_hl,is_judege,bom_ids);
string result = ConvertToString(test->send_bom(url, user, password, a_list)); string result = ConvertToString(test->send_bom(url, user, password, a_list));
printf("result:%s\n", result.c_str()); printf("result:%s\n", result.c_str());
if(result.length()&&result[0]=='E') if(result.length()&&result[0]=='E')

Loading…
Cancel
Save