合并整理

main
zouxk 5 years ago
parent bce2b87039
commit dd6137ddda

@ -166,8 +166,8 @@ 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,vector<string> &bom_ids) 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, vector<string> &bom_ids) {
{ 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;
@ -175,11 +175,10 @@ void get_bom(System::Collections::Generic::List<System::Collections::Generic::Di
if (find(bom_ids.begin(), bom_ids.end(), id) != bom_ids.end()) if (find(bom_ids.begin(), bom_ids.end(), id) != bom_ids.end())
return; return;
bom_ids.push_back(id); bom_ids.push_back(id);
if(a_list->Count==0) if (a_list->Count == 0) {
{ pid = pid.length() > 0 ? pid : id; int index = pid.find('-');
pid = pid.length()>0?pid:id; int index = pid.find('-');
if (index != -1) if (index != -1)
pid = pid.substr(0,index); pid = pid.substr(0, index);
} }
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^>();
@ -191,7 +190,7 @@ void get_bom(System::Collections::Generic::List<System::Collections::Generic::Di
dic["POSTP"] = "L"; dic["POSTP"] = "L";
char *val; char *val;
AOM_UIF_ask_value(lines[j], "bl_sequence_no", &val); AOM_UIF_ask_value(lines[j], "bl_sequence_no", &val);
if(!is_judge) if (!is_judge)
dic["POSNR"] = convert_to_cstring(val); dic["POSNR"] = convert_to_cstring(val);
char *child_id; char *child_id;
AOM_UIF_ask_value(lines[j], "bl_child_id", &child_id); AOM_UIF_ask_value(lines[j], "bl_child_id", &child_id);
@ -219,8 +218,8 @@ void get_bom(System::Collections::Generic::List<System::Collections::Generic::Di
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 + 4)) if (index != -1 && quantity.length() > (index + 4)) {
{ quantity = quantity.substr(0,index + 4); quantity = quantity.substr(0, index + 4);
} }
} else { } else {
AOM_ask_value_string(lines[j], "bl_quantity", &val); AOM_ask_value_string(lines[j], "bl_quantity", &val);
@ -263,7 +262,7 @@ void get_bom(System::Collections::Generic::List<System::Collections::Generic::Di
} 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,bom_ids); get_bom(a_list, lines[j], werks, stlan, pid.length() > 0 ? pid : id, relation_type, child_is_hl, is_judge, bom_ids);
continue; continue;
} }
// if (tc_strcmp(val1, "F") == 0 && tc_strlen(val2) == 0) // if (tc_strcmp(val1, "F") == 0 && tc_strlen(val2) == 0)
@ -274,7 +273,7 @@ get_bom(a_list, lines[j], werks, stlan, pid.length()>0 ? pid : id, relation_type
} }
a_list->Add(dic); a_list->Add(dic);
get_bom(a_list, lines[j], werks, stlan,"",relation_type, child_is_hl, is_judge,bom_ids); get_bom(a_list, lines[j], werks, stlan, "", relation_type, child_is_hl, is_judge, bom_ids);
} }
} }
@ -325,10 +324,9 @@ int bs_sap_bom(EPM_action_message_t msg) {
} }
printf("has _99:%d\n", has_99); printf("has _99:%d\n", has_99);
vector<string> bom_ids; vector<string> bom_ids;
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;
@ -344,10 +342,9 @@ int bs_sap_bom(EPM_action_message_t msg) {
if (find(bom_ids.begin(), bom_ids.end(), id) != bom_ids.end()) if (find(bom_ids.begin(), bom_ids.end(), id) != bom_ids.end())
continue; continue;
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;
} }
@ -362,7 +359,7 @@ int bs_sap_bom(EPM_action_message_t msg) {
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,bom_ids); get_bom(a_list, top_line, werks, stlan, "", relation_type, is_hl, is_judege, bom_ids);
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') {

