sap传递 bom保存更改

main
李岩峰 5 years ago
parent 3f0b1d7bb0
commit 5d25b74fe1

@ -129,7 +129,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;IPLIB=none;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\work\include12_2;C:\work\include_cpp12_2;C:\Java\jdk1.8.0_231\include\win32;C:\Java\jdk1.8.0_231\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>C:\Users\lyf\Documents\tclib\include;C:\Users\lyf\Documents\tclib\include_cpp;C:\Program Files\Java\jdk1.8.0_212\include\win32;C:\Program Files\Java\jdk1.8.0_212\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CallingConvention>Cdecl</CallingConvention>
</ClCompile>
<Link>
@ -139,7 +139,7 @@
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>
</AdditionalLibraryDirectories>
<AdditionalDependencies>C:\work\lib12_2\*.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>C:\Users\lyf\Documents\tclib\tc12\lib\*.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>libuser_exits.ar.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<OutputFile>$(OutDir)\bs.dll</OutputFile>
<AdditionalOptions>/FORCE %(AdditionalOptions)</AdditionalOptions>
@ -160,6 +160,7 @@
<ClCompile Include="bs_sap.cpp" />
<ClCompile Include="bs_signoff.cxx" />
<ClCompile Include="bs_sign_cad.cpp" />
<ClCompile Include="bs_test_release_check.cpp" />
<ClCompile Include="bs_wl_check.cpp" />
<ClCompile Include="epm_register_handler.cxx" />
<ClCompile Include="bs_custom_main.cxx" />

@ -70,6 +70,9 @@
<ClCompile Include="jd_signoff.cpp">
<Filter>epm-handler</Filter>
</ClCompile>
<ClCompile Include="bs_test_release_check.cpp">
<Filter>epm-handler</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="epm_register_handler.h">

@ -1,6 +1,6 @@
#include "util.h"
int save_judge(tag_t top, string &check, string &name, vector<string> &type_vec, vector<string> &quantity_type_vec, stringstream &ss)
void save_judge(tag_t top, string &check, string &name, vector<string> &type_vec, vector<string> &quantity_type_vec, stringstream &ss, stringstream &status_ss)
{
int line_cnt;
tag_t *lines;
@ -29,14 +29,11 @@ int save_judge(tag_t top, string &check, string &name, vector<string> &type_vec,
if (temp.length() == 0 || check.find(temp) != -1)
{
AOM_ask_value_string(lines[i], "bl_rev_object_string", &val);
name = val;
return 1;
status_ss << val << ",";
}
int result = save_judge(lines[i], check, name, type_vec, quantity_type_vec, ss);
if (result)
return result;
save_judge(lines[i], check, name, type_vec, quantity_type_vec, ss,status_ss);
}
return 0;
}
int bs_bom_save_check(METHOD_message_t *msg, va_list args)
@ -53,7 +50,7 @@ int bs_bom_save_check(METHOD_message_t *msg, va_list args)
tag_t win = va_arg(args, tag_t), top;
char *check_val, **type_val, **quantity_type;
string name, check;
stringstream ss;
stringstream ss,status_ss;
int type_cnt, quantity_type_cnt;
PREF_ask_char_value("connor_bom_check_value", 0, &check_val);
PREF_ask_char_values("connor_bom_check_type", &type_cnt, &type_val);
@ -63,14 +60,15 @@ int bs_bom_save_check(METHOD_message_t *msg, va_list args)
check = check_val;
BOM_ask_window_top_line(win, &top);
ifail = save_judge(top, check, name, type_vec, quantity_type_vec, ss);
save_judge(top, check, name, type_vec, quantity_type_vec, ss, status_ss);
if (ss.str().length())
{
ss << "物料数量为空,请填写!\n";
ifail = 2;
ifail = 1;
}
else if (ifail) {
ss << name << "对象为冻结状态或未发布不能保存BOM!";
if (status_ss.str().length()) {
ss << status_ss.str() << "对象为冻结状态或未发布不能保存BOM!\n";
ifail = 1;
}
if (ss.str().length())
EMH_store_error_s1(EMH_severity_user_error, EMH_PROP_error_base, ss.str().c_str());

@ -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')

@ -1,4 +1,4 @@
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.00.24215.1
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.00.24210.0
; Generated by VC++ for Common Language Runtime
.file "C:\Users\5rKB5bPlusD\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttributes.cpp"
.file "C:\Users\lyf\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttributes.cpp"

Loading…
Cancel
Save