parent
dd6137ddda
commit
f145efb846
@ -0,0 +1,85 @@
|
||||
#include "util.h"
|
||||
|
||||
int bs_bom_transmit_check(EPM_rule_message_t msg)
|
||||
{
|
||||
POM_AM__set_application_bypass(true);
|
||||
tag_t root_task, *attachments;
|
||||
int att_cnt;
|
||||
|
||||
//获得参数列表
|
||||
TC_argument_list_t * arguments = msg.arguments;
|
||||
//获取参数数目
|
||||
int arg_cnt = TC_number_of_arguments(arguments);
|
||||
map<string, string> arg_map;
|
||||
//遍历参数列表
|
||||
for (auto i = 0; i < arg_cnt; i++)
|
||||
{
|
||||
char *temp_key, *temp_val;
|
||||
ITK_ask_argument_named_value(TC_next_argument(arguments), &temp_key, &temp_val);
|
||||
//参数以键值对的形式传递到arg_map
|
||||
if (temp_val)
|
||||
arg_map[temp_key] = temp_val;
|
||||
|
||||
}
|
||||
|
||||
//获得根节点
|
||||
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_att;
|
||||
tag_t *forms;
|
||||
AOM_ask_value_tags(attachments[i], "IMAN_master_form_rev", &form_att, &forms);
|
||||
|
||||
//遍历参数
|
||||
for (auto j = arg_map.begin(); j != arg_map.end(); j++)
|
||||
{
|
||||
//设置属性
|
||||
ITKCALL(AOM_set_value_string(forms[0], j->first.c_str(), j->second.c_str()));
|
||||
}
|
||||
//保存
|
||||
AOM_save(forms[0]);
|
||||
|
||||
//拿到指定参数判断参数值
|
||||
if (form_att == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
char *cglx, *tscg;
|
||||
AOM_ask_value_string(forms[0], "jd2_cglx", &cglx);
|
||||
AOM_ask_value_string(forms[0], "jd2_tscg", &tscg);
|
||||
cout << "jd2_cglx" << cglx << endl;
|
||||
cout << "jd2_tscg" << tscg << endl;
|
||||
if (strcmp(cglx, "E+") == 0 || strcmp(cglx, "E+50") == 0 || strcmp(tscg, "E+") == 0 || strcmp(tscg, "E+50") == 0)
|
||||
{
|
||||
//判断是否有 BOM 版本视图 structure_revisions 如果存在则可以发起流程
|
||||
int structure_att;
|
||||
tag_t *structures;
|
||||
AOM_ask_value_tags(attachments[i], "structure_revisions", &structure_att, &structures);
|
||||
if (structures == NULL)
|
||||
{
|
||||
POM_AM__set_application_bypass(false);
|
||||
return EMH_store_error_s1(EMH_severity_error, EMH_IDGENERATION_ERROR_BASE, "no BOM");
|
||||
}
|
||||
else
|
||||
{
|
||||
return EPM_go;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
POM_AM__set_application_bypass(false);
|
||||
return EMH_store_error_s1(EMH_severity_error, EMH_IDGENERATION_ERROR_BASE, "This material cannot initiate a process");
|
||||
}
|
||||
}
|
||||
POM_AM__set_application_bypass(false);
|
||||
return EPM_go;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in new issue