|
|
|
@ -31,7 +31,7 @@ const char* newGUID()
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int send_erp(tag_t top_line,int type,string &now,char **pref_vals, Testclass ^class1, System::String ^save_url, System::String ^check_url, vector<map<string,string>> &configs,map<string,map<string,map<string,string>>> &zl_map, System::String ^key,string creation_date)
|
|
|
|
|
int send_erp(tag_t top_line,int type,string &now,char **pref_vals, Testclass ^class1, System::String ^save_url, System::String ^check_url, vector<map<string,string>> &configs,map<string,map<string,map<string,string>>> &zl_map, System::String ^key,string creation_date,map<string,string> &stock_map)
|
|
|
|
|
{
|
|
|
|
|
printf("send_erp\n");
|
|
|
|
|
int line_cnt,rel_cnt;
|
|
|
|
@ -181,16 +181,11 @@ int send_erp(tag_t top_line,int type,string &now,char **pref_vals, Testclass ^cl
|
|
|
|
|
Value stock_val(kObjectType);
|
|
|
|
|
string stock = get_val(lines[j], "KL3_flck");
|
|
|
|
|
printf("stock:%s\n", stock.c_str());
|
|
|
|
|
|
|
|
|
|
if(stock=="注塑车间现场仓"||stock=="zscjxcc")
|
|
|
|
|
{
|
|
|
|
|
stock_val.AddMember("FNumber", "38", al);
|
|
|
|
|
stock_val.AddMember("FName", "注塑车间现场仓", al);
|
|
|
|
|
}else if (stock == "胶条车间现场仓" || stock == "jtcjxcc")
|
|
|
|
|
{
|
|
|
|
|
stock_val.AddMember("FNumber", "39", al);
|
|
|
|
|
stock_val.AddMember("FName", "胶条车间现场仓", al);
|
|
|
|
|
}else
|
|
|
|
|
if(stock_map.find(stock)!=stock_map.end()){
|
|
|
|
|
stock_val.AddMember("FNumber", Value().SetString(stock_map[stock].c_str(), al), al);
|
|
|
|
|
stock_val.AddMember("FName", Value().SetString(stock.c_str(), al), al);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
stock_val.AddMember("FNumber", "", al);
|
|
|
|
|
stock_val.AddMember("FName", "", al);
|
|
|
|
@ -340,23 +335,33 @@ int send_erp(tag_t top_line,int type,string &now,char **pref_vals, Testclass ^cl
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
int erp_bom(tag_t task, string key_str, string pref1, string pref2)
|
|
|
|
|
int erp_bom(tag_t task, string key_str, string pref1, string pref2,string pref3)
|
|
|
|
|
{
|
|
|
|
|
printf("erp_bom start\n");
|
|
|
|
|
tag_t root_task, *atts, win;
|
|
|
|
|
int att_cnt;
|
|
|
|
|
EPM_ask_root_task(task, &root_task);
|
|
|
|
|
EPM_ask_attachments(root_task, EPM_target_attachment, &att_cnt, &atts);
|
|
|
|
|
int pref_cnt, pref_cnt2;
|
|
|
|
|
char **pref_vals, **pref_vals2;
|
|
|
|
|
int pref_cnt, pref_cnt2,pref_cnt3;
|
|
|
|
|
char **pref_vals, **pref_vals2,**pref_vals3;
|
|
|
|
|
PREF_ask_char_values(pref1.c_str(), &pref_cnt, &pref_vals);
|
|
|
|
|
PREF_ask_char_values(pref2.c_str(), &pref_cnt2, &pref_vals2);
|
|
|
|
|
PREF_ask_char_values(pref3.c_str(), &pref_cnt3, &pref_vals3);
|
|
|
|
|
|
|
|
|
|
vector<map<string,string>> configs;
|
|
|
|
|
Document doc;
|
|
|
|
|
doc.SetObject();
|
|
|
|
|
Document::AllocatorType &al = doc.GetAllocator();
|
|
|
|
|
map<string, map<string, map<string,string>>> zl_map;
|
|
|
|
|
string creation_date = getTime2();
|
|
|
|
|
map<string,string> stock_map;
|
|
|
|
|
for(auto i=0;i<pref_cnt3;i++){
|
|
|
|
|
string temp=pref_vals3[i];
|
|
|
|
|
auto index=temp.find('=');
|
|
|
|
|
if(index!=-1){
|
|
|
|
|
stock_map[temp.substr(0,index)]=temp.substr(index+1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (auto i = 0; i<pref_cnt2; i++)
|
|
|
|
|
{
|
|
|
|
|
if(i==4)
|
|
|
|
@ -429,7 +434,7 @@ int erp_bom(tag_t task, string key_str, string pref1, string pref2)
|
|
|
|
|
// if (id[0] != 'C')
|
|
|
|
|
// continue;
|
|
|
|
|
|
|
|
|
|
int result=send_erp(top_line, 0, now, pref_vals, class1, save_url, check_url,configs,zl_map,key,creation_date);
|
|
|
|
|
int result=send_erp(top_line, 0, now, pref_vals, class1, save_url, check_url,configs,zl_map,key,creation_date,stock_map);
|
|
|
|
|
if (result)
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
@ -442,7 +447,7 @@ int erp_bom(tag_t task, string key_str, string pref1, string pref2)
|
|
|
|
|
int kl_erp_bom(EPM_action_message_t msg)
|
|
|
|
|
{
|
|
|
|
|
int arg_cnt = TC_number_of_arguments(msg.arguments);
|
|
|
|
|
string key, pref1, pref2;
|
|
|
|
|
string key, pref1, pref2,pref3;
|
|
|
|
|
for (auto i = 0; i<arg_cnt; i++)
|
|
|
|
|
{
|
|
|
|
|
char *temp_key, *temp_val;
|
|
|
|
@ -458,11 +463,16 @@ int kl_erp_bom(EPM_action_message_t msg)
|
|
|
|
|
else if (tc_strcmp(temp_key, "pref2")==0)
|
|
|
|
|
{
|
|
|
|
|
pref2 = temp_val;
|
|
|
|
|
}else if (tc_strcmp(temp_key, "pref3")==0)
|
|
|
|
|
{
|
|
|
|
|
pref3 = temp_val;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("key:%s\n", key.c_str());
|
|
|
|
|
printf("pref1:%s\n", pref1.c_str());
|
|
|
|
|
printf("pref2:%s\n", pref2.c_str());
|
|
|
|
|
return erp_bom(msg.task, key, pref1, pref2);
|
|
|
|
|
printf("pref3:%s\n", pref3.c_str());
|
|
|
|
|
|
|
|
|
|
return erp_bom(msg.task, key, pref1, pref2,pref3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|