|
|
|
@ -91,11 +91,26 @@ int bs_sap_material(EPM_action_message_t msg)
|
|
|
|
|
printf("start111\n");
|
|
|
|
|
for (int i = 0; i < att_count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (isTypeOf(attachments[i], "ItemRevision"))
|
|
|
|
|
if (isTypeOf(attachments[i], "Form"))
|
|
|
|
|
{
|
|
|
|
|
int rel_cnt;
|
|
|
|
|
tag_t *rels;
|
|
|
|
|
GRM_list_secondary_objects_only(attachments[i], relation_type, &rel_cnt, &rels);
|
|
|
|
|
int rel_cnt,*levels;
|
|
|
|
|
tag_t *rels,rev=NULLTAG,form;
|
|
|
|
|
char **relations;
|
|
|
|
|
form = attachments[i];
|
|
|
|
|
WSOM_where_referenced2(form, 1, &rel_cnt, &levels, &rels, &relations);
|
|
|
|
|
for(int j=0;j<rel_cnt;j++)
|
|
|
|
|
{
|
|
|
|
|
if(tc_strcmp(relations[j],"IMAN_master_form")==0)
|
|
|
|
|
{
|
|
|
|
|
rev = rels[j];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(rev==NULLTAG)
|
|
|
|
|
{
|
|
|
|
|
printf("revision get error\n");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// GRM_list_secondary_objects_only(attachments[i], relation_type, &rel_cnt, &rels);
|
|
|
|
|
System::Collections::Generic::Dictionary<String^, String^> ^dic = gcnew System::Collections::Generic::Dictionary<String^, String^>();
|
|
|
|
|
for (auto j = prop_map.begin(); j != prop_map.end(); j++)
|
|
|
|
|
{
|
|
|
|
@ -103,35 +118,35 @@ int bs_sap_material(EPM_action_message_t msg)
|
|
|
|
|
string temp_val;
|
|
|
|
|
if (j->second == "item_id")
|
|
|
|
|
{
|
|
|
|
|
AOM_ask_value_string(attachments[i], j->second.c_str(), &val);
|
|
|
|
|
AOM_ask_value_string(rev, j->second.c_str(), &val);
|
|
|
|
|
temp_val = val;
|
|
|
|
|
}
|
|
|
|
|
else if (j->second == "release_status_list") {
|
|
|
|
|
int status_cnt;
|
|
|
|
|
tag_t *rel_status;
|
|
|
|
|
AOM_ask_value_tags(rels[0], j->second.c_str(), &status_cnt, &rel_status);
|
|
|
|
|
AOM_ask_value_tags(form, j->second.c_str(), &status_cnt, &rel_status);
|
|
|
|
|
if (status_cnt)
|
|
|
|
|
AOM_UIF_ask_value(rel_status[status_cnt - 1], "object_string", &val);
|
|
|
|
|
temp_val = rel_map[val];
|
|
|
|
|
}else if(j->second=="jd2_dldw")
|
|
|
|
|
{
|
|
|
|
|
AOM_UIF_ask_value(rels[0], j->second.c_str(), &val);
|
|
|
|
|
AOM_UIF_ask_value(form, j->second.c_str(), &val);
|
|
|
|
|
temp_val = val;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
tag_t lov;
|
|
|
|
|
AOM_ask_lov(rels[0], j->second.c_str(), &lov);
|
|
|
|
|
AOM_ask_lov(form, j->second.c_str(), &lov);
|
|
|
|
|
if (lov)
|
|
|
|
|
AOM_ask_value_string(rels[0], j->second.c_str(), &val);
|
|
|
|
|
AOM_ask_value_string(form, j->second.c_str(), &val);
|
|
|
|
|
else
|
|
|
|
|
AOM_UIF_ask_value(rels[0], j->second.c_str(), &val);
|
|
|
|
|
AOM_UIF_ask_value(form, j->second.c_str(), &val);
|
|
|
|
|
temp_val = val;
|
|
|
|
|
}
|
|
|
|
|
dic[convert_to_cstring(j->first.c_str())] = convert_to_cstring(temp_val.c_str());
|
|
|
|
|
}
|
|
|
|
|
tag_t class_obj;
|
|
|
|
|
ICS_ask_classification_object(attachments[i], &class_obj);
|
|
|
|
|
ICS_ask_classification_object(rev, &class_obj);
|
|
|
|
|
if (class_obj)
|
|
|
|
|
{
|
|
|
|
|
char ***vals;
|
|
|
|
@ -155,7 +170,7 @@ int bs_sap_material(EPM_action_message_t msg)
|
|
|
|
|
if(result.length()&&result[0]=='E')
|
|
|
|
|
{
|
|
|
|
|
char *val;
|
|
|
|
|
AOM_ask_value_string(attachments[i], "item_id", &val);
|
|
|
|
|
AOM_ask_value_string(rev, "item_id", &val);
|
|
|
|
|
stringstream err;
|
|
|
|
|
err << val << " ·¢ËÍ´íÎó:" << result;
|
|
|
|
|
EMH_store_error_s1(EMH_severity_error, EMH_ATTR_error_base, err.str().c_str());
|
|
|
|
@ -172,7 +187,7 @@ 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)
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
int line_cnt;
|
|
|
|
|
tag_t *lines;
|
|
|
|
@ -182,7 +197,7 @@ void get_bom(System::Collections::Generic::List<System::Collections::Generic::Di
|
|
|
|
|
for (int j = 0; j < line_cnt; j++)
|
|
|
|
|
{
|
|
|
|
|
System::Collections::Generic::Dictionary<String^, String^> ^dic = gcnew System::Collections::Generic::Dictionary<String^, String^>();
|
|
|
|
|
dic["MATNR"] = convert_to_cstring(id);
|
|
|
|
|
dic["MATNR"] = convert_to_cstring(pid.length()>0?pid.c_str():id);
|
|
|
|
|
dic["WERKS"] = convert_to_cstring(werks);
|
|
|
|
|
dic["STLAN"] = convert_to_cstring(stlan);
|
|
|
|
|
dic["BMENG"] = "1";
|
|
|
|
@ -199,8 +214,33 @@ void get_bom(System::Collections::Generic::List<System::Collections::Generic::Di
|
|
|
|
|
|
|
|
|
|
AOM_UIF_ask_value(lines[j], "bl_uom", &val);
|
|
|
|
|
dic["MEINS"] = convert_to_cstring(val);
|
|
|
|
|
char *val1, *val2;
|
|
|
|
|
tag_t tag,*rels;
|
|
|
|
|
int rel_cnt;
|
|
|
|
|
AOM_ask_value_tag(lines[j], "bl_line_object", &tag);
|
|
|
|
|
GRM_list_secondary_objects_only(tag, relation_type, &rel_cnt, &rels);
|
|
|
|
|
if(rel_cnt)
|
|
|
|
|
{
|
|
|
|
|
AOM_ask_value_string(rels[0], "jd2_cglx", &val1);
|
|
|
|
|
AOM_ask_value_string(rels[0], "jd2_tscg", &val2);
|
|
|
|
|
}
|
|
|
|
|
if(tc_strcmp(val1,"F")==0&&tc_strcmp(val2,"50")==0)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if(tc_strcmp(val1,"E")==0&&tc_strcmp(val2,"50")==0)
|
|
|
|
|
{
|
|
|
|
|
get_bom(a_list, lines[j], werks, stlan, id, relation_type);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if(tc_strcmp(val1,"F")==0&&tc_strlen(val2)==0)
|
|
|
|
|
{
|
|
|
|
|
a_list->Add(dic);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
a_list->Add(dic);
|
|
|
|
|
get_bom(a_list, lines[j], werks, stlan);
|
|
|
|
|
|
|
|
|
|
get_bom(a_list, lines[j], werks, stlan,"",relation_type);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -252,7 +292,7 @@ int bs_sap_bom(EPM_action_message_t msg)
|
|
|
|
|
if (tc_strlen(werks)==0||tc_strlen(stlan)==0)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
get_bom(a_list, top_line, werks, stlan);
|
|
|
|
|
get_bom(a_list, top_line, werks, stlan,"", relation_type);
|
|
|
|
|
string result = ConvertToString(test->send_bom(url, user, password, a_list));
|
|
|
|
|
printf("result:%s\n", result.c_str());
|
|
|
|
|
if(result.length()&&result[0]=='E')
|
|
|
|
|