zouxk 5 years ago
parent 4688dcce4a
commit ddfec8755d

@ -1,7 +1,6 @@
#include "util.h" #include "util.h"
int bs_sap_material(EPM_action_message_t msg) int bs_sap_material(EPM_action_message_t msg) {
{
printf("start sap material\n"); printf("start sap material\n");
int ifail = ITK_ok, att_count; int ifail = ITK_ok, att_count;
tag_t rootTask, *attachments, relation_type; tag_t rootTask, *attachments, relation_type;
@ -15,25 +14,21 @@ int bs_sap_material(EPM_action_message_t msg)
TC_argument_list_t * arguments = msg.arguments; TC_argument_list_t * arguments = msg.arguments;
int arg_cnt = TC_number_of_arguments(arguments), status = 0; int arg_cnt = TC_number_of_arguments(arguments), status = 0;
POM_AM__set_application_bypass(true); POM_AM__set_application_bypass(true);
map<string, string> paras,rel_map; map<string, string> paras, rel_map;
map<string, string> prop_map; map<string, string> prop_map;
vector<string> rel_vec; vector<string> rel_vec;
for (auto i = 0; i < arg_cnt; i++) for (auto i = 0; i < arg_cnt; i++) {
{
char *temp_key, *temp_val; char *temp_key, *temp_val;
ITK_ask_argument_named_value(TC_next_argument(arguments), &temp_key, &temp_val); ITK_ask_argument_named_value(TC_next_argument(arguments), &temp_key, &temp_val);
paras[temp_key] = temp_val; paras[temp_key] = temp_val;
} }
string d0 = "D00", d1 = "D0"; string d0 = "D00", d1 = "D0";
for(int i=0;i<67;i++) for (int i = 0;i < 67;i++) {
{ if (i > 8) {
if(i>8)
{ class_map[1000 + i] = d1 + to_string(i + 1);
} else {
class_map[1000+i] = d1 + to_string(i + 1);
}else
{
class_map[1000 + i] = d0 + to_string(i + 1); class_map[1000 + i] = d0 + to_string(i + 1);
} }
} }
@ -41,24 +36,20 @@ int bs_sap_material(EPM_action_message_t msg)
PREF_ask_char_values("connor_sap", &pref_cnt, &pref_vals); PREF_ask_char_values("connor_sap", &pref_cnt, &pref_vals);
split(pref_vals[4], ",", &rel_vec); split(pref_vals[4], ",", &rel_vec);
for(int i=0;i<rel_vec.size();i++) for (int i = 0;i < rel_vec.size();i++) {
{
vector<string> temp_vec; vector<string> temp_vec;
split(rel_vec[i], "=", &temp_vec); split(rel_vec[i], "=", &temp_vec);
if(temp_vec.size()==2) if (temp_vec.size() == 2) {
{
rel_map[temp_vec[0]] = temp_vec[1]; rel_map[temp_vec[0]] = temp_vec[1];
} }
} }
vector<string> rel_vec2; vector<string> rel_vec2;
split(pref_vals[5], ",", &rel_vec2); split(pref_vals[5], ",", &rel_vec2);
for (int i = 0; i<rel_vec2.size(); i++) for (int i = 0; i < rel_vec2.size(); i++) {
{
vector<string> temp_vec; vector<string> temp_vec;
split(rel_vec2[i], "=", &temp_vec); split(rel_vec2[i], "=", &temp_vec);
if (temp_vec.size() == 2) if (temp_vec.size() == 2) {
{
prop_map[temp_vec[0]] = temp_vec[1]; prop_map[temp_vec[0]] = temp_vec[1];
} }
} }
@ -87,24 +78,19 @@ int bs_sap_material(EPM_action_message_t msg)
// prop_map["GEWEI"] = "jd2_zldw"; // prop_map["GEWEI"] = "jd2_zldw";
// prop_map["CLASS"] = "jd2_wllx"; // prop_map["CLASS"] = "jd2_wllx";
printf("start111\n"); printf("start111\n");
for (int i = 0; i < att_count; i++) for (int i = 0; i < att_count; i++) {
{ if (isTypeOf(attachments[i], "Form")) {
if (isTypeOf(attachments[i], "Form")) int rel_cnt, *levels;
{ tag_t *rels, rev = NULLTAG, form;
int rel_cnt,*levels;
tag_t *rels,rev=NULLTAG,form;
char **relations; char **relations;
form = attachments[i]; form = attachments[i];
WSOM_where_referenced2(form, 1, &rel_cnt, &levels, &rels, &relations); WSOM_where_referenced2(form, 1, &rel_cnt, &levels, &rels, &relations);
for(int j=0;j<rel_cnt;j++) for (int j = 0;j < rel_cnt;j++) {
{ if (tc_strcmp(relations[j], "IMAN_master_form") == 0) {
if(tc_strcmp(relations[j],"IMAN_master_form")==0)
{
rev = rels[j]; rev = rels[j];
} }
} }
if(rev==NULLTAG) if (rev == NULLTAG) {
{
printf("revision get error\n"); printf("revision get error\n");
continue; continue;
} }
@ -112,17 +98,14 @@ int bs_sap_material(EPM_action_message_t msg)
AOM_ask_value_string(rev, "item_id", &item_id); AOM_ask_value_string(rev, "item_id", &item_id);
// GRM_list_secondary_objects_only(attachments[i], relation_type, &rel_cnt, &rels); // 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^>(); 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++) for (auto j = prop_map.begin(); j != prop_map.end(); j++) {
{ char *val = "";
char *val="";
string temp_val; string temp_val;
if (j->second == "item_id") if (j->second == "item_id") {
{
AOM_ask_value_string(rev, j->second.c_str(), &val); AOM_ask_value_string(rev, j->second.c_str(), &val);
temp_val = val; temp_val = val;
} } else if (j->second == "release_status_list") {
else if (j->second == "release_status_list") {
// int status_cnt; // int status_cnt;
// tag_t *rel_status; // tag_t *rel_status;
// AOM_ask_value_tags(form, j->second.c_str(), &status_cnt, &rel_status); // AOM_ask_value_tags(form, j->second.c_str(), &status_cnt, &rel_status);
@ -130,13 +113,10 @@ int bs_sap_material(EPM_action_message_t msg)
// AOM_UIF_ask_value(rel_status[status_cnt - 1], "object_string", &val); // AOM_UIF_ask_value(rel_status[status_cnt - 1], "object_string", &val);
// temp_val = rel_map[val]; // temp_val = rel_map[val];
temp_val = paras["status"]; temp_val = paras["status"];
}else if(j->second=="jd2_dldw") } else if (j->second == "jd2_dldw") {
{
AOM_UIF_ask_value(form, j->second.c_str(), &val); AOM_UIF_ask_value(form, j->second.c_str(), &val);
temp_val = val; temp_val = val;
} } else {
else
{
tag_t lov; tag_t lov;
AOM_ask_lov(form, j->second.c_str(), &lov); AOM_ask_lov(form, j->second.c_str(), &lov);
if (lov) if (lov)
@ -149,17 +129,14 @@ int bs_sap_material(EPM_action_message_t msg)
} }
tag_t class_obj; tag_t class_obj;
ICS_ask_classification_object(rev, &class_obj); ICS_ask_classification_object(rev, &class_obj);
if (class_obj) if (class_obj) {
{
char ***vals; char ***vals;
int cnt, *ids,*val_count; int cnt, *ids, *val_count;
ICS_ico_ask_attributes(class_obj, &cnt, &ids, &val_count, &vals); ICS_ico_ask_attributes(class_obj, &cnt, &ids, &val_count, &vals);
for(int j=0;j<cnt;j++) for (int j = 0;j < cnt;j++) {
{
printf("id:%d\n", ids[j]); printf("id:%d\n", ids[j]);
if(class_map.find(ids[j])!=class_map.end()) if (class_map.find(ids[j]) != class_map.end()) {
{ if (val_count[j])
if(val_count[j])
dic[convert_to_cstring(class_map[ids[j]].c_str())] = convert_to_cstring(vals[j][0]); dic[convert_to_cstring(class_map[ids[j]].c_str())] = convert_to_cstring(vals[j][0]);
} }
} }
@ -169,8 +146,7 @@ int bs_sap_material(EPM_action_message_t msg)
dic["KLART"] = "001"; dic["KLART"] = "001";
string result = ConvertToString(test->send_material(url, user, password, dic)); string result = ConvertToString(test->send_material(url, user, password, dic));
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') {
{
char *val; char *val;
AOM_ask_value_string(rev, "item_id", &val); AOM_ask_value_string(rev, "item_id", &val);
stringstream err; stringstream err;
@ -181,7 +157,6 @@ int bs_sap_material(EPM_action_message_t msg)
return 1; return 1;
} }
} }
} }
@ -191,24 +166,21 @@ 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,boolean is_hl,boolean is_judge) 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) if (a_list->Count == 0) {
{ pid = pid.length() > 0 ? pid : id;
pid = pid.length()>0?pid:id;
int index = pid.find('-'); int index = pid.find('-');
if (index != -1) if (index != -1)
pid = pid.substr(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^>();
dic["MATNR"] = convert_to_cstring(pid.length()>0?pid.c_str():id); dic["MATNR"] = convert_to_cstring(pid.length() > 0 ? pid.c_str() : id);
dic["WERKS"] = convert_to_cstring(werks); dic["WERKS"] = convert_to_cstring(werks);
dic["STLAN"] = convert_to_cstring(stlan); dic["STLAN"] = convert_to_cstring(stlan);
dic["BMENG"] = "1"; dic["BMENG"] = "1";
@ -226,8 +198,8 @@ void get_bom(System::Collections::Generic::List<System::Collections::Generic::Di
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);
dic["STLAL"] = is_hl ? convert_to_cstring("02") : convert_to_cstring("01"); dic["STLAL"] = is_hl ? convert_to_cstring("02") : convert_to_cstring("01");
char *val1, *val2,*hl,*sffs; 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);
@ -238,66 +210,55 @@ void get_bom(System::Collections::Generic::List<System::Collections::Generic::Di
AOM_ask_value_string(lines[j], "JD2_SFHL", &sffs); AOM_ask_value_string(lines[j], "JD2_SFHL", &sffs);
printf("JD2_SFHL:%s\n", sffs); printf("JD2_SFHL:%s\n", sffs);
string quantity; string quantity;
if(tc_strcmp(sffs,"1")==0) if (tc_strcmp(sffs, "1") == 0) {
{
AOM_ask_value_string(lines[j], "JD2_sl", &val); AOM_ask_value_string(lines[j], "JD2_sl", &val);
quantity = val; quantity = val;
int index = quantity.find('.'); int index = quantity.find('.');
if(index!=-1&&quantity.length()>(index + 3)) if (index != -1 && quantity.length() > (index + 3)) {
{
quantity = quantity.substr(0, index + 3); quantity = quantity.substr(0, index + 3);
} }
}else } else {
{
AOM_ask_value_string(lines[j], "bl_quantity", &val); AOM_ask_value_string(lines[j], "bl_quantity", &val);
quantity = val; quantity = val;
} }
dic["MENGE"] = convert_to_cstring(quantity.c_str()); dic["MENGE"] = convert_to_cstring(quantity.c_str());
if(is_judge){ if (is_judge) {
if (rel_cnt) 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);
} }
char *obj_str; char *obj_str;
AOM_ask_value_string(lines[j], "object_string", &obj_str); AOM_ask_value_string(lines[j], "object_string", &obj_str);
if (tc_strcmp(val1, "F") == 0 && tc_strcmp(val2, "50") == 0) if (tc_strcmp(val1, "F") == 0 && tc_strcmp(val2, "50") == 0) {
{ printf("has f50:%s\n", obj_str);
printf("has f50:%s\n",obj_str);
continue; continue;
} }
if (tc_strcmp(val1, "F") == 0 && tc_strcmp(val2, "10") == 0) if (tc_strcmp(val1, "F") == 0 && tc_strcmp(val2, "10") == 0) {
{
printf("has f10:%s\n", obj_str); printf("has f10:%s\n", obj_str);
a_list->Add(dic); a_list->Add(dic);
continue; continue;
} }
if (tc_strcmp(val1, "F") == 0 && tc_strlen(val2) == 0) if (tc_strcmp(val1, "F") == 0 && tc_strlen(val2) == 0) {
{
printf("has fempty:%s\n", obj_str); printf("has fempty:%s\n", obj_str);
a_list->Add(dic); a_list->Add(dic);
continue; continue;
} }
if (tc_strcmp(val1, "E") == 0 && tc_strlen(val2) == 0) if (tc_strcmp(val1, "E") == 0 && tc_strlen(val2) == 0) {
{
printf("has fempty:%s\n", obj_str); printf("has fempty:%s\n", obj_str);
a_list->Add(dic); a_list->Add(dic);
continue; continue;
} }
if (tc_strcmp(val1, "E") == 0 && tc_strcmp(val2, "50") == 0) if (tc_strcmp(val1, "E") == 0 && tc_strcmp(val2, "50") == 0) {
{
printf("has e50:%s\n", obj_str); printf("has e50:%s\n", obj_str);
if(pid.length()>0) if (pid.length() > 0) {
{ printf("obj:%s pid:%s\n", obj_str, pid.c_str());
printf("obj:%s pid:%s\n",obj_str,pid.c_str()); } else {
}else
{
printf("obj:%s pid:%s\n", obj_str, id); 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); get_bom(a_list, lines[j], werks, stlan, pid.length() > 0 ? pid : 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)
@ -308,12 +269,11 @@ void get_bom(System::Collections::Generic::List<System::Collections::Generic::Di
} }
a_list->Add(dic); a_list->Add(dic);
get_bom(a_list, lines[j], werks, stlan,"",relation_type, child_is_hl, is_judge); 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 bom2\n"); printf("start sap bom2\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;
@ -328,8 +288,7 @@ int bs_sap_bom(EPM_action_message_t msg)
POM_AM__set_application_bypass(true); POM_AM__set_application_bypass(true);
map<string, string> paras; map<string, string> paras;
for (auto i = 0; i < arg_cnt; i++) for (auto i = 0; i < arg_cnt; i++) {
{
char *temp_key, *temp_val; char *temp_key, *temp_val;
ITK_ask_argument_named_value(TC_next_argument(arguments), &temp_key, &temp_val); ITK_ask_argument_named_value(TC_next_argument(arguments), &temp_key, &temp_val);
paras[temp_key] = temp_val; paras[temp_key] = temp_val;
@ -342,10 +301,8 @@ int bs_sap_bom(EPM_action_message_t msg)
String^ password = convert_to_cstring(pref_vals[3]); String^ password = convert_to_cstring(pref_vals[3]);
bool has_99 = false; bool has_99 = false;
BOM_create_window(&win); BOM_create_window(&win);
for (int i = 0; i < att_count; i++) for (int i = 0; i < att_count; i++) {
{ if (isTypeOf(attachments[i], "PSBOMViewRevision")) {
if (isTypeOf(attachments[i], "PSBOMViewRevision"))
{
tag_t top_line, rev; tag_t top_line, rev;
char *id; char *id;
BOM_set_window_top_line_bvr(win, attachments[i], &top_line); BOM_set_window_top_line_bvr(win, attachments[i], &top_line);
@ -355,23 +312,20 @@ int bs_sap_bom(EPM_action_message_t msg)
if (rev == NULLTAG) if (rev == NULLTAG)
continue; continue;
AOM_ask_value_string(rev, "item_id", &id); AOM_ask_value_string(rev, "item_id", &id);
if(id[0]=='9'&&id[1]=='9') if (id[0] == '9'&&id[1] == '9') {
{
has_99 = true; has_99 = true;
break; break;
} }
} }
} }
printf("has _99:%d\n", has_99); printf("has _99:%d\n", has_99);
for (int i = 0; i < att_count; i++) for (int i = 0; i < att_count; i++) {
{ if (isTypeOf(attachments[i], "PSBOMViewRevision")) {
if (isTypeOf(attachments[i], "PSBOMViewRevision"))
{
printf("execute\n"); printf("execute\n");
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,*hl; 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);
if (top_line == NULLTAG) if (top_line == NULLTAG)
continue; continue;
@ -380,10 +334,8 @@ int bs_sap_bom(EPM_action_message_t msg)
continue; continue;
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);
if(has_99) if (has_99) {
{ if (id[0] != '9' || id[1] != '9') {
if (id[0] != '9' || id[1] != '9')
{
printf("not 99:%s\n", id); printf("not 99:%s\n", id);
continue; continue;
@ -394,16 +346,15 @@ int bs_sap_bom(EPM_action_message_t msg)
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); AOM_UIF_ask_value(rev, "jd2_ishl", &hl);
boolean is_hl = tc_strcmp(hl,"ÊÇ")?false:true; 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'; boolean is_judege = id[0] == '9'&&id[1] == '9';
get_bom(a_list, top_line, werks, stlan,"", relation_type,is_hl,is_judege); 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); BOM_close_window(win);
POM_AM__set_application_bypass(false); 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());

@ -50,6 +50,8 @@ int jd_schedule_joint(EPM_action_message_t msg);
int jd_batch_process(EPM_action_message_t msg); int jd_batch_process(EPM_action_message_t msg);
int jd_add_attachments(EPM_action_message_t msg); int jd_add_attachments(EPM_action_message_t msg);
int jd_check_99_bomyt(EPM_rule_message_t msg); int jd_check_99_bomyt(EPM_rule_message_t msg);
int jd_send_mail(EPM_action_message_t msg);
int jd_get_target(EPM_action_message_t msg);
////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣǩ<CFA2><C7A9><EFBFBD><E6B1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥ ////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣǩ<CFA2><C7A9><EFBFBD><E6B1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥ
//int qtmc_sign_ir(EPM_action_message_t msg); //int qtmc_sign_ir(EPM_action_message_t msg);

@ -168,6 +168,20 @@ extern DLLAPI int CUST_init_module(int *decision, va_list args)
printf("register jd_check_99_bomyt successfully\n"); printf("register jd_check_99_bomyt successfully\n");
} }
ifail = EPM_register_action_handler("jd_send_mail", "jd_send_mail",
(EPM_action_handler_t)jd_send_mail);
if (ifail) {
printf("register jd_send_mail failed\n");
} else {
printf("register jd_send_mail successfully\n");
}
ifail = EPM_register_action_handler("jd_get_target", "jd_get_target",
(EPM_action_handler_t)jd_get_target);
if (ifail) {
printf("register jd_get_target failed\n");
} else {
printf("register jd_get_target successfully\n");
}
//if(ifail == ITK_ok) //if(ifail == ITK_ok)
//{ //{
// fprintf(stdout,"Registering action handler qtmc-sign-ir completed!\n"); // fprintf(stdout,"Registering action handler qtmc-sign-ir completed!\n");

@ -87,8 +87,9 @@ int jd_batch_process(EPM_action_message_t msg) {
EPM_ask_root_task(msg.task, &rootTask); EPM_ask_root_task(msg.task, &rootTask);
EPM_ask_job(msg.task, &job); EPM_ask_job(msg.task, &job);
EPM_ask_attachments(rootTask, EPM_target_attachment, &att_count, &attachments); EPM_ask_attachments(rootTask, EPM_target_attachment, &att_count, &attachments);
if (att_count < 2) if (att_count < 2) {
return 0; return 0;
}
printf("att_count:%d\n", att_count); printf("att_count:%d\n", att_count);
AOM_ask_value_tag(job, "process_template", &process_template); AOM_ask_value_tag(job, "process_template", &process_template);
vector<tag_t> process_vec; vector<tag_t> process_vec;

@ -103,18 +103,19 @@ int jd_check_99_bomyt(EPM_rule_message_t msg) {
AOM_ask_value_string(attachments[i], "object_string", &name); AOM_ask_value_string(attachments[i], "object_string", &name);
printf("name=====>%s\n", name); printf("name=====>%s\n", name);
if (is_begin_with(name, "99")) { if (is_begin_with(name, "99")) {
tag_t form = NULLTAG; tag_t *forms;
int form_cnt;
if (isTypeOf(attachments[i], "ItemRevision")) { if (isTypeOf(attachments[i], "ItemRevision")) {
AOM_ask_value_tag(attachments[i], "IMAN_master_form_rev", &form); AOM_ask_value_tags(attachments[i], "IMAN_master_form_rev", &form_cnt, &forms);
} else if (isTypeOf(attachments[i], "Item")) { } else if (isTypeOf(attachments[i], "Item")) {
tag_t *revs; tag_t *revs;
int rev_cnt; int rev_cnt;
AOM_ask_value_tags(attachments[i], "revision_list", &rev_cnt, &revs); AOM_ask_value_tags(attachments[i], "revision_list", &rev_cnt, &revs);
AOM_ask_value_tag(revs[rev_cnt - 1], "IMAN_master_form_rev", &form); AOM_ask_value_tags(revs[rev_cnt - 1], "IMAN_master_form_rev", &form_cnt, &forms);
} }
if (form != NULLTAG) { if (form_cnt > 0) {
char *prop; char *prop;
AOM_ask_value_string(form, "jd2_BOMyt", &prop); AOM_ask_value_string(forms[0], "jd2_BOMyt", &prop);
if (tc_strcmp(prop, "5") == 0) { if (tc_strcmp(prop, "5") == 0) {
ifail = EPM_go; ifail = EPM_go;
} }

@ -51,6 +51,7 @@
#include "tchar.h" #include "tchar.h"
#include "ics/ics.h" #include "ics/ics.h"
#include "ics/ics2.h" #include "ics/ics2.h"
#include <fstream>
#using "./declib.dll" #using "./declib.dll"
using namespace std; using namespace std;

Loading…
Cancel
Save