|
|
@ -35,8 +35,6 @@ int bs_sap_material(EPM_action_message_t msg)
|
|
|
|
}else
|
|
|
|
}else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
class_map[1000 + i] = d0 + to_string(i + 1);
|
|
|
|
class_map[1000 + i] = d0 + to_string(i + 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -174,6 +172,8 @@ int bs_sap_material(EPM_action_message_t msg)
|
|
|
|
AOM_ask_value_string(rev, "item_id", &val);
|
|
|
|
AOM_ask_value_string(rev, "item_id", &val);
|
|
|
|
stringstream err;
|
|
|
|
stringstream err;
|
|
|
|
err << val << " ·¢ËÍ´íÎó:" << result;
|
|
|
|
err << val << " ·¢ËÍ´íÎó:" << result;
|
|
|
|
|
|
|
|
POM_AM__set_application_bypass(false);
|
|
|
|
|
|
|
|
|
|
|
|
EMH_store_error_s1(EMH_severity_error, EMH_ATTR_error_base, err.str().c_str());
|
|
|
|
EMH_store_error_s1(EMH_severity_error, EMH_ATTR_error_base, err.str().c_str());
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
@ -188,13 +188,20 @@ 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)
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
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(a_list->Count==0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
pid = pid.length()>0?pid:id;
|
|
|
|
|
|
|
|
int index = pid.find('-');
|
|
|
|
|
|
|
|
if (index != -1)
|
|
|
|
|
|
|
|
pid = pid.substr(index + 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
for (int j = 0; j < line_cnt; j++)
|
|
|
|
for (int j = 0; j < line_cnt; j++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
System::Collections::Generic::Dictionary<String^, String^> ^dic = gcnew System::Collections::Generic::Dictionary<String^, String^>();
|
|
|
|
System::Collections::Generic::Dictionary<String^, String^> ^dic = gcnew System::Collections::Generic::Dictionary<String^, String^>();
|
|
|
@ -211,50 +218,62 @@ void get_bom(System::Collections::Generic::List<System::Collections::Generic::Di
|
|
|
|
AOM_UIF_ask_value(lines[j], "bl_child_id", &child_id);
|
|
|
|
AOM_UIF_ask_value(lines[j], "bl_child_id", &child_id);
|
|
|
|
dic["IDNRK"] = convert_to_cstring(child_id);
|
|
|
|
dic["IDNRK"] = convert_to_cstring(child_id);
|
|
|
|
|
|
|
|
|
|
|
|
AOM_UIF_ask_value(lines[j], "bl_quantity", &val);
|
|
|
|
// AOM_UIF_ask_value(lines[j], "bl_quantity", &val);
|
|
|
|
dic["MENGE"] = convert_to_cstring(val);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AOM_UIF_ask_value(lines[j], "bl_uom", &val);
|
|
|
|
AOM_UIF_ask_value(lines[j], "bl_uom", &val);
|
|
|
|
dic["MEINS"] = convert_to_cstring(val);
|
|
|
|
dic["MEINS"] = convert_to_cstring(val);
|
|
|
|
char *val1, *val2;
|
|
|
|
dic["STLAL"] = is_hl ? convert_to_cstring("02") : convert_to_cstring("01");
|
|
|
|
|
|
|
|
char *val1, *val2,*hl,*sffs;
|
|
|
|
tag_t tag,*rels;
|
|
|
|
tag_t tag,*rels;
|
|
|
|
int rel_cnt;
|
|
|
|
int rel_cnt;
|
|
|
|
|
|
|
|
|
|
|
|
AOM_ask_value_tag(lines[j], "bl_line_object", &tag);
|
|
|
|
AOM_ask_value_tag(lines[j], "bl_line_object", &tag);
|
|
|
|
|
|
|
|
AOM_UIF_ask_value(tag, "jd2_ishl", &hl);
|
|
|
|
|
|
|
|
boolean child_is_hl = tc_strcmp(hl, "ÊÇ") ? false : true;
|
|
|
|
|
|
|
|
|
|
|
|
GRM_list_secondary_objects_only(tag, relation_type, &rel_cnt, &rels);
|
|
|
|
GRM_list_secondary_objects_only(tag, relation_type, &rel_cnt, &rels);
|
|
|
|
if(tc_strlen(child_id)>1&&child_id[0]=='9'&&child_id[1]=='9')
|
|
|
|
AOM_ask_value_string(lines[j], "JD2_SFHL", &sffs);
|
|
|
|
|
|
|
|
printf("JD2_SFHL:%s\n", sffs);
|
|
|
|
|
|
|
|
if(tc_strcmp(sffs,"1")==0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
a_list->Add(dic);
|
|
|
|
AOM_ask_value_string(lines[j], "JD2_sl", &val);
|
|
|
|
get_bom(a_list, lines[j], werks, stlan, "", relation_type);
|
|
|
|
}else
|
|
|
|
continue;
|
|
|
|
{
|
|
|
|
|
|
|
|
AOM_ask_value_string(lines[j], "bl_quantity", &val);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(rel_cnt)
|
|
|
|
|
|
|
|
|
|
|
|
dic["MENGE"] = convert_to_cstring(val);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(is_judge){
|
|
|
|
|
|
|
|
if (rel_cnt)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AOM_ask_value_string(rels[0], "jd2_cglx", &val1);
|
|
|
|
AOM_ask_value_string(rels[0], "jd2_cglx", &val1);
|
|
|
|
AOM_ask_value_string(rels[0], "jd2_tscg", &val2);
|
|
|
|
AOM_ask_value_string(rels[0], "jd2_tscg", &val2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(tc_strcmp(val1,"F")==0&&tc_strcmp(val2,"50")==0)
|
|
|
|
if (tc_strcmp(val1, "F") == 0 && tc_strcmp(val2, "50") == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(tc_strcmp(val1,"E")==0&&tc_strcmp(val2,"50")==0)
|
|
|
|
if (tc_strcmp(val1, "E") == 0 && tc_strcmp(val2, "50") == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get_bom(a_list, lines[j], werks, stlan, id, relation_type);
|
|
|
|
get_bom(a_list, lines[j], werks, stlan, id, relation_type, child_is_hl, is_judge);
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(tc_strcmp(val1,"F")==0&&tc_strlen(val2)==0)
|
|
|
|
if (tc_strcmp(val1, "F") == 0 && tc_strlen(val2) == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
a_list->Add(dic);
|
|
|
|
a_list->Add(dic);
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
a_list->Add(dic);
|
|
|
|
a_list->Add(dic);
|
|
|
|
|
|
|
|
|
|
|
|
get_bom(a_list, lines[j], werks, stlan,"",relation_type);
|
|
|
|
get_bom(a_list, lines[j], werks, stlan,"",relation_type, child_is_hl, is_judge);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int bs_sap_bom(EPM_action_message_t msg)
|
|
|
|
int bs_sap_bom(EPM_action_message_t msg)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("start sap bom\n");
|
|
|
|
printf("start sap bom1\n");
|
|
|
|
int ifail = ITK_ok, att_count;
|
|
|
|
int ifail = ITK_ok, att_count;
|
|
|
|
tag_t rootTask, *attachments, relation_type, win;
|
|
|
|
tag_t rootTask, *attachments, relation_type, win;
|
|
|
|
char *obj_type;
|
|
|
|
char *obj_type;
|
|
|
@ -290,21 +309,26 @@ int bs_sap_bom(EPM_action_message_t msg)
|
|
|
|
int rel_cnt, line_cnt;
|
|
|
|
int rel_cnt, line_cnt;
|
|
|
|
System::Collections::Generic::List<System::Collections::Generic::Dictionary<String^, String^>^> ^a_list = gcnew System::Collections::Generic::List<System::Collections::Generic::Dictionary<String^, String^>^>();
|
|
|
|
System::Collections::Generic::List<System::Collections::Generic::Dictionary<String^, String^>^> ^a_list = gcnew System::Collections::Generic::List<System::Collections::Generic::Dictionary<String^, String^>^>();
|
|
|
|
tag_t top_line, *lines, rev, *rels;
|
|
|
|
tag_t top_line, *lines, rev, *rels;
|
|
|
|
char *id, *werks, *stlan;
|
|
|
|
char *id, *werks, *stlan,*hl;
|
|
|
|
BOM_set_window_top_line_bvr(win, attachments[i], &top_line);
|
|
|
|
BOM_set_window_top_line_bvr(win, attachments[i], &top_line);
|
|
|
|
AOM_ask_value_tag(top_line, "bl_line_object", &rev);
|
|
|
|
AOM_ask_value_tag(top_line, "bl_line_object", &rev);
|
|
|
|
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);
|
|
|
|
AOM_ask_value_string(rels[0], "jd2_gc", &werks);
|
|
|
|
AOM_ask_value_string(rels[0], "jd2_gc", &werks);
|
|
|
|
AOM_ask_value_string(rels[0], "jd2_BOMyt", &stlan);
|
|
|
|
AOM_ask_value_string(rels[0], "jd2_BOMyt", &stlan);
|
|
|
|
|
|
|
|
AOM_UIF_ask_value(rev, "jd2_ishl", &hl);
|
|
|
|
|
|
|
|
boolean is_hl = tc_strcmp(hl,"ÊÇ")?false:true;
|
|
|
|
|
|
|
|
|
|
|
|
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';
|
|
|
|
get_bom(a_list, top_line, werks, stlan,"", relation_type);
|
|
|
|
get_bom(a_list, top_line, werks, stlan,"", relation_type,is_hl,is_judege);
|
|
|
|
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')
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
BOM_close_window(win);
|
|
|
|
|
|
|
|
POM_AM__set_application_bypass(false);
|
|
|
|
EMH_store_error_s1(EMH_severity_error, EMH_ATTR_error_base, result.c_str());
|
|
|
|
EMH_store_error_s1(EMH_severity_error, EMH_ATTR_error_base, result.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
@ -313,6 +337,7 @@ int bs_sap_bom(EPM_action_message_t msg)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
BOM_close_window(win);
|
|
|
|
BOM_close_window(win);
|
|
|
|
POM_AM__set_application_bypass(false);
|
|
|
|
POM_AM__set_application_bypass(false);
|
|
|
|
|
|
|
|
EMH_clear_errors();
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|