From 4ab9bd0d4fa2ff3d1bc379ba455bde64ef895861 Mon Sep 17 00:00:00 2001 From: liyf Date: Wed, 8 Jul 2020 11:27:02 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=A4=8Did=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HEZON_ITK/bs_sap.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/HEZON_ITK/bs_sap.cpp b/HEZON_ITK/bs_sap.cpp index b4ef9b7..d7fd68b 100644 --- a/HEZON_ITK/bs_sap.cpp +++ b/HEZON_ITK/bs_sap.cpp @@ -191,13 +191,16 @@ int bs_sap_material(EPM_action_message_t msg) } -void get_bom(System::Collections::Generic::List^> ^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^> ^a_list,tag_t line,char *werks,char *stlan,string pid, tag_t relation_type,boolean is_hl,boolean is_judge,vector &bom_ids) { int line_cnt; tag_t *lines; BOM_line_ask_child_lines(line, &line_cnt, &lines); char *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) { pid = pid.length()>0?pid:id; @@ -299,7 +302,7 @@ void get_bom(System::Collections::Generic::List0 ? 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; } // if (tc_strcmp(val1, "F") == 0 && tc_strlen(val2) == 0) @@ -310,7 +313,7 @@ void get_bom(System::Collections::Generic::ListAdd(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); + vector bom_ids; for (int i = 0; i < att_count; i++) { if (isTypeOf(attachments[i], "PSBOMViewRevision")) @@ -382,6 +386,9 @@ int bs_sap_bom(EPM_action_message_t msg) continue; GRM_list_secondary_objects_only(rev, relation_type, &rel_cnt, &rels); 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 (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) continue; 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)); printf("result:%s\n", result.c_str()); if(result.length()&&result[0]=='E')