You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

722 lines
26 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include "handler.h"
#define ARGS_LENGTH 200
#define MAX_PRINTLINE_LENGTH 2000
#define MAX_PATH_LENGTH 2000
#define MAX_ARGUMENT_LENGTH 400
#define MAX_PARAMNAME_LENGTH 50
#define MAX_FILE_EXT_LENGTH 10
#define TRUE_FLAG 1
#define FALSE_FLAG 0
#define DETAILLOG 1
#define DOFREE(obj) \
{ \
if(obj) \
{ \
MEM_free(obj); \
obj = NULL; \
} \
}
int delete_release_status(EPM_action_message_t msg) {
int ifail = ITK_ok, att_cnt = 0, rel_cnt = 0;
EPM_target_attachment;
tag_t task = NULLTAG, rootTask_tag = NULLTAG, *attchments = NULL, *releases = NULL, release_status = NULL;
ITKCALL(EPM_ask_root_task(msg.task, &rootTask_tag));
ITKCALL(EPM_ask_attachments(rootTask_tag, EPM_target_attachment, &att_cnt, &attchments));
POM_AM__set_application_bypass(true);
for (int i = 0; i < att_cnt; i++)
{
ITKCALL(AOM_ask_value_tags(attchments[i], "release_status_list", &rel_cnt, &releases));
for (int j = rel_cnt - 1; j > -1; j--)
{
EPM_remove_status_from_targets(releases[j], rootTask_tag);
}
}
POM_AM__set_application_bypass(false);
return ifail;
}
/*
* 获取包含中文字符的字符串长度
*/
int getCharLength(char str[])
{
int count = 0;
for (int i = 0; str[i]; i++)
{
if (str[i] < 0) i++;
count++;
}
return count;
}
//发布对象
int set_release_status(tag_t item, char release_name[]) {
int ifail = ITK_ok;
tag_t release_status = NULL;
ITKCALL(ifail = RELSTAT_create_release_status(release_name, &release_status));
ITKCALL(ifail = RELSTAT_add_release_status(release_status, 1, &item, TRUE));
return ifail;
}
bool contans(const char* types, char* type) {
vector<string> ans;
Split(types, ",", ans);
//判断类型
for (int i = 0; i < ans.size(); i++) {
if (strcmp(ans[i].c_str(), type) == 0) {
return true;
}
}
return false;
}
int reviseDesignPost(METHOD_message_t* msg, va_list va)
{
int ifail = ITK_ok, rev_cnt = 0;
tag_t new_rev = va_arg(va, tag_t);
tag_t item = NULLTAG;
tag_t* rev_list = NULLTAG;
POM_AM__set_application_bypass(true);
//力源对象版本升版后操
char* type;
ITKCALL(AOM_ask_value_string(new_rev, "object_type", &type));
ITKCALL(ITEM_ask_item_of_rev(new_rev, &item));
ITKCALL(AOM_ask_value_tags(item, "revision_list", &rev_cnt, &rev_list));
tag_t pre_rev = rev_list[rev_cnt - 2];
//获取首选项匹配类型
int cnt = 0;
char** vals = NULL;
//获取首选项的值
PREF_ask_char_values("LY6_ReviseDesignPost", &cnt, &vals);
for (int i = 0; i < cnt; i++) {
char* val = vals[i];
vector<string> ans;
Split(val, "=", ans);
//判断类型
if (strcmp(ans[0].c_str(), type) == 0) {
printf("%s升版后操开始执行\n", &type);
//获取关系
int wlcount = 0; tag_t* wltags;
ITKCALL(AOM_ask_value_tags(pre_rev, ans[1].c_str(), &wlcount, &wltags));
for (int j = 0; j < wlcount; j++) {
char* wltype;
ITKCALL(AOM_ask_value_string(wltags[j], "object_type", &wltype));
//匹配关系对象类型
if (contans(ans[2].c_str(), wltype)) {
tag_t wlobj;
ITKCALL(ITEM_ask_item_of_rev(wltags[j], &wlobj));
if (wlobj != NULL) {
//获取最新版本
tag_t newwlrev;
int status = ITEM_ask_latest_rev(wlobj, &newwlrev);
if (status == ITK_ok)
{
printf("start 开始删除关系\n");
tag_t gx_gx_type = NULLTAG; tag_t gx_relation = NULLTAG;
ITKCALL(GRM_find_relation_type(ans[1].c_str(), &gx_gx_type));
GRM_find_relation(new_rev, wltags[j], gx_gx_type, &gx_relation);
GRM_delete_relation(gx_relation);
printf("end 删除关系完毕\n");
printf("start 开始添加关系\n");
tag_t relation = NULLTAG;
ITKCALL(GRM_create_relation(new_rev, newwlrev, gx_gx_type, NULLTAG, &relation));
ITKCALL(GRM_save_relation(relation));
printf("end 添加关系完毕\n");
}
}
}
}
break;
}
}
POM_AM__set_application_bypass(false);
return ifail;
}
bool isTypeOf1(tag_t objtag, const char* type_name) {
tag_t type = NULLTAG;
TCTYPE_ask_object_type(objtag, &type);
tag_t item_type = NULLTAG;
TCTYPE_find_type(type_name, "", &item_type);
bool is_type = false;
if (item_type != NULLTAG) {
logical isok = FALSE;
TCTYPE_is_type_of(type, item_type, &isok);
if (isok) {
is_type = true;
}
}
return is_type;
}
/**
* @brief 根据不确定类型的tag_t对象获取item和itemRev对象
* @param check_tag
* @param item_tag
* @param rev_tag
* @return
*/
int get_item_and_rev(tag_t check_tag, tag_t* item_tag, tag_t* rev_tag) {
int ifail = ITK_ok;
if (isTypeOf1(check_tag, "Item")) {
printf("====当前处理的对象是item对象\n");
*item_tag = check_tag;
ITEM_ask_latest_rev(*item_tag, rev_tag);
}
else if (isTypeOf1(check_tag, "ItemRevision")) {
printf("====当前处理的对象是Revision对象\n");
*rev_tag = check_tag;
ITEM_ask_item_of_rev(*rev_tag, item_tag);
}
return ifail;
}
std::vector<std::string> split(const std::string& str, char delimiter) {
std::vector<std::string> tokens;
std::string token;
std::istringstream tokenStream(str);
while (std::getline(tokenStream, token, delimiter)) {
tokens.push_back(token);
}
return tokens;
}
/*检查对象属性唯一性校验item和itemRev对象前操都会走这个方法*/
int Connor_checkItem_unique(METHOD_message_t* msg, va_list va) {//创建item生效
int ifail = ITK_ok;
char* type;
char* name;
char* itemID;
printf("=================================================================================================== \n");
printf("=========触发前操校验唯一性方法==METHOD_find_method('Item/ItemRevision', 'IMAN_save', &mth_tag);\n");
tag_t check_tag = va_arg(va, tag_t);//获取要保存的tag对象
tag_t item_tag = NULLTAG;
tag_t rev_tag = NULLTAG;
ITKCALL(ifail = get_item_and_rev(check_tag, &item_tag, &rev_tag));
if (item_tag == NULLTAG) {
printf("通过check_tag对象获取item对象失败\n");
return ITK_ok;
}
else if (rev_tag == NULLTAG)
{
printf("通过check_tag对象获取rev对象失败\n");
return ITK_ok;
}
//操作对象的类型
ITKCALL(ifail = AOM_ask_value_string(check_tag, "object_type", &type));
ITKCALL(ifail = AOM_ask_value_string(check_tag, "object_name", &name));
ITKCALL(ifail = AOM_ask_value_string(check_tag, "item_id", &itemID));
printf("===当前操处理对象的type = %s\n", type);
//获取首选项
int url_num = 0;
char** url_vals = NULL;
ITKCALL(PREF_ask_char_values("LY6_MultiFieldKeys", &url_num, &url_vals));
if (url_num == 0) {
printf("LY6_MultiFieldKeys首选项获取失败\n");
}else{
printf("LY6_MultiFieldKeys首选项获取成功\n");
for (int i = 0; i < url_num; i++) {
printf("==>url_vals[%d] = %s\n", i, url_vals[i]);
}
//===================1开始根据首选项中的配置信息校验对象属性=======================================================================================================
for (int i = 0; i < url_num; i++) {
string multiFieldKey = "";//逐行取出首选项中的每一条配置信息
if (url_vals != nullptr && url_vals[i] != nullptr) {
multiFieldKey.assign(url_vals[i]); // LY6_Product:MFK_LY6_Product=item.object_desc.string:object_desc,...
}
size_t posColon = multiFieldKey.find(":");
if (posColon != std::string::npos) {
string compareType = multiFieldKey.substr(0, posColon); // 获取首选项中每条记录前的比较类型:LY6_Product
printf("首选项中获取的compareType = %s\n", compareType.c_str());
if (stricmp(type, compareType.c_str()) == 0) { // 如果操作对象的类型type匹配compareType开始获取属性并调用查询进行验证唯一性
printf(">>>当前操作对象的类型:%s与首选项中的一条multiFieldKey匹配=========%s\n", type, multiFieldKey.c_str());
string afterCompare = multiFieldKey.substr(posColon + 1);//MFK_LY6_Product=item.obiect_desc.string:obiect_desc,...
size_t posEqual = afterCompare.find("=");
printf("afterCompare = %s\n", afterCompare.c_str());
//-----------------------------------1KUMA shangmiandaimameiwenti---------------------
if (posEqual != std::string::npos) {
// 提取查询构建器的名称
string cx_name = afterCompare.substr(0, posEqual);//cx_name = MFK_LY6_Product
tag_t query;
ITKCALL(ifail = QRY_find2(cx_name.c_str(), &query));
printf("》》》成功获取到查询构建器query_name==%s\n", cx_name.c_str());
// 获取查询构建器的查询属性条目和值每个查询条目保存到vector中
string compare_attribute = afterCompare.substr(posEqual + 1); //item.obiect_desc.string:obiect_desc,rev...
vector<string> compare_attr_vals = split(compare_attribute, ',');
int qry_num = compare_attr_vals.size();//查询属性条目个数
//------------------------------------KUMA shangmiandaimameiwenti--------------------------------------------------------
char** qry_entries = new char* [qry_num];
char** qry_values = new char* [qry_num];
int n_found;
tag_t* tags;
int i = 0;
for each (string var in compare_attr_vals)
{//var就是一个查询条目item.obiect_desc.string:obiect_desc
string cx_tm = split(var, ':')[1];//查询构建器条目obiect_desc
printf(">>>获取到查询构建器的查询条目:%s \n", cx_tm.c_str());
string attribute = split(var, ':')[0];//item.obiect_desc.string
string attribut_type = split(attribute, '.')[0];//item
string attribute_name = split(attribute, '.')[1];//obiect_desc
string attribute_t = split(attribute, '.')[2];//string
char* attribute_value = NULL;//属性值
if (stricmp(attribut_type.c_str(), "item") == 0) {//如果当前属性是item属性
char* itemArr = NULL;
ITKCALL(ifail = AOM_ask_value_string(item_tag, "object_name", &itemArr));
printf("开始根据item属性==[%s]获取属性值\n", attribute_name.c_str());
ITKCALL(ifail = AOM_ask_value_string(item_tag, attribute_name.c_str(), &attribute_value));
printf("item属性string类型(属性名)==%s获取得到的属性值==%s\n", attribute_name.c_str(), attribute_value);
MEM_free(itemArr);
}
else {//非item属性即rev属性
char* revArr = NULL;
ITKCALL(ifail = AOM_ask_value_string(rev_tag, "object_name", &revArr));
printf("开始根据revision==【%s】的属性==[%s]获取属性值\n",revArr, attribute_name.c_str());
ITKCALL(ifail = AOM_ask_value_string(rev_tag, attribute_name.c_str(), &attribute_value));
printf("revision属性string类型(属性名)==%s获取得到的属性值==%s\n", attribute_name.c_str(), attribute_value);
MEM_free(revArr);
}
//已经得到属性值attribute_value
if (attribute_value == NULL) {
printf("属性获取失败!\n");
}
else {
printf("属性获取成功qry_values[%d]==%s \n", i, attribute_value);
qry_entries[i] = (char*)calloc(48, sizeof(char));
if (!cx_name.empty()) {
tc_strcpy(qry_entries[i], cx_tm.c_str());
}
qry_values[i] = (char*)calloc(48, sizeof(char));
if (attribute_value != nullptr && strlen(attribute_value) > 0) {
tc_strcpy(qry_values[i], attribute_value);
}
}
printf("写入属性条目数据后的数组:\n");
printf(">>>qry_entries[%d]==%s >>>qry_values[%d]==%s\n", i, qry_entries[i], i, qry_values[i]);
i++;
if (attribute_value != NULL) { MEM_free(attribute_value); }
else { printf("TNND!"); }
}
//-------------------------------------KUMA 上面代码没问题!---------------------------------------------------------
printf("开始调用查询构建器,查询条目数量:%d具体查询条目如下\n", qry_num);
for (int j = 0; j < qry_num; j++) {
printf("》》》传入查询构建器的键值对qry_entries[%d]:%s = qry_values[%d]:%s\n", j, qry_entries[j], j, qry_values[j]);
}
ITKCALL(ifail = QRY_execute(query, qry_num, qry_entries, qry_values, &n_found, &tags));
//释放数组内存
for (int j = 0; j < qry_num; j++) {
delete[] qry_values[j];
delete[] qry_entries[j];
}
delete[] qry_values;
delete[] qry_entries;
printf(">>>查询结果条数:%d\n", n_found);
//-------------------------------------KUMA 上面代码没问题!-------------------------------------------------------
if (n_found > 0) {
//if (n_found == 1) {
// char* itemId = NULL;
// printf("查询结果条数 == 1判断是否是自身\n");
// tag_t se = tags[0];
// ITKCALL(ifail = AOM_ask_value_string(se, "item_id", &itemId));
// printf(">>>>查询构建器查询到的对象itemId==[%s]\n", itemId);
// printf(">>>>当前正在操作的对象itemID==[%s]\n", itemID);
// if (strcmp(itemId, itemID) == 0) {//查询到的就是自身
// printf("查询到的结果的item_id == [%s],当前操作的对象item_id == [%s],仅包含自身--允许放行!\n", itemId, itemID);
// break;
// }
// printf("1 \n");
// if (itemId != NULL) { MEM_free(itemId); }
// else { printf("TNND!"); }
//}
//printf("查询构建器查询到已存在相同属性的数据,不允许创建!\n");
////--------------------------------KUMA 上面代码没问题!------------------------------------------------------------------------
//char errs[2500] = "\0";
//sprintf(errs, "对象[%s]中的首选项配置属性不唯一请检查!!", name);
//EMH_store_error_s1(EMH_severity_information, 919012, errs);//错误弹窗
//printf(">>>返回错误提示!\n");
//ifail = -1;
//break;
for (int i = 0; i < n_found;i++) {
char* itemId = NULL;
ITKCALL(ifail = AOM_ask_value_string(tags[i], "item_id", &itemId));
if (strcmp(itemId, itemID) == 0) {//查询到的就是自身
printf("查询到的结果的item_id == [%s],当前操作的对象item_id == [%s],仅包含自身--允许放行!\n", itemId, itemID);
MEM_free(itemId);
continue;
}else {
char errs[2500] = "\0";
sprintf(errs, "对象[%s]中的首选项配置属性不唯一请检查!!", name);
EMH_store_error_s1(EMH_severity_information, 919012, errs);//错误弹窗
printf(">>>返回错误提示!\n");
ifail = -1;
MEM_free(itemId);
break;
}
}
if (ifail == -1) {
break;
}
}
else
{
printf("属性唯一校验通过!\n");
break;
}
}
else {
printf("未在首选项配置信息::%s中找到符号=’。\n", multiFieldKey.c_str());
}
break;
}else{
printf(">>>当前操作对象的类型:%s与首选项中的配置类型%s不匹配=========\n", type, compareType.c_str());
}
}
else {
printf("未在首选项配置信息::%s中找到冒号无法正常取得比较类型。\n", multiFieldKey.c_str());
}
}
}
if (url_vals != NULL) { MEM_free(url_vals); }
else { printf("TNND!"); }
if (itemID != NULL) { MEM_free(itemID); }
else { printf("TNND!"); }
if (name != NULL) { MEM_free(name); }
else { printf("TNND!"); }
if (type != NULL) { MEM_free(type); }
else { printf("TNND!"); }
printf("==>beybey! \n");
return ifail;
}
/**
* 检查关系下对象状态
* @param msg
*/
int rule_handler_LY_CheckItem(EPM_rule_message_t msg) {
printf(">>>触发规则处理器rule_handler_LY_CheckItem。开始检查关系下对象状态\n");
int ifail = ITK_ok;
tag_t* attachmentTags = NULL,//流程目标下的所有对象
attachmentTag = NULLTAG;//流程目标下的某一个对象
int attachmentCount = 0;
int i = 0;
//流程下的参数
char* itemTypeValue = (char*)MEM_alloc(1028 * sizeof(char));
char* relationValue = (char*)MEM_alloc(1028 * sizeof(char));
char* itemChildTypeValue = (char*)MEM_alloc(1028 * sizeof(char));
char* itemChildRevValue = (char*)MEM_alloc(1028 * sizeof(char));//配置参数:需要检查的版本-单值
char* releaseStatusValue = (char*)MEM_alloc(1028 * sizeof(char));
tag_t rootTask = NULLTAG;
char* arg = NULL,
* argName = NULL,
* argValues = NULL;
ITKCALL(ifail = EPM_ask_root_task(msg.task, &rootTask));
ITKCALL(ifail = EPM_ask_attachments(rootTask, EPM_target_attachment, &attachmentCount, &attachmentTags));
//获取流程目标下的参数5个
int argCnt = TC_number_of_arguments(msg.arguments);
if (argCnt > 0)
{
for (i = 0; i < argCnt; i++) {
arg = TC_next_argument(msg.arguments);
ITKCALL(ifail = ITK_ask_argument_named_value((const char*)arg, &argName, &argValues));
printf("处理流程下的参数argName[%s]->argValue[%s]\n", argName, argValues);
if (tc_strcmp("itemType", argName) == 0) {
itemTypeValue = argValues;
printf(">>>argValues[%s] TO itemTypeValue[%s]\n", argValues, itemTypeValue);
}
else if (tc_strcmp("Relation", argName) == 0) {
tc_strcpy(relationValue, argValues);
printf(">>>argValues[%s] TO relationValue[%s]\n", argValues, relationValue);
}
else if (tc_strcmp("itemChildType", argName) == 0) {
tc_strcpy(itemChildTypeValue, argValues);
printf(">>>argValues[%s] TO itemChildTypeValue[%s]\n", argValues, itemChildTypeValue);
}
else if (tc_strcmp("itemChildRev", argName) == 0) {
tc_strcpy(itemChildRevValue, argValues);
printf(">>>argValues[%s] TO itemChildRevValue[%s]\n", argValues, itemChildRevValue);
}
else if (tc_strcmp("releaseStatus", argName) == 0) {
tc_strcpy(releaseStatusValue, argValues);
printf(">>>argValues[%s] TO releaseStatusValue[%s]\n", argValues, releaseStatusValue);
}
}
}
else {
printf("》》》未在流程下获取到任何配置参数!\n");
}
printf("获取到的流程下的参数itemTypeValue==%s,relationValue==%s,itemChildTypeValue==%s,itemChildRevValue==%s,releaseStatusValue==%s \n", itemTypeValue, relationValue, itemChildTypeValue, itemChildRevValue, releaseStatusValue);
//逐个遍历所有的流程目标下的对象
for (i = 0; i < attachmentCount; i++) {
tag_t item_tag = NULLTAG;
tag_t rev_tag = NULLTAG;
char* objectType = NULL;
char* objectName = NULL;
char* result = NULL;
int tag_num = 0;
tag_t* relation_tags = NULL;
attachmentTag = attachmentTags[i];
//获取流程下某一对象的item_tag和rev_tag以及对象类型和名称
ITKCALL(ifail = get_item_and_rev(attachmentTag, &item_tag, &rev_tag));
ITKCALL(ifail = AOM_ask_value_string(attachmentTag,"object_type", &objectType));
ITKCALL(ifail = AOM_ask_value_string(attachmentTag,"object_name", &objectName));
printf("当前遍历的流程下对象类型为objectType==%s\n", objectType);
if (itemTypeValue != NULL) {
printf(">>>配置参数:-itemType === %s \n", itemTypeValue);
result = strstr(itemTypeValue, objectType);
}
if (result == nullptr) {//不存在
printf("当前流程下的对象类型==%s不在配置的类型参数==%s中放行当前对象【%s】。\n", objectType, itemTypeValue,objectName);
continue;
}else{
printf("流程下的当前对象的类型==[%s]与itemType参数中的信息==[%s]匹配,开始获取被检查对象 == [%s]\n", objectType, itemTypeValue, objectName);
vector<string> relations = split(relationValue, ',');
printf(">>>配置参数:-Relation === %s \n", relationValue);
for (string relation : relations) {
tag_t relation_tag = NULL;
printf("开始GET对象==[%s]的[%s]关系下的(被检查)对象们\n", objectName,relation.c_str());
ITKCALL(ifail = AOM_ask_value_tags(attachmentTag, relation.c_str(),&tag_num,&relation_tags));
if (tag_num > 0) {
for (int i = 0; i < tag_num; i++) {
printf("开始循环遍历[%s]关系下的“被检查对象”,关系下共有%d个被检查对象\n",relation.c_str(), tag_num);
char* relation_child_type = NULL;//被检查对象类型
char* relation_child_rev = NULL;//被检查对象版本号
tag_t* relation_child_release = NULL;//被检查对象的发布状态数组
int release_num = 0;
relation_tag = relation_tags[i];//被检查对象
ITKCALL(ifail = AOM_ask_value_string(relation_tag, "object_type", &relation_child_type));
ITKCALL(ifail = AOM_ask_value_string(relation_tag, "item_revision_id", &relation_child_rev));
ITKCALL(ifail = AOM_ask_value_tags(relation_tag, "release_status_list",&release_num, &relation_child_release));
vector<string> itemChildTypes = split(itemChildTypeValue, ',');
printf(">>>配置参数:-itemChildTypeValue === %s \n", itemChildTypeValue);
int tagR = 0;
for (string itemChildType : itemChildTypes) {
if (stricmp(itemChildType.c_str(), relation_child_type) == 0) {//被检查对象的类型[relation_child_type]与参数[itemChildTypes]中匹配
printf(">>>流程对象:%s下的被检查对象类型%s 与参数::%s中匹配允许发起\n", objectName,relation_child_type, itemChildTypeValue);
if (itemChildRevValue != NULL && stricmp(itemChildRevValue,"")!=0) {
printf(">>>配置的参数版本号:%s\n", itemChildRevValue);
if (stricmp(itemChildRevValue, relation_child_rev) != 0) {//配置的被检查对象版本参数只有一个
printf("被检查对象的版本不在配置的版本参数中,不允许发起");
char* error_msg = objectName;
strcat(error_msg, "对象下关系绑定对象不正确,请检查!");
EMH_store_error_s1(EMH_severity_error, EMH_USER_error_base, error_msg);
return EPM_nogo;
}
}
else
{
printf(">>>首选项中配置的参数版本号:[%s]为空!\n", itemChildRevValue);
}
if (releaseStatusValue != NULL && stricmp(releaseStatusValue, "") != 0) {
if (stricmp(releaseStatusValue,"none") == 0) {
printf(">>>配置的发布状态为:none\n");
if (release_num > 0) {//被检查对象有发布状态,不发起
printf("当配置的发布状态为none时被检查对象的发布状态有值不允许发起");
char* error_msg = objectName;
strcat(error_msg, "对象下关系绑定对象不正确,请检查!");
EMH_store_error_s1(EMH_severity_error, EMH_USER_error_base, error_msg);
return EPM_nogo;
}
}else
{//配置的发布状态参数有值且不为none
printf(">>>配置的参数:发布状态:%s\n", releaseStatusValue);
if (release_num > 0) {//被检查对象有发布状态,开始检查
int k = 0;
for (int j = 0; j < release_num; j++) {//遍历被检查对象的发布状态
printf("开始循环遍历被检查对象的发布状态,发布状态有%d个\n", release_num);
char* relation_child_release_value = NULL;//被检查对象的发布状态的其中一个的名称
tag_t child_release = relation_child_release[j];
ITKCALL(ifail = AOM_ask_value_string(child_release, "current_name", &relation_child_release_value));
if (strstr(releaseStatusValue, relation_child_release_value) == nullptr) {//被检查对象的发布状态中任一【child_release】不在配置的参数releaseStatusValue中不发起
printf("被检查对象的发布状态数组中,任一【%s】不在配置的参数releaseStatusValue【%s】中不发起 \n", relation_child_release_value, releaseStatusValue);
char* error_msg = objectName;
strcat(error_msg, "对象下关系绑定对象不正确,请检查!");
EMH_store_error_s1(EMH_severity_error, EMH_USER_error_base, error_msg);
return EPM_nogo;
}
MEM_free(relation_child_release_value);
}
}
else {
printf("被检查对象的发布状态数组为空,不满足配置!\n");
char* error_msg = objectName;
strcat(error_msg, "被检查对象的发布状态数组为空,不满足配置!");
EMH_store_error_s1(EMH_severity_error, EMH_USER_error_base, error_msg);
return EPM_nogo;
}
}
}
tagR++;
}
}
if (tagR == 0) {//当前被检查对象类型不在参数中,则不执行
printf("流程下对象的关系下的“被检查对象”中不存在与itemchildtype参数中匹配的对象不可发起 \n");
char* error_msg = objectName;
strcat(error_msg, "对象下关系绑定对象不正确,请检查!");
EMH_store_error_s1(EMH_severity_error, EMH_USER_error_base, error_msg);
return EPM_nogo;
}
MEM_free(relation_child_release);
MEM_free(relation_child_rev);
MEM_free(relation_child_type);
}
}
else
{
printf("流程下当前[%s]对象的[%s]关系下不存在“被检查对象”,拦截\n", objectName, relation.c_str());
return EPM_nogo;
}
MEM_free(relation_tags);
}
}
MEM_free(objectName);
MEM_free(objectType);
}
MEM_free(argValues);
MEM_free(argName);
MEM_free(attachmentTags);
return EPM_go;
}
int Connor_ItemRevision_Save(METHOD_message_t* msg, va_list va)
{
int ifail = ITK_ok;
tag_t new_rev = va_arg(va, tag_t);
tag_t item = NULLTAG;
tag_t* rev_list;
char* type = NULL;
char* desc = NULL;
printf("图纸保存后操作\n");
ITKCALL(ITEM_ask_item_of_rev(new_rev, &item));
//获取首选项
int url_num = 0;
char** url_vals = NULL;
ITKCALL(PREF_ask_char_values("connor_CheckMaterialDesc", &url_num, &url_vals));
char* pref = url_vals[0];
printf("pref=========%s\n", pref);
if (item != NULLTAG) {
ITKCALL(AOM_ask_value_string(item, "object_type", &type));
printf("object_type=========%s\n", type);
if (strstr(pref, type)) {
ITKCALL(AOM_ask_value_string(new_rev, "ly6_materialDesc", &desc));
printf("desc=========%s\n", desc);
// 计算字符串长度
//size_t length = strlen(desc);
int count = getCharLength(desc);
printf("count=========%d\n", count);
// 判断字符串长度是否超过40个字符
if (count > 40) {
EMH_store_error_s2(EMH_severity_error,
919012,
"提示",
"物料描述不能超过40个字符请检查后重新输入!");
return -1;
}
}
}
return 0;
}
//
//int Connor_CreateItemPost(METHOD_message_t* msg, va_list va)
//{
//
// char* desc = NULL;
// char* type = NULL;
// //tag_t new_item_tag = NULLTAG;
// printf("----------------------------------------------------\n");
// const char* temp = NULL;
// //while ((temp = va_arg(va, const char*)) != NULL && strlen(temp) > 0) {
// // printf("Number: %s\n", temp);
// //}
//
// //printf("--------------------------------\n");
// const char* item_id = va_arg(va, const char*);
// const char* item_name = va_arg(va, const char*);
// const char* item_type = va_arg(va, const char*);
// const char* rev_id = va_arg(va, const char*);
// printf("item_id=========%s\n", item_id);
// printf("item_name=========%s\n", item_name);
// printf("item_type=========%s\n", item_type);
// printf("rev_id=========%s\n", rev_id);
// tag_t* new_item_tag = va_arg(va, tag_t*);//创建后的对象
// //获取首选项
//
// int url_num = 0;
// char** url_vals = NULL;
// ITKCALL(PREF_ask_char_values("connor_CheckMaterialDesc", &url_num, &url_vals));
// char* pref = url_vals[0];
// printf("pref=========%s\n", pref);
//
// if (new_item_tag)
// {
//
// ITKCALL(AOM_ask_value_string(*new_item_tag, "object_type", &type));
// printf("object_type=========%s\n", type);
// if (strstr(pref,type)) {
// tag_t rev = NULLTAG;
// ITKCALL(ITEM_ask_latest_rev(*new_item_tag, &rev));
// if (rev != NULLTAG) {
// printf("1111111111111111111111111111\n");
// ITKCALL(AOM_ask_value_string(rev, "ly6_materialDesc", &desc));
// printf("desc=========%s\n", desc);
// // 计算字符串长度
// size_t length = strlen(desc);
//
// // 判断字符串长度是否超过40个字符
// if (length > 40) {
// EMH_store_error_s2(EMH_severity_error,
// 919012,
// "提示",
// "物料描述不能超过40个字符请检查后重新输入!");
// return -1;
// }
// }
//
//
// }
//
//
//
//
// }
// return 0;
//}