Merge branch 'master' of http://plmserver.cn:3000/jd/itk into zxk

main
zouxk 5 years ago
commit 4be5ef110a

@ -108,12 +108,15 @@ int bs_sap_material(EPM_action_message_t msg)
printf("revision get error\n");
continue;
}
char *item_id;
AOM_ask_value_string(rev, "item_id", &item_id);
// 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++)
{
char *val="";
string temp_val;
if (j->second == "item_id")
{
AOM_ask_value_string(rev, j->second.c_str(), &val);
@ -234,15 +237,23 @@ void get_bom(System::Collections::Generic::List<System::Collections::Generic::Di
GRM_list_secondary_objects_only(tag, relation_type, &rel_cnt, &rels);
AOM_ask_value_string(lines[j], "JD2_SFHL", &sffs);
printf("JD2_SFHL:%s\n", sffs);
string quantity;
if(tc_strcmp(sffs,"1")==0)
{
AOM_ask_value_string(lines[j], "JD2_sl", &val);
quantity = val;
int index = quantity.find('.');
if(index!=-1&&quantity.length()>(index + 3))
{
quantity = quantity.substr(0, index + 3);
}
}else
{
AOM_ask_value_string(lines[j], "bl_quantity", &val);
quantity = val;
}
dic["MENGE"] = convert_to_cstring(val);
dic["MENGE"] = convert_to_cstring(quantity.c_str());
if(is_judge){
if (rel_cnt)
@ -250,20 +261,50 @@ void get_bom(System::Collections::Generic::List<System::Collections::Generic::Di
AOM_ask_value_string(rels[0], "jd2_cglx", &val1);
AOM_ask_value_string(rels[0], "jd2_tscg", &val2);
}
char *obj_str;
AOM_ask_value_string(lines[j], "object_string", &obj_str);
if (tc_strcmp(val1, "F") == 0 && tc_strcmp(val2, "50") == 0)
{
printf("has f50:%s\n",obj_str);
continue;
}
if (tc_strcmp(val1, "E") == 0 && tc_strcmp(val2, "50") == 0)
if (tc_strcmp(val1, "F") == 0 && tc_strcmp(val2, "10") == 0)
{
get_bom(a_list, lines[j], werks, stlan, id, relation_type, child_is_hl, is_judge);
printf("has f10:%s\n", obj_str);
a_list->Add(dic);
continue;
}
if (tc_strcmp(val1, "F") == 0 && tc_strlen(val2) == 0)
{
printf("has fempty:%s\n", obj_str);
a_list->Add(dic);
continue;
}
if (tc_strcmp(val1, "E") == 0 && tc_strlen(val2) == 0)
{
printf("has fempty:%s\n", obj_str);
a_list->Add(dic);
continue;
}
if (tc_strcmp(val1, "E") == 0 && tc_strcmp(val2, "50") == 0)
{
printf("has e50:%s\n", obj_str);
if(pid.length()>0)
{
printf("obj:%s pid:%s\n",obj_str,pid.c_str());
}else
{
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);
continue;
}
// if (tc_strcmp(val1, "F") == 0 && tc_strlen(val2) == 0)
// {
// a_list->Add(dic);
// continue;
// }
}
a_list->Add(dic);
@ -273,7 +314,7 @@ void get_bom(System::Collections::Generic::List<System::Collections::Generic::Di
int bs_sap_bom(EPM_action_message_t msg)
{
printf("start sap bom1\n");
printf("start sap bom2\n");
int ifail = ITK_ok, att_count;
tag_t rootTask, *attachments, relation_type, win;
char *obj_type;
@ -299,9 +340,30 @@ int bs_sap_bom(EPM_action_message_t msg)
String^ url = convert_to_cstring(pref_vals[1]);
String^ user = convert_to_cstring(pref_vals[2]);
String^ password = convert_to_cstring(pref_vals[3]);
bool has_99 = false;
BOM_create_window(&win);
for (int i = 0; i < att_count; i++)
{
if (isTypeOf(attachments[i], "PSBOMViewRevision"))
{
tag_t top_line, rev;
char *id;
BOM_set_window_top_line_bvr(win, attachments[i], &top_line);
if (top_line == NULLTAG)
continue;
AOM_ask_value_tag(top_line, "bl_line_object", &rev);
if (rev == NULLTAG)
continue;
AOM_ask_value_string(rev, "item_id", &id);
if(id[0]=='9'&&id[1]=='9')
{
has_99 = true;
break;
}
}
}
printf("has _99:%d\n", has_99);
for (int i = 0; i < att_count; i++)
{
if (isTypeOf(attachments[i], "PSBOMViewRevision"))
{
@ -311,9 +373,24 @@ int bs_sap_bom(EPM_action_message_t msg)
tag_t top_line, *lines, rev, *rels;
char *id, *werks, *stlan,*hl;
BOM_set_window_top_line_bvr(win, attachments[i], &top_line);
if (top_line == NULLTAG)
continue;
AOM_ask_value_tag(top_line, "bl_line_object", &rev);
if (rev == NULLTAG)
continue;
GRM_list_secondary_objects_only(rev, relation_type, &rel_cnt, &rels);
AOM_ask_value_string(rev, "item_id", &id);
if(has_99)
{
if (id[0] != '9' || id[1] != '9')
{
printf("not 99:%s\n", id);
continue;
}
printf(" 99:%s\n", id);
}
AOM_ask_value_string(rels[0], "jd2_gc", &werks);
AOM_ask_value_string(rels[0], "jd2_BOMyt", &stlan);
AOM_UIF_ask_value(rev, "jd2_ishl", &hl);

Loading…
Cancel
Save