@ -53,7 +53,6 @@ extern "C" {
int jd_send_mail(EPM_action_message_t msg); int jd_send_mail(EPM_action_message_t msg);
int jd_get_target(EPM_action_message_t msg); int jd_get_target(EPM_action_message_t msg);
int jd_check_wlms_len(EPM_rule_message_t msg); int jd_check_wlms_len(EPM_rule_message_t msg);
int jd_check_wlms_len(EPM_rule_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);

@ -1,43 +1,34 @@
#include "util.h" #include "util.h"
int jd_check_wlms_len(EPM_rule_message_t msg) int jd_check_wlms_len(EPM_rule_message_t msg) {
{
POM_AM__set_application_bypass(true); POM_AM__set_application_bypass(true);
tag_t root_task, *attachments; tag_t root_task, *attachments;
int att_cnt; int att_cnt;
EPM_ask_root_task(msg.task, &root_task); EPM_ask_root_task(msg.task, &root_task);
//获得根任务下的组件 //获得根任务下的组件
EPM_ask_attachments(root_task, EPM_target_attachment, &att_cnt,&attachments); EPM_ask_attachments(root_task, EPM_target_attachment, &att_cnt, &attachments);
for (int i = 0; i < att_cnt; i++) for (int i = 0; i < att_cnt; i++) {
{ if (isTypeOf(attachments[i], "ItemRevision")) {
if (isTypeOf(attachments[i],"ItemRevision"))
{
int form_att; int form_att;
tag_t *forms; tag_t *forms;
AOM_ask_value_tags(attachments[i], "IMAN_master_form_rev", &form_att, &forms); AOM_ask_value_tags(attachments[i], "IMAN_master_form_rev", &form_att, &forms);
if (form_att==0) if (form_att == 0) {
{
continue; continue;
} }
char *wlms; char *wlms;
AOM_ask_value_string(forms[0], "jd2_wlms", &wlms); AOM_ask_value_string(forms[0], "jd2_wlms", &wlms);
cout << "jd2_wlms" << wlms << endl; cout << "jd2_wlms" << wlms << endl;
int length=0; int length = 0;
for (int i = 0; wlms[i]!=0; i++) for (int i = 0; wlms[i] != 0; i++) {
{ if (wlms[i] < 128 && wlms[i]>0) {
if (wlms[i]<128&& wlms[i]>0)
{
length++; length++;
} } else {
else
{
i += 2; i += 2;
length++; length++;
} }
} }
cout << "length: " << length << endl; cout << "length: " << length << endl;
if (length>40) if (length > 40) {
{
POM_AM__set_application_bypass(false); POM_AM__set_application_bypass(false);
return EMH_store_error_s1(EMH_severity_error, EMH_IDGENERATION_ERROR_BASE, "字符不能超过40!!!"); return EMH_store_error_s1(EMH_severity_error, EMH_IDGENERATION_ERROR_BASE, "字符不能超过40!!!");
} }
@ -45,31 +36,4 @@ int jd_check_wlms_len(EPM_rule_message_t msg)
POM_AM__set_application_bypass(false); POM_AM__set_application_bypass(false);
return EPM_go; return EPM_go;
} }
}#include "util.h"
int jd_check_wlms_len(EPM_rule_message_t msg) {
POM_AM__set_application_bypass(true);
tag_t root_task, *attachments;
int att_cnt;
EPM_ask_root_task(msg.task, &root_task);
EPM_ask_attachments(root_task, EPM_target_attachment, &att_cnt, &attachments);
for (int i = 0;i < att_cnt;i++) {
if (isTypeOf(attachments[i], "ItemRevision")) {
int form_cnt;
tag_t *forms;
AOM_ask_value_tags(attachments[i], "IMAN_master_form_rev", &form_cnt, &forms);
if (form_cnt == 0) {
continue;
}
char *wlms;
AOM_ask_value_string(forms[0], "jd2_wlms", &wlms);
cout << "jd2_wlms====>" << wlms << endl;
if (tc_strlen(wlms) > 40) {
POM_AM__set_application_bypass(false);
return EMH_store_error_s1(EMH_severity_error, EMH_AE_error_base, "物料描述属性长度过长正确长度应该小于等于40个字符");
}
}
}
POM_AM__set_application_bypass(false);
return EPM_go;
} }

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

@ -1,2 +1,2 @@
#TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=true:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=8.1 #TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=true:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=8.1
Release|x64|C:\Users\89512\Documents\Visual Studio 2015\Projects\itk\| Release|x64|E:\work\vs_workspace\jditk\|

Loading…
Cancel
Save