20250424 1ZDB300000P-修改前上传备份

master
李冬阳 2 months ago
parent 9d29f993db
commit cdb4e24ac9

@ -355,12 +355,22 @@ int CHINT_ECN_SendOA(EPM_action_message_t msg) {
string userCode = readXmlId(userXML); string userCode = readXmlId(userXML);
char *json_to_char = cJSON_Print(paramValue); char *json_to_char = cJSON_Print(paramValue);
//lidy20250211 &תÒå
vector<string> v1;
Split(json_to_char, "&", v1);
string json_str = "";
for (int i = 0; i < v1.size(); i++) {
if (json_str.size() > 0)
json_str.append("&amp;");
json_str.append(v1[i]);
}
WriteLog("\nworkflowCode=EH_TE_ChangeNotice\nuserCode=%s\nfinishStart=true\n", userCode.c_str()); WriteLog("\nworkflowCode=EH_TE_ChangeNotice\nuserCode=%s\nfinishStart=true\n", userCode.c_str());
//WriteLog("组织之后的JSON\n %s\n", json_to_char); //WriteLog("组织之后的JSON\n %s\n", json_to_char);
string msg = "组织之后的JSON\n"; string msg = "组织之后的JSON\n";
msg.append(json_to_char).append("\n"); msg.append(json_str).append("\n");
WriteLog2(msg.c_str()); WriteLog2(msg.c_str());
string returnMsg = ecnSendOA(userCode.c_str(), json_to_char, url); string returnMsg = ecnSendOA(userCode.c_str(), json_str, url);
WriteLog("回传信息\n %s\n", returnMsg.c_str()); WriteLog("回传信息\n %s\n", returnMsg.c_str());
if (!returnMsg.empty()) { if (!returnMsg.empty()) {
ITKCALL(EMH_store_error_s1(EMH_severity_user_error, EMH_USER_error_base, returnMsg.c_str())); ITKCALL(EMH_store_error_s1(EMH_severity_user_error, EMH_USER_error_base, returnMsg.c_str()));

@ -45,6 +45,8 @@ using namespace libxl;
typedef struct{ typedef struct{
string ITEM_ID;//idºÅ string ITEM_ID;//idºÅ
}PROPERTY_STRUCT; }PROPERTY_STRUCT;
void Split(string strArg, string spliter, vector<string> &ans);
string ws2s(const std::wstring& wstr) string ws2s(const std::wstring& wstr)
{ {
@ -136,26 +138,32 @@ int chint_getChgOrde(EPM_action_message_t msg) {
int occur_of_counts; int occur_of_counts;
tag_t *taskAttches; tag_t *taskAttches;
//»ñÈ¡ÊôÐÔ //»ñÈ¡ÊôÐÔ
EPM_ask_root_task(msg.task, &root_task); ITKCALL(EPM_ask_root_task(msg.task, &root_task));
EPM_ask_attachments(root_task, EPM_target_attachment, &occur_of_counts, &taskAttches); ITKCALL(EPM_ask_attachments(root_task, EPM_target_attachment, &occur_of_counts, &taskAttches));
for (int count = 0; count < occur_of_counts; count++) { for (int count = 0; count < occur_of_counts; count++) {
tag_t changeTag = taskAttches[count]; tag_t changeTag = taskAttches[count];
TCTYPE_ask_object_type(changeTag, &type_tag); ITKCALL(TCTYPE_ask_object_type(changeTag, &type_tag));
ifail = TCTYPE_ask_class_name(type_tag, type_class); ITKCALL(ifail = TCTYPE_ask_class_name(type_tag, type_class));
printf("type_class : %s", type_class); printf("type_class : %s", type_class);
if (strcmp(type_class, "ZT2_Change")==0) { if (strcmp(type_class, "ZT2_Change")==0) {
tag_t oGroup,user; tag_t oGroup = NULLTAG, user = NULLTAG;
char * plant, *projn,*pcod,*chgorder,*duser,*chginfo; char * plant = NULL, *projn = NULL, *pcod = NULL, *chgorder = NULL, *duser = NULL, *userid = NULL, *chginfo = NULL;
string jsonStr, creationStr, zt2_ChangeStr; string jsonStr, creationStr, zt2_ChangeStr;
date_t creation_date, zt2_ChangeDate; date_t creation_date, zt2_ChangeDate;
jsonStr.append("[{"); jsonStr.append("[{");
AOM_ask_value_tag(changeTag,"owning_group", &oGroup); ITKCALL(AOM_ask_value_tag(changeTag,"owning_group", &oGroup));
AOM_ask_value_string(oGroup, "name", &plant); ITKCALL(AOM_ask_value_string(oGroup, "name", &plant));
AOM_ask_value_string(changeTag, "zt2_WBSNo", &projn); ITKCALL(AOM_ask_value_string(changeTag, "zt2_WBSNo", &projn));
AOM_ask_value_string(changeTag, "zt2_ContractNo", &pcod); ITKCALL(AOM_ask_value_string(changeTag, "zt2_ContractNo", &pcod));
AOM_ask_value_string(changeTag, "item_id", &chgorder); ITKCALL(AOM_ask_value_string(changeTag, "item_id", &chgorder));
AOM_ask_value_tag(changeTag, "owning_user", &user); ITKCALL(AOM_ask_value_tag(changeTag, "owning_user", &user));
AOM_ask_value_string(user,"user_name",&duser); ITKCALL(AOM_ask_value_string(user,"user_name",&duser));
ITKCALL(AOM_ask_value_string(user, "user_id", &userid));
//lidy20250114项目名称获取更改通知单本身属性zt2_ContractName中的值。若未填写则给空值
char *zt2_ContractName = NULL;
ITKCALL(AOM_ask_value_string(changeTag, "zt2_ContractName", &zt2_ContractName));
jsonStr.append("\"plant\":\""); jsonStr.append("\"plant\":\"");
jsonStr.append(plant); jsonStr.append(plant);
jsonStr.append("\","); jsonStr.append("\",");
@ -168,22 +176,29 @@ int chint_getChgOrde(EPM_action_message_t msg) {
jsonStr.append(pcod); jsonStr.append(pcod);
jsonStr.append("\","); jsonStr.append("\",");
jsonStr.append("\"string\":\"");
jsonStr.append(zt2_ContractName ? zt2_ContractName : "");
jsonStr.append("\",");
jsonStr.append("\"chgorder\":\""); jsonStr.append("\"chgorder\":\"");
jsonStr.append(chgorder); jsonStr.append(chgorder);
jsonStr.append("\","); jsonStr.append("\",");
jsonStr.append("\"duser\":\""); jsonStr.append("\"duser\":\"");
jsonStr.append(duser); jsonStr.append(duser);
jsonStr.append("(");
jsonStr.append(userid);
jsonStr.append(")");
jsonStr.append("\","); jsonStr.append("\",");
AOM_ask_value_date(changeTag, "creation_date", &creation_date);//zt2_ChangeDate ITKCALL(AOM_ask_value_date(changeTag, "creation_date", &creation_date));//zt2_ChangeDate
creationStr.append(to_string(creation_date.year)).append("-"). creationStr.append(to_string(creation_date.year)).append("-").
append(to_string(creation_date.month+1)).append("-"). append(to_string(creation_date.month+1)).append("-").
append(to_string(creation_date.day)).append(" "). append(to_string(creation_date.day)).append(" ").
append(to_string(creation_date.hour)).append(":"). append(to_string(creation_date.hour)).append(":").
append(to_string(creation_date.minute)).append(":").append(to_string(creation_date.second)); append(to_string(creation_date.minute)).append(":").append(to_string(creation_date.second));
AOM_ask_value_date(changeTag, "zt2_ChangeDate", &zt2_ChangeDate);//zt2_ChangeDate ITKCALL(AOM_ask_value_date(changeTag, "zt2_ChangeDate", &zt2_ChangeDate));//zt2_ChangeDate
zt2_ChangeStr.append(to_string(creation_date.year)).append("-"). zt2_ChangeStr.append(to_string(creation_date.year)).append("-").
append(to_string(creation_date.month+1)).append("-"). append(to_string(creation_date.month+1)).append("-").
append(to_string(creation_date.day)).append(" "). append(to_string(creation_date.day)).append(" ").
@ -197,14 +212,23 @@ int chint_getChgOrde(EPM_action_message_t msg) {
jsonStr.append(zt2_ChangeStr); jsonStr.append(zt2_ChangeStr);
jsonStr.append("\","); jsonStr.append("\",");
char **depment; int numdes; char **depment; int numdes;
string depments; string depments = "";
AOM_ask_value_strings(changeTag, "zt2_ChangeUnit1",&numdes, &depment); ITKCALL(AOM_ask_value_strings(changeTag, "zt2_ChangeUnit1",&numdes, &depment));
for (int i = 0; i < numdes; i++) { /*for (int i = 0; i < numdes; i++) {
if (i > 0) { if (i > 0) {
depments.append(";"); depments.append(";");
} }
depments.append(depment[i]); depments.append(depment[i]);
}*/
printf("depment[0]==>%s", depment[0]);
vector<string> split;
Split(depment[0], " ", split);
for (int i = 0; i < split.size(); i++) {
if (i > 0)
depments.append(";");
depments.append(split[i]);
} }
printf("depments==>%s", depments.c_str());
int num2; tag_t* second; int num2; tag_t* second;
jsonStr.append("\"depment\":\""); jsonStr.append("\"depment\":\"");
jsonStr.append(depments); jsonStr.append(depments);

@ -90,12 +90,16 @@ void save_representation2(tag_t primaryTag, tag_t secondTag, char* relationType)
ITKCALL(AOM_refresh(primaryTag, TRUE)); ITKCALL(AOM_refresh(primaryTag, TRUE));
ITKCALL(AOM_refresh(secondTag, TRUE)); ITKCALL(AOM_refresh(secondTag, TRUE));
(AOM_lock(primaryTag));
(AOM_lock(secondTag));
tag_t relationTag = NULLTAG; tag_t relationTag = NULLTAG;
ITKCALL(GRM_create_relation(primaryTag, secondTag, typeTag, NULLTAG, &relationTag));//如果关系已经存在,那么就是增加对象 ITKCALL(GRM_create_relation(primaryTag, secondTag, typeTag, NULLTAG, &relationTag));//如果关系已经存在,那么就是增加对象
ITKCALL(GRM_save_relation(relationTag));//很必要 ITKCALL(GRM_save_relation(relationTag));//很必要
(AOM_save(primaryTag)); (AOM_save(primaryTag));
(AOM_unlock(primaryTag));
(AOM_save(secondTag)); (AOM_save(secondTag));
(AOM_unlock(secondTag));
ITKCALL(AOM_refresh(primaryTag, FALSE)); ITKCALL(AOM_refresh(primaryTag, FALSE));
ITKCALL(AOM_refresh(secondTag, FALSE)); ITKCALL(AOM_refresh(secondTag, FALSE));
} }
@ -340,15 +344,13 @@ void setZljyx(string gxbm2, string th, string lastId, string name, tag_t towGx)
if (beans.size()>0) { if (beans.size()>0) {
tag_t *tableRow; tag_t *tableRow;
ITKCALL(ITEM_create_item(NULL, objName.c_str(), "ZT2_QCHECK", NULL, &item, &rev)); ITKCALL(ITEM_create_item(NULL, objName.c_str(), "ZT2_QCHECK", NULL, &item, &rev));
(AOM_save(item));
(AOM_save(rev)); (AOM_save(rev));
(AOM_lock(item));
(AOM_lock(rev)); (AOM_lock(rev));
ITKCALL(AOM_insert_table_rows(rev, "zt2_QCHECKS", 0, beans.size(), &tableRow)); ITKCALL(AOM_insert_table_rows(rev, "zt2_QCHECKS", 0, beans.size(), &tableRow));
(AOM_save(rev)); (AOM_save(rev));
(AOM_unlock(rev)); (AOM_unlock(rev));//20241211
(AOM_save(item)); (AOM_save(item));
(AOM_unlock(item)); (AOM_unlock(item));//20241211
for (int i = 0; i < beans.size(); i++) { for (int i = 0; i < beans.size(); i++) {
tag_t table = tableRow[i]; tag_t table = tableRow[i];
(AOM_lock(table)); (AOM_lock(table));
@ -360,6 +362,7 @@ void setZljyx(string gxbm2, string th, string lastId, string name, tag_t towGx)
(AOM_unlock(table)); (AOM_unlock(table));
} }
(AOM_save(towGx)); (AOM_save(towGx));
(AOM_unlock(towGx));
save_representation2(towGx, item, "ZT2_QualityCheckRelation"); save_representation2(towGx, item, "ZT2_QualityCheckRelation");
} }
@ -424,23 +427,26 @@ void getGxbmMap(tag_t processTag, map<string, tag_t>& gxDocMap, map<string, Time
vector<FlBean> beansVec = flBeanMap[gxbm2]; vector<FlBean> beansVec = flBeanMap[gxbm2];
printf("beansVec===>%zd\n", beansVec.size()); printf("beansVec===>%zd\n", beansVec.size());
if (beansVec.size() > 0) { if (beansVec.size() > 0) {
tag_t axqPmatnr; tag_t axqPmatnr = NULLTAG;
ITKCALL(AOM_ask_value_tag(towGxLine, "bl_line_object", &axqPmatnr)); ITKCALL(AOM_ask_value_tag(towGxLine, "bl_line_object", &axqPmatnr));
ITKCALL(ITEM_rev_list_bom_view_revs(axqPmatnr, &bvr_count, &bvr_list)); ITKCALL(ITEM_rev_list_bom_view_revs(axqPmatnr, &bvr_count, &bvr_list));
printf("bvr_count=%d\n", bvr_count); printf("bvr_count=%d\n", bvr_count);
if (bvr_count == 0) { if (bvr_count == 0) {
tag_t newView, newViewBvr, pitem; tag_t newView = NULLTAG, newViewBvr = NULLTAG, pitem = NULLTAG;
ITKCALL(ITEM_ask_item_of_rev(axqPmatnr, &pitem)); ITKCALL(ITEM_ask_item_of_rev(axqPmatnr, &pitem));
ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView)); ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView));
(AOM_save(newView)); (AOM_save(newView));
(AOM_unlock(newView));//20241211
ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, axqPmatnr, &newViewBvr)); ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, axqPmatnr, &newViewBvr));
(AOM_save(newViewBvr)); (AOM_save(newViewBvr));
(AOM_unlock(newViewBvr));//20241211
(AOM_save(axqPmatnr)); (AOM_save(axqPmatnr));
(AOM_unlock(axqPmatnr));//20241211
} }
} }
//投辅料 //投辅料
for (int n = 0; n < beansVec.size(); n++) { for (int n = 0; n < beansVec.size(); n++) {
tag_t cLine; tag_t cLine = NULLTAG;
FlBean cBean = beansVec[n]; FlBean cBean = beansVec[n];
if (cBean.flTag == NULLTAG) { if (cBean.flTag == NULLTAG) {
continue; continue;
@ -795,7 +801,7 @@ boolean isXn(tag_t matnr) {
return flag; return flag;
} }
//获取分类属性 判断是否整除 //获取分类属性 判断是否整除
string getClassVal(tag_t top_rev_tag, string& errMessage, ByqBean &bean) { string getClassVal(tag_t top_rev_tag, string& errMessage, ByqBean &bean, map<string, string>& cmap) {
//, string className //, string className
tag_t top_classificationObject = NULLTAG, item = NULLTAG; tag_t top_classificationObject = NULLTAG, item = NULLTAG;
ITKCALL(ITEM_ask_item_of_rev(top_rev_tag, &item)); ITKCALL(ITEM_ask_item_of_rev(top_rev_tag, &item));
@ -827,7 +833,10 @@ string getClassVal(tag_t top_rev_tag, string& errMessage, ByqBean &bean) {
} }
//break; //break;
} }
else if (strcmp(attr_names[ii], "低压线圈绕线方式") == 0) { else {
cmap[attr_names[ii]] = attr_vals[ii];
}
/*else if (strcmp(attr_names[ii], "低压线圈绕线方式") == 0) {
if (strcmp(attr_vals[ii], "") == 0) { if (strcmp(attr_vals[ii], "") == 0) {
//errMessage.append("分类属性低压线圈绕线方式为空,请检查。\n"); //errMessage.append("分类属性低压线圈绕线方式为空,请检查。\n");
//return ""; //return "";
@ -876,7 +885,7 @@ string getClassVal(tag_t top_rev_tag, string& errMessage, ByqBean &bean) {
bean.wyxq = attr_vals[ii];//cpxh = (attr_vals[ii]); bean.wyxq = attr_vals[ii];//cpxh = (attr_vals[ii]);
} }
//break; //break;
} }*/
//五柱铁心 //五柱铁心
cout << attr_names[ii] << "\t" cout << attr_names[ii] << "\t"
<< attr_vals[ii] << endl; << attr_vals[ii] << endl;
@ -1013,18 +1022,19 @@ boolean isTcmOnNot(tag_t process) {
} }
void readProcessBom(tag_t bom_line, string& errorBuff, boolean &flag, tag_t &topProcess, string &notTcmBuff, string back) { void readProcessBom(tag_t bom_line, string& errorBuff, boolean &flag, tag_t &topProcess, string &notTcmBuff, string back) {
int c_line_count; int c_line_count = 0;
tag_t mantr, *c_line_tags; tag_t mantr = NULLTAG, *c_line_tags = NULLTAG;
char *os = NULL, *objName = NULL;
ITKCALL(AOM_ask_value_string(bom_line, "object_string", &os));
printf("readProcessBom%s\n", os);
ITKCALL(AOM_ask_value_tag(bom_line, "bl_line_object", &mantr)); ITKCALL(AOM_ask_value_tag(bom_line, "bl_line_object", &mantr));
ITKCALL(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags)); ITKCALL(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags));
char *objName; ITKCALL(AOM_ask_value_string(mantr, "object_name", &objName));
AOM_ask_value_string(mantr, "object_name", &objName);
if (c_line_count > 0 && (isXn(mantr) || strstr(objName, "变压器") != NULL)) { if (c_line_count > 0 && (isXn(mantr) || strstr(objName, "变压器") != NULL)) {
printf("实体\n"); printf("实体\n");
flag = true; flag = true;
//检查是否有工艺路线 //检查是否有工艺路线
int n_references = 0; int n_references = 0, * levels = 0;
int* levels = 0;
tag_t* references_tag = NULLTAG; tag_t* references_tag = NULLTAG;
char** relation_type_name = NULL; char** relation_type_name = NULL;
//通过引用关系查找到变更单 //通过引用关系查找到变更单
@ -1041,6 +1051,7 @@ void readProcessBom(tag_t bom_line, string& errorBuff, boolean &flag, tag_t &top
} }
} }
printf("hasProcess==%d\n", hasProcess); printf("hasProcess==%d\n", hasProcess);
map<string, string> cmap1, cmap2;
if (!hasProcess) { if (!hasProcess) {
char* bl_desc = NULL, *itemID = NULL; char* bl_desc = NULL, *itemID = NULL;
ITKCALL(AOM_ask_value_string(mantr, "item_id", &itemID)); ITKCALL(AOM_ask_value_string(mantr, "item_id", &itemID));
@ -1057,7 +1068,7 @@ void readProcessBom(tag_t bom_line, string& errorBuff, boolean &flag, tag_t &top
save_representation2(processTag, mantr, "IMAN_METarget"); save_representation2(processTag, mantr, "IMAN_METarget");
} }
} }
else if (strstr(objName, "变压器") != NULL) { else if (tc_strstr(objName, "变压器") != NULL) {
tag_t* byqRev = NULLTAG; tag_t* byqRev = NULLTAG;
string tmpGyId; string tmpGyId;
char* uid = NULL; char* uid = NULL;
@ -1066,12 +1077,12 @@ void readProcessBom(tag_t bom_line, string& errorBuff, boolean &flag, tag_t &top
ByqBean bean; ByqBean bean;
ITK__convert_tag_to_uid(byqRev[0], &uid); ITK__convert_tag_to_uid(byqRev[0], &uid);
printf("objName%s %s\n", objName, uid); printf("objName%s %s\n", objName, uid);
string cpxh = getClassVal(byqRev[0], errorBuff, bean); string cpxh = getClassVal(byqRev[0], errorBuff, bean, cmap2);
char* thId = NULL; char* thId = NULL;
ITKCALL(AOM_ask_value_string(byqRev[0], "item_id", &thId)); ITKCALL(AOM_ask_value_string(byqRev[0], "item_id", &thId));
printf("cpxh===>%s\n", cpxh.c_str()); printf("cpxh===>%s\n", cpxh.c_str());
tag_t processTag = NULLTAG; tag_t processTag = NULLTAG;
if (strstr(objName, "线圈") == NULL) { if (tc_strstr(objName, "线圈") == NULL) {
vector<string> idVec; vector<string> idVec;
Split2(thId, "-", idVec); Split2(thId, "-", idVec);
processTag = getTmpProcess(cpxh, "1ZDB300000P", errorBuff, tmpGyId, false, "", idVec[1]); processTag = getTmpProcess(cpxh, "1ZDB300000P", errorBuff, tmpGyId, false, "", idVec[1]);
@ -1099,12 +1110,21 @@ void readProcessBom(tag_t bom_line, string& errorBuff, boolean &flag, tag_t &top
string byqId = "1ZDB300000P-", tmpGyId; string byqId = "1ZDB300000P-", tmpGyId;
tag_t byqTag = NULLTAG, byqRev = NULLTAG, processTag = NULLTAG; tag_t byqTag = NULLTAG, byqRev = NULLTAG, processTag = NULLTAG;
byqId.append(wordNo); byqId.append(wordNo);
printf("byqId===>%s\n", byqId.c_str());
ITKCALL(ITEM_find_item(byqId.c_str(), &byqTag)); ITKCALL(ITEM_find_item(byqId.c_str(), &byqTag));
ITKCALL(ITEM_ask_latest_rev(byqTag, &byqRev)); ITKCALL(ITEM_ask_latest_rev(byqTag, &byqRev));
int ics_num = 0;
char** ics_vals = NULL;
ITKCALL(PREF_ask_char_values("CHINT_WHRX", &ics_num, &ics_vals));
for (int i = 0; i < ics_num; i++) {
vector<string> v1;
Split(ics_vals[i], "=", v1);
cmap1[v1[0]] = v1[1];
}
ByqBean bean; ByqBean bean;
string cpxh = getClassVal(byqRev, errorBuff, bean); string cpxh = getClassVal(byqRev, errorBuff, bean, cmap2);
printf("cpxh===>%s\n", cpxh.c_str()); printf("cpxh===>%s\n", cpxh.c_str());
if (strstr(objName, "线圈") == NULL) { if (tc_strstr(objName, "线圈") == NULL) {
processTag = getTmpProcess(cpxh, drawNo, errorBuff, tmpGyId, false, "", wordNo); processTag = getTmpProcess(cpxh, drawNo, errorBuff, tmpGyId, false, "", wordNo);
if (processTag != NULLTAG) { if (processTag != NULLTAG) {
save_representation2(processTag, mantr, "IMAN_METarget"); save_representation2(processTag, mantr, "IMAN_METarget");
@ -1112,7 +1132,21 @@ void readProcessBom(tag_t bom_line, string& errorBuff, boolean &flag, tag_t &top
} }
else { else {
string xqfs; string xqfs;
if (strstr(objName, "低压线圈") != NULL) { map<string, string>::iterator it;
for (it = cmap1.begin(); it != cmap1.end(); it++) {
string key = it->first;
if (tc_strstr(objName, key.c_str()) != NULL) {
//当前XXX线圈未在变压器参数表中维护绕线方式分类属性请前往维护
if (cmap2[cmap1[key]].empty()) {
errorBuff.append("当前").append(key)
.append("未在变压器参数表中维护绕线方式分类属性,请前往维护\n");
return;
}
xqfs = cmap2[cmap1[key]];
break;
}
}
/*if (tc_strstr(objName, "低压线圈") != NULL) {
//当前XXX线圈未在变压器参数表中维护绕线方式分类属性请前往维护 //当前XXX线圈未在变压器参数表中维护绕线方式分类属性请前往维护
if (bean.dyxq.empty()) { if (bean.dyxq.empty()) {
errorBuff.append("当前低压线圈未在变压器参数表中维护绕线方式分类属性,请前往维护\n"); errorBuff.append("当前低压线圈未在变压器参数表中维护绕线方式分类属性,请前往维护\n");
@ -1120,7 +1154,7 @@ void readProcessBom(tag_t bom_line, string& errorBuff, boolean &flag, tag_t &top
} }
xqfs = bean.dyxq; xqfs = bean.dyxq;
} }
else if (strstr(objName, "中压线圈") != NULL) { else if (tc_strstr(objName, "中压线圈") != NULL) {
//当前XXX线圈未在变压器参数表中维护绕线方式分类属性请前往维护 //当前XXX线圈未在变压器参数表中维护绕线方式分类属性请前往维护
if (bean.zyxq.empty()) { if (bean.zyxq.empty()) {
errorBuff.append("当前中压线圈未在变压器参数表中维护绕线方式分类属性,请前往维护\n"); errorBuff.append("当前中压线圈未在变压器参数表中维护绕线方式分类属性,请前往维护\n");
@ -1128,7 +1162,7 @@ void readProcessBom(tag_t bom_line, string& errorBuff, boolean &flag, tag_t &top
} }
xqfs = bean.zyxq; xqfs = bean.zyxq;
} }
else if (strstr(objName, "高压线圈") != NULL) { else if (tc_strstr(objName, "高压线圈") != NULL) {
//当前XXX线圈未在变压器参数表中维护绕线方式分类属性请前往维护 //当前XXX线圈未在变压器参数表中维护绕线方式分类属性请前往维护
if (bean.gyxq.empty()) { if (bean.gyxq.empty()) {
errorBuff.append("当前高压线圈未在变压器参数表中维护绕线方式分类属性,请前往维护\n"); errorBuff.append("当前高压线圈未在变压器参数表中维护绕线方式分类属性,请前往维护\n");
@ -1136,7 +1170,7 @@ void readProcessBom(tag_t bom_line, string& errorBuff, boolean &flag, tag_t &top
} }
xqfs = bean.gyxq; xqfs = bean.gyxq;
} }
else if (strstr(objName, "调压线圈") != NULL) { else if (tc_strstr(objName, "调压线圈") != NULL) {
//当前XXX线圈未在变压器参数表中维护绕线方式分类属性请前往维护 //当前XXX线圈未在变压器参数表中维护绕线方式分类属性请前往维护
if (bean.tyxq.empty()) { if (bean.tyxq.empty()) {
errorBuff.append("当前调压线圈未在变压器参数表中维护绕线方式分类属性,请前往维护\n"); errorBuff.append("当前调压线圈未在变压器参数表中维护绕线方式分类属性,请前往维护\n");
@ -1144,14 +1178,14 @@ void readProcessBom(tag_t bom_line, string& errorBuff, boolean &flag, tag_t &top
} }
xqfs = bean.tyxq; xqfs = bean.tyxq;
} }
else if (strstr(objName, "稳压线圈") != NULL) { else if (tc_strstr(objName, "稳压线圈") != NULL) {
//当前XXX线圈未在变压器参数表中维护绕线方式分类属性请前往维护 //当前XXX线圈未在变压器参数表中维护绕线方式分类属性请前往维护
if (bean.wyxq.empty()) { if (bean.wyxq.empty()) {
errorBuff.append("当前稳压线圈未在变压器参数表中维护绕线方式分类属性,请前往维护\n"); errorBuff.append("当前稳压线圈未在变压器参数表中维护绕线方式分类属性,请前往维护\n");
return; return;
} }
xqfs = bean.wyxq; xqfs = bean.wyxq;
} }*/
processTag = getTmpProcess(cpxh, drawNo, errorBuff, tmpGyId, true, xqfs, wordNo); processTag = getTmpProcess(cpxh, drawNo, errorBuff, tmpGyId, true, xqfs, wordNo);
if (processTag != NULLTAG) { if (processTag != NULLTAG) {
save_representation2(processTag, mantr, "IMAN_METarget"); save_representation2(processTag, mantr, "IMAN_METarget");
@ -1162,7 +1196,7 @@ void readProcessBom(tag_t bom_line, string& errorBuff, boolean &flag, tag_t &top
} }
} }
} }
printf("sub readProcessBom\n"); //printf("sub readProcessBom\n");
for (int i = 0; i < c_line_count; i++) { for (int i = 0; i < c_line_count; i++) {
tag_t c_line_tag = c_line_tags[i]; tag_t c_line_tag = c_line_tags[i];
readProcessBom(c_line_tag, errorBuff, flag, topProcess, notTcmBuff, ""); readProcessBom(c_line_tag, errorBuff, flag, topProcess, notTcmBuff, "");
@ -1191,30 +1225,37 @@ tag_t getProcess(tag_t designRev) {
} }
return process; return process;
} }
int CloneTempProcess(void *returnValue)
{ void CloneProcess(tag_t designRev, vector<vector<string>> back_prefs, string& errorBuff, string& notTcmBuff) {
// 记录开始时间点
auto start = std::chrono::high_resolution_clock::now();
int ifail = ITK_ok;
char* sql = NULL, *revUid;
tag_t designRev;
ITKCALL(ifail = USERARG_get_string_argument(&revUid));
ITK__convert_uid_to_tag(revUid, &designRev);
int bvr_count = 0, c_line_count; int bvr_count = 0, c_line_count;
tag_t ebom_window = NULLTAG; tag_t ebom_window = NULLTAG, bom_line = NULLTAG, item_tag = NULLTAG, *c_line_tags = NULLTAG;
tag_t bom_line = NULLTAG;
tag_t item_tag = NULLTAG, *c_line_tags = NULLTAG;
ITKCALL(BOM_create_window(&ebom_window));
tag_t* bvr_list = NULL; tag_t* bvr_list = NULL;
ITKCALL(BOM_create_window(&ebom_window));
ITKCALL(ITEM_rev_list_bom_view_revs(designRev, &bvr_count, &bvr_list)); ITKCALL(ITEM_rev_list_bom_view_revs(designRev, &bvr_count, &bvr_list));
printf("bvr_count=%d", bvr_count); printf("bvr_count=%d", bvr_count);
ITKCALL(BOM_set_window_top_line_bvr(ebom_window, bvr_list[0], &bom_line)); //顶层bom获取 ITKCALL(BOM_set_window_top_line_bvr(ebom_window, bvr_list[0], &bom_line)); //顶层bom获取
string errorBuff; //string errorBuff, notTcmBuff;
string notTcmBuff; char *bl_desc = NULL;
char *bl_desc;
ITKCALL(AOM_ask_value_string(bom_line, "bl_rev_object_desc", &bl_desc)); ITKCALL(AOM_ask_value_string(bom_line, "bl_rev_object_desc", &bl_desc));
boolean isback = false;
tag_t meProcess = NULLTAG;
char* objName = NULL, *topId = NULL;
string backs = "", tuhao;
ITKCALL(AOM_ask_value_string(designRev, "object_name", &objName));
ITKCALL(AOM_ask_value_string(designRev, "item_id", &topId));
printf("CloneProcess=%s", topId);
for (int i = 0; i < back_prefs.size(); i++) {
for (int j = 0; j < back_prefs.size(); j++) {
if (tc_strstr(objName, back_prefs[i][j].c_str()) != NULL) {
tuhao = back_prefs[i][j];
isback = true;
break;
}
}
}
map<string, tag_t> mapByq;
int n_references = 0; int n_references = 0;
int* levels = 0; int* levels = 0;
tag_t* references_tag = NULLTAG; tag_t* references_tag = NULLTAG;
@ -1228,61 +1269,12 @@ int CloneTempProcess(void *returnValue)
char* refType; char* refType;
tag_t refTag = references_tag[i]; tag_t refTag = references_tag[i];
ITKCALL(AOM_ask_value_string(refTag, "object_type", &refType)); ITKCALL(AOM_ask_value_string(refTag, "object_type", &refType));
if (strcmp(refType, "MEProcessRevision") == 0) { if (tc_strcmp(refType, "MEProcessRevision") == 0) {
hasProcess = true; hasProcess = true;
processTagTop = refTag; processTagTop = refTag;
break; break;
} }
} }
int url_num = 0;
char** url_vals = NULL;
ITKCALL(PREF_ask_char_values("database_tc", &url_num, &url_vals));
string url = url_vals[0];
url.append("/").append(url_vals[2]);
//map<string,
printf("url ==> %s \n", url.c_str());
if (ConnServer(url_vals[3], url_vals[4], (char*)url.c_str()) == -1)
{
printf("提示:中间数据表访问失败\n");
ifail = 1;
}
boolean isback = false;
tag_t meProcess = NULLTAG;
char* objName = NULL, *topId = NULL;
string backs = "";
ITKCALL(AOM_ask_value_string(designRev, "object_name", &objName));
ITKCALL(AOM_ask_value_string(designRev, "item_id", &topId));
map<string, tag_t> mapByq;
//如果是产成品的话, 判断是否存在多个P物料
//20240203备件包工艺路线指派
int back_num = 0;
char** back_vals = NULL, *group_name = NULL;
tag_t group = NULLTAG;
string tuhao;
vector<string> group_names;
ITKCALL(POM_ask_group(&group_name, &group));
Split(group_name, ".", group_names);
printf("group_name=======%s\n", group_names[0].c_str());
ITKCALL(PREF_ask_char_values("CHINT_PROCESS_RULE", &back_num, &back_vals));
//首选项格式:组名:匹配字段1;匹配字段2
for (int i = 0; i < back_num; i++) {
vector<string> group_backs;
Split(back_vals[i], ":", group_backs);
if (tc_strcmp(group_backs[0].c_str(), group_names[0].c_str()) == 0) {
vector<string> backs;
Split(group_backs[1], ";", backs);
for (int j = 0; j < backs.size(); j++) {
if (tc_strstr(objName, backs[j].c_str()) != NULL) {
tuhao = backs[j];
isback = true;
break;
}
}
if (isback)
break;
}
}
if (isback) { if (isback) {
isback = false; isback = false;
int b_refs = 0; int b_refs = 0;
@ -1311,7 +1303,8 @@ int CloneTempProcess(void *returnValue)
if (n_drows == 0) if (n_drows == 0)
continue; continue;
ByqBean bean; ByqBean bean;
cpxh = getClassVal(drows[0], errorBuff, bean); map<string, string> cmap;
cpxh = getClassVal(drows[0], errorBuff, bean, cmap);
isback = true; isback = true;
break; break;
} }
@ -1349,7 +1342,7 @@ int CloneTempProcess(void *returnValue)
tag_t pMatr = pMaterials[x]; tag_t pMatr = pMaterials[x];
ITKCALL(AOM_ask_value_string(pMatr, "item_id", &pId)); ITKCALL(AOM_ask_value_string(pMatr, "item_id", &pId));
ITKCALL(AOM_ask_value_string(pMatr, "zt2_ifpbom", &zt2_ifpbom)); ITKCALL(AOM_ask_value_string(pMatr, "zt2_ifpbom", &zt2_ifpbom));
if (strcmp(pId, topId) != 0 && strcmp(zt2_ifpbom, "P") == 0) { if (tc_strcmp(pId, topId) != 0 && tc_strcmp(zt2_ifpbom, "P") == 0) {
tag_t process = getProcess(pMatr); tag_t process = getProcess(pMatr);
if (process != NULLTAG) { if (process != NULLTAG) {
meProcess = process; meProcess = process;
@ -1386,8 +1379,40 @@ int CloneTempProcess(void *returnValue)
//errorBuff = "当前选中的物料已经存在工艺路线.\n"; //errorBuff = "当前选中的物料已经存在工艺路线.\n";
} }
} }
else if (!isXn(designRev)) {
//lidy20241018增加向上找实件指派工艺的逻辑
vector<tag_t> feeds;
//getParents(designRev, feeds, back_prefs);
map<string, string> revMap;
map<string, tag_t> feedMap;
for (int i = 0; i < feeds.size(); i++) {
//如果是E就找P如果有P就投p如果没p就找最新的e
char *os = NULL, *zt2_MaterialNo = NULL, *zt2_WBSNo = NULL;
ITKCALL(AOM_ask_value_string(feeds[i], "object_string", &os));
printf("feeds===>%s\n", os);
ITKCALL(AOM_ask_value_string(feeds[i], "zt2_WBSNo", &zt2_WBSNo));
ITKCALL(AOM_ask_value_string(feeds[i], "zt2_MaterialNo", &zt2_MaterialNo));
string wm = zt2_WBSNo;
wm.append("&").append(zt2_MaterialNo);
if (feedMap.count(wm) > 0) {
continue;
}
//getNewRev(wm, true, feeds, revMap, feedMap);
if (revMap.count(wm) == 0) {
//getNewRev(wm, false, feeds, revMap, feedMap);
}
}
for (auto it = feedMap.begin(); it != feedMap.end(); ++it) {
tag_t feed = it->second;
char *os = NULL;
ITKCALL(AOM_ask_value_string(feed, "object_string", &os));
printf("feed===>%s\n", os);
//AutoFeeding(feed, back_prefs, errBuffer, drawMap, nameMap, loginId);
}
}
printf("mapByq===>%zd\n", mapByq.size()); printf("mapByq===>%zd\n", mapByq.size());
if ((strcmp(bl_desc, "") == 0 || strstr(bl_desc, "-") == NULL) && strstr(objName, "变压器") == NULL && !isback) { if ((tc_strcmp(bl_desc, "") == 0 || tc_strstr(bl_desc, "-") == NULL) && tc_strstr(objName, "变压器") == NULL && !isback) {
errorBuff = "当前选中的物料版本没有图号信息,请检查.\n"; errorBuff = "当前选中的物料版本没有图号信息,请检查.\n";
} }
else { else {
@ -1424,6 +1449,109 @@ int CloneTempProcess(void *returnValue)
} }
POM_AM__set_application_bypass(false); POM_AM__set_application_bypass(false);
} }
ITKCALL(BOM_close_window(ebom_window));
}
int CloneTempProcess(void *returnValue)
{
// 记录开始时间点
auto start = std::chrono::high_resolution_clock::now();
int ifail = ITK_ok;
char* sql = NULL, *revUid;
tag_t designRev;
ITKCALL(ifail = USERARG_get_string_argument(&revUid));
ITK__convert_uid_to_tag(revUid, &designRev);
string errorBuff = "", notTcmBuff = "";
int url_num = 0;
char** url_vals = NULL;
ITKCALL(PREF_ask_char_values("database_tc", &url_num, &url_vals));
string url = url_vals[0];
url.append("/").append(url_vals[2]);
//map<string,
printf("url ==> %s \n", url.c_str());
if (ConnServer(url_vals[3], url_vals[4], (char*)url.c_str()) == -1)
{
printf("提示:中间数据表访问失败\n");
ifail = 1;
}
//如果是产成品的话, 判断是否存在多个P物料
//20240203备件包工艺路线指派
int back_num = 0;
char** back_vals = NULL, *group_name = NULL;
tag_t group = NULLTAG;
string tuhao;
vector<string> group_names;
ITKCALL(POM_ask_group(&group_name, &group));
Split(group_name, ".", group_names);
printf("group_name=======%s\n", group_names[0].c_str());
ITKCALL(PREF_ask_char_values("CHINT_PROCESS_RULE", &back_num, &back_vals));
vector<vector<string>> back_prefs;
//首选项格式:组名:匹配字段1;匹配字段2
for (int i = 0; i < back_num; i++) {
vector<string> group_backs;
Split(back_vals[i], ":", group_backs);
if (tc_strcmp(group_backs[0].c_str(), group_names[0].c_str()) == 0) {
vector<string> backs;
Split(group_backs[1], ";", backs);
back_prefs.push_back(backs);
}
}
boolean isback = false;
char* objName = NULL, *topId = NULL;
ITKCALL(AOM_ask_value_string(designRev, "object_name", &objName));
ITKCALL(AOM_ask_value_string(designRev, "item_id", &topId));
for (int i = 0; i < back_prefs.size(); i++) {
for (int j = 0; j < back_prefs.size(); j++) {
if (tc_strstr(objName, back_prefs[i][j].c_str()) != NULL) {
tuhao = back_prefs[i][j];
isback = true;
break;
}
}
}
if (isback || strstr(objName, "变压器") != NULL) {
CloneProcess(designRev, back_prefs, errorBuff, notTcmBuff);
}
else if (!isXn(designRev)) {
//lidy20241018增加向上找实件指派工艺的逻辑
vector<tag_t> feeds;
getParents(designRev, feeds, back_prefs);
map<string, string> revMap;
map<string, tag_t> feedMap;
for (int i = 0; i < feeds.size(); i++) {
//如果是E就找P如果有P就投p如果没p就找最新的e
char *os = NULL, *zt2_MaterialNo = NULL, *zt2_WBSNo = NULL;
ITKCALL(AOM_ask_value_string(feeds[i], "object_string", &os));
printf("feeds===>%s\n", os);
ITKCALL(AOM_ask_value_string(feeds[i], "zt2_WBSNo", &zt2_WBSNo));
ITKCALL(AOM_ask_value_string(feeds[i], "zt2_MaterialNo", &zt2_MaterialNo));
string wm = zt2_WBSNo;
wm.append("&").append(zt2_MaterialNo);
if (feedMap.count(wm) > 0) {
continue;
}
getNewRev(wm, true, feeds, revMap, feedMap);
if (revMap.count(wm) == 0) {
getNewRev(wm, false, feeds, revMap, feedMap);
}
}
for (auto it = feedMap.begin(); it != feedMap.end(); ++it) {
tag_t feed = it->second;
char *os = NULL;
ITKCALL(AOM_ask_value_string(feed, "object_string", &os));
printf("feed===>%s\n", os);
//AutoFeeding(feed, back_prefs, errBuffer, drawMap, nameMap, loginId);
CloneProcess(feed, back_prefs, errorBuff, notTcmBuff);
}
}
else {
CloneProcess(designRev, back_prefs, errorBuff, notTcmBuff);
}
// 记录结束时间点 // 记录结束时间点
@ -1442,7 +1570,6 @@ int CloneTempProcess(void *returnValue)
errorBuff = "succ"; errorBuff = "succ";
} }
printf("errorBuff==>%s\n", errorBuff.c_str()); printf("errorBuff==>%s\n", errorBuff.c_str());
ITKCALL(BOM_close_window(ebom_window));
*((char**)returnValue) = (char*)MEM_alloc((strlen(errorBuff.c_str()) + 1) * sizeof(char)); *((char**)returnValue) = (char*)MEM_alloc((strlen(errorBuff.c_str()) + 1) * sizeof(char));
tc_strcpy(*((char**)returnValue), errorBuff.c_str()); tc_strcpy(*((char**)returnValue), errorBuff.c_str());
return ifail; return ifail;

@ -664,6 +664,9 @@ void recyReadBom(tag_t bom_line, tag_t designRev, NodeBean& pBean, string& errBu
} }
return; return;
} }
boolean flagMat = false;
//根据图纸获取物料信息
askLineVal(pBean, bom_line, designRev, errBuff, flagMat);
tag_t tagUser; tag_t tagUser;
char *tagId; char *tagId;
@ -683,9 +686,6 @@ void recyReadBom(tag_t bom_line, tag_t designRev, NodeBean& pBean, string& errBu
//ITKCALL(AOM_ask_value_tag(bom_line, "bl_line_object", &designRev)); //ITKCALL(AOM_ask_value_tag(bom_line, "bl_line_object", &designRev));
//printf("1222"); //printf("1222");
boolean flagMat = false;
//根据图纸获取物料信息
askLineVal(pBean, bom_line, designRev, errBuff, flagMat);
//Í⹺ ²»Õ¹¿ª×Ó¼þ //Í⹺ ²»Õ¹¿ª×Ó¼þ
if (strstr(itemId, "2ZD") != NULL || strstr(itemId, "4ZD") != NULL) { if (strstr(itemId, "2ZD") != NULL || strstr(itemId, "4ZD") != NULL) {
if (!flagMat) { if (!flagMat) {
@ -1459,9 +1459,12 @@ string createEbom(NodeBean topBean, boolean isTop, string &hasChange, map<string
POM_AM__set_application_bypass(true); POM_AM__set_application_bypass(true);
ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView)); ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView));
ITKCALL(AOM_save(newView)); ITKCALL(AOM_save(newView));
ITKCALL(AOM_unlock(newView));//20241211
ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, mantr, &newViewBvr)); ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, mantr, &newViewBvr));
ITKCALL(AOM_save(newViewBvr)); ITKCALL(AOM_save(newViewBvr));
ITKCALL(AOM_unlock(newViewBvr));//20241211
ITKCALL(AOM_save(mantr)); ITKCALL(AOM_save(mantr));
ITKCALL(AOM_unlock(mantr));//20241211
ITKCALL(AOM_set_ownership(newView, dsuser, defGroup)); ITKCALL(AOM_set_ownership(newView, dsuser, defGroup));
ITKCALL(AOM_set_ownership(newViewBvr, dsuser, defGroup)); ITKCALL(AOM_set_ownership(newViewBvr, dsuser, defGroup));
} }
@ -1582,9 +1585,12 @@ void copyEBomLine(tag_t matnrTop, tag_t otherPbom) {
ITKCALL(ITEM_ask_item_of_rev(otherPbom, &pitem)); ITKCALL(ITEM_ask_item_of_rev(otherPbom, &pitem));
ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView)); ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView));
(AOM_save(newView)); (AOM_save(newView));
ITKCALL(AOM_unlock(newView));//20241211
ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, otherPbom, &newViewBvr)); ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, otherPbom, &newViewBvr));
(AOM_save(newViewBvr)); (AOM_save(newViewBvr));
ITKCALL(AOM_unlock(newViewBvr));//20241211
(AOM_save(otherPbom)); (AOM_save(otherPbom));
ITKCALL(AOM_unlock(otherPbom));//20241211
int num = 0; int num = 0;
tag_t dsuser, *structure_revisions, *bom_view_tags, *mantrs; tag_t dsuser, *structure_revisions, *bom_view_tags, *mantrs;
ITKCALL(AOM_ask_value_tags(otherPbom, "TC_Is_Represented_By", &num, &mantrs)); ITKCALL(AOM_ask_value_tags(otherPbom, "TC_Is_Represented_By", &num, &mantrs));

@ -483,18 +483,21 @@ string getXqName(char *name) {
*/ */
void addToAmatnr(tag_t *c_line_tags, int c_line_count, int len, tag_t newPAmatnr,boolean lastFlag) { void addToAmatnr(tag_t *c_line_tags, int c_line_count, int len, tag_t newPAmatnr,boolean lastFlag) {
tag_t mantr = newPAmatnr, ebom_window, bom_line; tag_t mantr = newPAmatnr, ebom_window = NULLTAG, bom_line = NULLTAG;
tag_t* bvr_list = NULL; tag_t* bvr_list = NULL;
int bvr_count; int bvr_count = 0;
ITKCALL(ITEM_rev_list_bom_view_revs(mantr, &bvr_count, &bvr_list)); ITKCALL(ITEM_rev_list_bom_view_revs(mantr, &bvr_count, &bvr_list));
if (bvr_count == 0) { if (bvr_count == 0) {
tag_t newView, newViewBvr, pitem; tag_t newView, newViewBvr, pitem;
ITKCALL(ITEM_ask_item_of_rev(mantr, &pitem)); ITKCALL(ITEM_ask_item_of_rev(mantr, &pitem));
ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView)); ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView));
AOM_save(newView); AOM_save(newView);
(AOM_unlock(newView));//20241211
ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, mantr, &newViewBvr)); ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, mantr, &newViewBvr));
AOM_save(newViewBvr); AOM_save(newViewBvr);
(AOM_unlock(newViewBvr));//20241211
AOM_save(mantr); AOM_save(mantr);
(AOM_unlock(mantr));//20241211
} }
ITKCALL(BOM_create_window(&ebom_window)); ITKCALL(BOM_create_window(&ebom_window));
@ -610,9 +613,12 @@ void replaceBom(EBomBean& childPm, map<string, tag_t>& map, int len, tag_t dcpro
ITEM_ask_item_of_rev(axqPmatnr, &pitem); ITEM_ask_item_of_rev(axqPmatnr, &pitem);
ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView)); ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView));
AOM_save(newView); AOM_save(newView);
(AOM_unlock(newView));//20241211
ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, axqPmatnr, &newViewBvr)); ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, axqPmatnr, &newViewBvr));
AOM_save(newViewBvr); AOM_save(newViewBvr);
(AOM_unlock(newViewBvr));//20241211
AOM_save(axqPmatnr); AOM_save(axqPmatnr);
(AOM_unlock(axqPmatnr));//20241211
tag_t dsuser, *structure_revisions, *bom_view_tags; tag_t dsuser, *structure_revisions, *bom_view_tags;
ITKCALL(AOM_ask_value_tag(tzRev, "owning_user", &dsuser)); ITKCALL(AOM_ask_value_tag(tzRev, "owning_user", &dsuser));
tag_t defGroup; tag_t defGroup;
@ -805,7 +811,7 @@ void recyReadEBom(tag_t pLine, EBomBean parentBean, vector<EBomBean>& beans, int
//12.4新增 物料下子件名称带 线 的11.3 分成335.3 //12.4新增 物料下子件名称带 线 的11.3 分成335.3
for (int tt = 0; tt < cc_cnt; tt++) { for (int tt = 0; tt < cc_cnt; tt++) {
tag_t cc_line = cc_lines[tt], c_eRev; tag_t cc_line = cc_lines[tt], c_eRev;
char* bl_quantity, *pId, *c_pId,*remark,*bl_line_name; char* bl_quantity = NULL, *pId = NULL, *c_pId, *remark = NULL, *bl_line_name = NULL;
ITKCALL(AOM_ask_value_string(eRev, "item_id", &pId)); ITKCALL(AOM_ask_value_string(eRev, "item_id", &pId));
ITKCALL(AOM_ask_value_string(cc_line, "bl_quantity", &bl_quantity)); ITKCALL(AOM_ask_value_string(cc_line, "bl_quantity", &bl_quantity));
ITKCALL(AOM_ask_value_string(cc_line, "ZT2_Remark", &remark)); ITKCALL(AOM_ask_value_string(cc_line, "ZT2_Remark", &remark));
@ -813,7 +819,7 @@ void recyReadEBom(tag_t pLine, EBomBean parentBean, vector<EBomBean>& beans, int
ITKCALL(AOM_ask_value_tag(cc_line, "bl_line_object", &c_eRev)); ITKCALL(AOM_ask_value_tag(cc_line, "bl_line_object", &c_eRev));
ITKCALL(AOM_ask_value_string(c_eRev, "item_id", &c_pId)); ITKCALL(AOM_ask_value_string(c_eRev, "item_id", &c_pId));
printf("c_pId===> %s bl_quantity ==> %s len==> %d \n", c_pId, bl_quantity, len); printf("c_pId===> %s bl_quantity ==> %s len==> %d \n", c_pId, bl_quantity, len);
if (strcmp("bl_quantity", "") == 0) { if (tc_strcmp(bl_quantity, "") == 0) {
errBuff.append("P类物料:").append(pId).append("下子件").append(c_pId) errBuff.append("P类物料:").append(pId).append("下子件").append(c_pId)
.append("无法整除,请检查。").append("\n"); .append("无法整除,请检查。").append("\n");
} }
@ -822,7 +828,7 @@ void recyReadEBom(tag_t pLine, EBomBean parentBean, vector<EBomBean>& beans, int
printf("markMsg===> %s \n", markMsg.c_str()); printf("markMsg===> %s \n", markMsg.c_str());
if (markMsg.length() == 0) { if (markMsg.length() == 0) {
int blQty = atoi(bl_quantity); int blQty = atoi(bl_quantity);
if (blQty % len != 0 && strstr(bl_line_name,"Ïß")==NULL) { if (blQty % len != 0 && tc_strstr(bl_line_name, "Ïß") == NULL) {
errBuff.append("P类物料:").append(pId).append("下子件").append(c_pId) errBuff.append("P类物料:").append(pId).append("下子件").append(c_pId)
.append("无法整除,请检查。").append("\n"); .append("无法整除,请检查。").append("\n");
} }
@ -835,7 +841,7 @@ void recyReadEBom(tag_t pLine, EBomBean parentBean, vector<EBomBean>& beans, int
} }
else { else {
int blQty = atoi(bl_quantity); int blQty = atoi(bl_quantity);
if (blQty % markMsg.length() != 0 && strstr(bl_line_name, "Ïß") == NULL) { if (blQty % markMsg.length() != 0 && tc_strstr(bl_line_name, "Ïß") == NULL) {
errBuff.append("P类物料:").append(pId).append("下子件").append(c_pId) errBuff.append("P类物料:").append(pId).append("下子件").append(c_pId)
.append("无法整除,请检查。").append("\n"); .append("无法整除,请检查。").append("\n");
} }
@ -957,7 +963,7 @@ void updatePbomCycle(tag_t eLine, string &errBuff, int len, EBomUpBean &upBean)
ITKCALL(AOM_ask_value_string(c_eRev, "item_id", &c_pId)); ITKCALL(AOM_ask_value_string(c_eRev, "item_id", &c_pId));
ITKCALL(AOM_ask_value_string(cc_line, "ZT2_Remark", &remark)); ITKCALL(AOM_ask_value_string(cc_line, "ZT2_Remark", &remark));
printf("c_pId===> %s bl_quantity ==> %s len==> %d \n", c_pId, bl_quantity, len); printf("c_pId===> %s bl_quantity ==> %s len==> %d \n", c_pId, bl_quantity, len);
if (strcmp("bl_quantity", "") == 0) { if (tc_strcmp("bl_quantity", "") == 0) {
errBuff.append("P类物料:").append(pId).append("下子件").append(c_pId) errBuff.append("P类物料:").append(pId).append("下子件").append(c_pId)
.append("无法整除,请检查。").append("\n"); .append("无法整除,请检查。").append("\n");
} }
@ -966,7 +972,7 @@ void updatePbomCycle(tag_t eLine, string &errBuff, int len, EBomUpBean &upBean)
printf("markMsg===> %s \n", markMsg.c_str()); printf("markMsg===> %s \n", markMsg.c_str());
if (markMsg.length() == 0) { if (markMsg.length() == 0) {
int blQty = atoi(bl_quantity); int blQty = atoi(bl_quantity);
if (blQty % len != 0 && strstr(bl_line_name, "Ïß") == NULL) { if (blQty % len != 0 && tc_strstr(bl_line_name, "Ïß") == NULL) {
errBuff.append("P类物料:").append(pId).append("下子件").append(c_pId) errBuff.append("P类物料:").append(pId).append("下子件").append(c_pId)
.append("无法整除,请检查。").append("\n"); .append("无法整除,请检查。").append("\n");
} }
@ -980,7 +986,7 @@ void updatePbomCycle(tag_t eLine, string &errBuff, int len, EBomUpBean &upBean)
} }
else { else {
int blQty = atoi(bl_quantity); int blQty = atoi(bl_quantity);
if (blQty % markMsg.length() != 0 && strstr(bl_line_name, "Ïß") == NULL) { if (blQty % markMsg.length() != 0 && tc_strstr(bl_line_name, "Ïß") == NULL) {
errBuff.append("P类物料:").append(pId).append("下子件").append(c_pId) errBuff.append("P类物料:").append(pId).append("下子件").append(c_pId)
.append("无法整除,请检查。").append("\n"); .append("无法整除,请检查。").append("\n");
} }
@ -1159,23 +1165,26 @@ void createAXxq(tag_t eRev, tag_t pRev, int len, tag_t dcproxy) {
int bvr_count = 0, c_line_count; int bvr_count = 0, c_line_count;
tag_t ebom_window = NULLTAG; tag_t ebom_window = NULLTAG;
tag_t bom_line = NULLTAG, *c_line_tags; tag_t bom_line = NULLTAG, *c_line_tags = NULLTAG;
tag_t* bvr_list = NULL; tag_t* bvr_list = NULL;
ITKCALL(ITEM_rev_list_bom_view_revs(axqPmatnr, &bvr_count, &bvr_list)); ITKCALL(ITEM_rev_list_bom_view_revs(axqPmatnr, &bvr_count, &bvr_list));
WriteTcLog("bvr_count=%d\n", bvr_count); WriteTcLog("bvr_count=%d\n", bvr_count);
if (bvr_count == 0) { if (bvr_count == 0) {
tag_t newView, newViewBvr, pitem; tag_t newView = NULLTAG, newViewBvr = NULLTAG, pitem = NULLTAG;
ITEM_ask_item_of_rev(axqPmatnr, &pitem); ITEM_ask_item_of_rev(axqPmatnr, &pitem);
ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView)); ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView));
AOM_save(newView); AOM_save(newView);
(AOM_unlock(newView));//20241211
ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, axqPmatnr, &newViewBvr)); ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, axqPmatnr, &newViewBvr));
AOM_save(newViewBvr); AOM_save(newViewBvr);
(AOM_unlock(newViewBvr));//20241211
AOM_save(axqPmatnr); AOM_save(axqPmatnr);
(AOM_unlock(axqPmatnr));//20241211
//return; //return;
tag_t dsuser, *structure_revisions, *bom_view_tags; tag_t dsuser = NULLTAG, *structure_revisions = NULLTAG, *bom_view_tags = NULLTAG;
ITKCALL(AOM_ask_value_tag(tzRev, "owning_user", &dsuser)); ITKCALL(AOM_ask_value_tag(tzRev, "owning_user", &dsuser));
tag_t defGroup; tag_t defGroup = NULLTAG;
ITKCALL(AOM_ask_value_tag(dsuser, "default_group", &defGroup)); ITKCALL(AOM_ask_value_tag(dsuser, "default_group", &defGroup));
ITKCALL(AOM_set_ownership(newView, dsuser, defGroup)); ITKCALL(AOM_set_ownership(newView, dsuser, defGroup));
ITKCALL(AOM_set_ownership(newViewBvr, dsuser, defGroup)); ITKCALL(AOM_set_ownership(newViewBvr, dsuser, defGroup));
@ -1221,19 +1230,22 @@ void createAXxq(tag_t eRev, tag_t pRev, int len, tag_t dcproxy) {
//添加A项线圈的子行 //添加A项线圈的子行
void addToAmatnrUp(vector<EBomUpBean> vecs, int len, tag_t newPAmatnr, boolean lastFlag) { void addToAmatnrUp(vector<EBomUpBean> vecs, int len, tag_t newPAmatnr, boolean lastFlag) {
tag_t mantr = newPAmatnr, ebom_window, bom_line; tag_t mantr = newPAmatnr, ebom_window = NULLTAG, bom_line = NULLTAG;
tag_t* bvr_list = NULL; tag_t* bvr_list = NULL;
int bvr_count; int bvr_count;
POM_AM__set_application_bypass(true); POM_AM__set_application_bypass(true);
ITKCALL(ITEM_rev_list_bom_view_revs(mantr, &bvr_count, &bvr_list)); ITKCALL(ITEM_rev_list_bom_view_revs(mantr, &bvr_count, &bvr_list));
if (bvr_count == 0) { if (bvr_count == 0) {
tag_t newView, newViewBvr, pitem; tag_t newView = NULLTAG, newViewBvr = NULLTAG, pitem = NULLTAG;
ITKCALL(ITEM_ask_item_of_rev(mantr, &pitem)); ITKCALL(ITEM_ask_item_of_rev(mantr, &pitem));
ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView)); ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView));
(AOM_save(newView)); (AOM_save(newView));
(AOM_unlock(newView));//20241211
ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, mantr, &newViewBvr)); ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, mantr, &newViewBvr));
(AOM_save(newViewBvr)); (AOM_save(newViewBvr));
(AOM_unlock(newViewBvr));//20241211
(AOM_save(mantr)); (AOM_save(mantr));
(AOM_unlock(mantr));//20241211
} }
ITKCALL(BOM_create_window(&ebom_window)); ITKCALL(BOM_create_window(&ebom_window));
ITKCALL(BOM_set_window_top_line(ebom_window, NULL, mantr, NULLTAG, &bom_line)); ITKCALL(BOM_set_window_top_line(ebom_window, NULL, mantr, NULLTAG, &bom_line));
@ -1320,9 +1332,8 @@ map<string, double> getEBomMesg(EBomUpBean upBean) {
EBomUpBean cBean = childs[i]; EBomUpBean cBean = childs[i];
double qtyPXn = 1; double qtyPXn = 1;
string matnrNo = cBean.matnrNo; string matnrNo = cBean.matnrNo;
printf("matnrNo====> %s\n", matnrNo.c_str());
string cnt = cBean.blQuantity; string cnt = cBean.blQuantity;
if (strcmp(cnt.c_str(), "") != 0) { if (tc_strcmp(cnt.c_str(), "") != 0) {
qtyPXn = atof(cnt.c_str()); //atof(oldQty); qtyPXn = atof(cnt.c_str()); //atof(oldQty);
} }
if (eMap.count(matnrNo) > 0) { if (eMap.count(matnrNo) > 0) {
@ -1331,6 +1342,7 @@ map<string, double> getEBomMesg(EBomUpBean upBean) {
else { else {
eMap[matnrNo] = qtyPXn; eMap[matnrNo] = qtyPXn;
} }
printf("getEBomMesg====> %s == %f\n", matnrNo.c_str(), eMap[matnrNo]);
} }
return eMap; return eMap;
} }
@ -1349,7 +1361,6 @@ void getPBomMsg(tag_t bom_line, map<string, double>& bomMsgMap) {
char *matnrNo, *cnt, *objName; char *matnrNo, *cnt, *objName;
ITKCALL(AOM_ask_value_tag(c_line_tags[t], BL_LINE_OBJECT, &c_Rev)); ITKCALL(AOM_ask_value_tag(c_line_tags[t], BL_LINE_OBJECT, &c_Rev));
ITKCALL(AOM_ask_value_string(c_Rev, MATERIALNO, &matnrNo)); ITKCALL(AOM_ask_value_string(c_Rev, MATERIALNO, &matnrNo));
printf("zt2_MaterialNo===>%s\n", matnrNo);
double qtyPXn = 1; double qtyPXn = 1;
ITKCALL(AOM_ask_value_string(c_line_tags[t], BL_QUANTITY, &cnt)); ITKCALL(AOM_ask_value_string(c_line_tags[t], BL_QUANTITY, &cnt));
if (strcmp(cnt, "") != 0) { if (strcmp(cnt, "") != 0) {
@ -1361,6 +1372,7 @@ void getPBomMsg(tag_t bom_line, map<string, double>& bomMsgMap) {
else { else {
bomMsgMap[matnrNo] = qtyPXn; bomMsgMap[matnrNo] = qtyPXn;
} }
printf("zt2_MaterialNo===>%s == %f\n", matnrNo, bomMsgMap[matnrNo]);
} }
} }
/** /**
@ -1395,7 +1407,6 @@ map<string, double> getPBomMsg(tag_t mantrRev, bool& flag, vector<tag_t>& termCo
double qtyPXn = 1; double qtyPXn = 1;
ITKCALL(AOM_ask_value_string(c_line_tags[t], "bl_quantity", &cnt)); ITKCALL(AOM_ask_value_string(c_line_tags[t], "bl_quantity", &cnt));
ITKCALL(AOM_ask_value_string(c_Rev, OBJECT_NAME, &objName)); ITKCALL(AOM_ask_value_string(c_Rev, OBJECT_NAME, &objName));
printf("zt2_MaterialNo===>%s objName ===> %s\n", matnrNo, objName);
if (checkName(objName)) { if (checkName(objName)) {
termCoils.push_back(c_Rev); termCoils.push_back(c_Rev);
getPBomMsg(c_line_tags[t], bomMsgMap); getPBomMsg(c_line_tags[t], bomMsgMap);
@ -1410,6 +1421,7 @@ map<string, double> getPBomMsg(tag_t mantrRev, bool& flag, vector<tag_t>& termCo
else { else {
bomMsgMap[matnrNo] = qtyPXn; bomMsgMap[matnrNo] = qtyPXn;
} }
printf("getPBomMsg===>%s objName===> %s == %f\n", matnrNo, objName, bomMsgMap[matnrNo]);
} }
ITKCALL(BOM_close_window(ebom_window)); ITKCALL(BOM_close_window(ebom_window));
return bomMsgMap; return bomMsgMap;
@ -1425,12 +1437,16 @@ boolean combEAndDbom(map<string, double> dMap, map<string, double> eMap) {
for (it = dMap.begin(); it != dMap.end(); it++) { for (it = dMap.begin(); it != dMap.end(); it++) {
string s = it->first; string s = it->first;
double dnum = dMap[s]; double dnum = dMap[s];
printf("combEAndDbom£º%s == %d == ", s.c_str(), dnum);
if (eMap.count(s) == 0) { if (eMap.count(s) == 0) {
printf("0\n");
return true; return true;
} }
else if (dnum != eMap[s]) { else if (dnum != eMap[s]) {
printf("%d\n", eMap[s]);
return true; return true;
} }
printf("\n");
} }
return false; return false;
} }
@ -1568,7 +1584,7 @@ void startUpdate(EBomUpBean upBean, tag_t pBomTag, int len, tag_t dcproxy,
ITKCALL(AOM_ask_value_string(eRev, "object_name", &name)); ITKCALL(AOM_ask_value_string(eRev, "object_name", &name));
//移除PBOM //移除PBOM
printf("zt2_MaterialNo ===>%s ifpBom==>%s\n", matnrNo, ifpBom); printf("zt2_MaterialNo ===>%s ifpBom==>%s\n", matnrNo, ifpBom);
if (strcmp(ifpBom, "P") == 0) { if (tc_strcmp(ifpBom, "P") == 0) {
//A项线圈是不带P的 //A项线圈是不带P的
matnrVec.push_back(matnrNo); matnrVec.push_back(matnrNo);
pBomMap[matnrNo] = c_line_tag; pBomMap[matnrNo] = c_line_tag;
@ -1626,6 +1642,13 @@ void startUpdate(EBomUpBean upBean, tag_t pBomTag, int len, tag_t dcproxy,
ITKCALL(BOM_save_window(bomView)); ITKCALL(BOM_save_window(bomView));
ITKCALL(BOM_close_window(bomView)); ITKCALL(BOM_close_window(bomView));
} }
tag_t cline = cupBean.bomline;
char* qty = NULL;
ITKCALL(AOM_ask_value_string(cline, "bl_quantity", &qty));
(AOM_lock(c_line_tag));
ITKCALL(AOM_set_value_string(c_line_tag, "bl_quantity", qty));
(AOM_save(c_line_tag));
(AOM_unlock(c_line_tag));
//printf("i2===>%d\n", i); //printf("i2===>%d\n", i);
} }
else { else {
@ -1722,13 +1745,16 @@ void copyBomLine(tag_t matnrTop, tag_t otherPbom) {
ITKCALL(ITEM_rev_list_bom_view_revs(otherPbom, &bvr_count2, &bvr_list2)); ITKCALL(ITEM_rev_list_bom_view_revs(otherPbom, &bvr_count2, &bvr_list2));
if (bvr_count2 == 0) { if (bvr_count2 == 0) {
tag_t newView, newViewBvr, pitem; tag_t newView = NULLTAG, newViewBvr = NULLTAG, pitem = NULLTAG;
ITKCALL(ITEM_ask_item_of_rev(otherPbom, &pitem)); ITKCALL(ITEM_ask_item_of_rev(otherPbom, &pitem));
ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView)); ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView));
(AOM_save(newView)); (AOM_save(newView));
(AOM_unlock(newView));//20241211
ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, otherPbom, &newViewBvr)); ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, otherPbom, &newViewBvr));
(AOM_save(newViewBvr)); (AOM_save(newViewBvr));
(AOM_unlock(newViewBvr));//20241211
(AOM_save(otherPbom)); (AOM_save(otherPbom));
(AOM_unlock(otherPbom));//20241211
//return; //return;
ITKCALL(ITEM_rev_list_bom_view_revs(otherPbom, &bvr_count2, &bvr_list2)); ITKCALL(ITEM_rev_list_bom_view_revs(otherPbom, &bvr_count2, &bvr_list2));
} }

@ -2,5 +2,22 @@
// //
#include "stdafx.h" #include "stdafx.h"
#include "tc_util.h"
#include "epm_handler_common.h"
int AddReleasedStatus(void *)
{
tag_t object = NULLTAG, release_status = NULLTAG;
char* status = NULL;
ITKCALL(USERARG_get_tag_argument(&object));
ITKCALL(USERARG_get_string_argument(&status));
ITKCALL(RELSTAT_create_release_status(status, &release_status));
ITKCALL(RELSTAT_add_release_status(release_status, 1, &object, NULL));
//if (object) { MEM_free(&object); object = NULL; }
//if (release_status) { MEM_free(release_status); release_status = NULL; }
return ITK_ok;
}

@ -182,6 +182,7 @@ int HXC_create_item_post(METHOD_message_t* msg , va_list va)
ITKCALL(status=(FL_insert(folders2[w],*item_tag,999))); ITKCALL(status=(FL_insert(folders2[w],*item_tag,999)));
//±£´æ //±£´æ
ITKCALL(status=AOM_save(folders2[w])); ITKCALL(status=AOM_save(folders2[w]));
(AOM_unlock(folders2[w]));//20241211
POM_AM__set_application_bypass(false); POM_AM__set_application_bypass(false);
} }
} }

@ -109,7 +109,7 @@ int create_dataset(char *type_name, const char *name, tag_t excelTag)
ITKCALL(ifail=AOM_save(spec_dataset_rev)); ITKCALL(ifail=AOM_save(spec_dataset_rev));
ITKCALL(ifail=AOM_unlock(spec_dataset_rev)); ITKCALL(ifail=AOM_unlock(spec_dataset_rev));
ITKCALL(AOM_save(excelTag)); //ITKCALL(AOM_save(excelTag));
return 0; return 0;
} }
string GenerateGuid() string GenerateGuid()

@ -343,7 +343,7 @@ int CHINT_task_complete(EPM_action_message_t msg) {
char *taskName = NULL; char *taskName = NULL;
ITKCALL(AOM_ask_value_string(taskTag, "job_name", &taskName)); ITKCALL(AOM_ask_value_string(taskTag, "job_name", &taskName));
printf("taskName %s \n", taskName); printf("taskName %s \n", taskName);
if (tc_strstr(taskName, projName.c_str()) != NULL) { if (tc_strstr(taskName, projName.c_str()) != NULL && tc_strcmp(taskName, jobName) != 0) {
ITKCALL(EPM_set_task_result(taskTag, EPM_RESULT_Completed)); ITKCALL(EPM_set_task_result(taskTag, EPM_RESULT_Completed));
ITKCALL(EPM_trigger_action(taskTag, EPM_complete_action, "")); ITKCALL(EPM_trigger_action(taskTag, EPM_complete_action, ""));
} }
@ -358,7 +358,9 @@ int CHINT_task_complete(EPM_action_message_t msg) {
if (tasklists.size() > 0) { if (tasklists.size() > 0) {
string json = "{\"projectcode\":\""; string json = "{\"projectcode\":\"";
json.append(zt2_ProjectCode).append("\",\"tasklists\":[").append(tasklists).append("]}"); json.append(zt2_ProjectCode).append("\",\"tasklists\":[").append(tasklists).append("]}");
printf("json %s \n", json.c_str());
//yp_query(yp_url, json);
thread newThread(yp_query, yp_url, json); thread newThread(yp_query, yp_url, json);
newThread.detach(); newThread.detach();
} }

@ -42,10 +42,47 @@
#include "CRUL_server_call_httpserver.h" #include "CRUL_server_call_httpserver.h"
#include "common_itk_util.h" #include "common_itk_util.h"
#include <chrono> #include <chrono>
#include <cctype> // for std::isspace
#define EPM_HANDLER_COMMON #define EPM_HANDLER_COMMON
#define MAX_PATH_LENGTH 200 #define MAX_PATH_LENGTH 200
#define MAX_PRINTLINE_LENGTH 400000 #define MAX_PRINTLINE_LENGTH 400000
std::string removeWhitespace1(const std::string& str) {
std::string result;
result.reserve(str.size()); // 预留空间以提高性能
// 使用 std::copy_if 和 std::isspace 来过滤掉空白字符
std::copy_if(str.begin(), str.end(), std::back_inserter(result),
[](unsigned char ch) { return !std::isspace(ch); });
return result;
}
// 转义json字符串
void escapeJson1(std::string& str) {
int len = str.length();
int newLen = len;
for (int i = 0; i < len; i++) {
if (str[i] == '"' || str[i] == '\\') {
newLen++;
}
}
std::string escapedStr;
escapedStr.reserve(newLen);
for (int i = 0; i < len; i++) {
if (str[i] == '"' || str[i] == '\\') {
escapedStr.push_back('\\');
}
escapedStr.push_back(str[i]);
}
str = escapedStr;
}
char* utog(const char* src_str) char* utog(const char* src_str)
{ {
int len = MultiByteToWideChar(CP_UTF8, 0, src_str, -1, NULL, 0); int len = MultiByteToWideChar(CP_UTF8, 0, src_str, -1, NULL, 0);
@ -295,10 +332,16 @@ int chint_changenotice(EPM_action_message_t msg) {
json = cJSON_Print(top); json = cJSON_Print(top);
printf("json================%s\n", json); printf("json================%s\n", json);
string result;
result.append(json);
escapeJson1(result);
string result1 = removeWhitespace1(result);
printf("result1=============%s\n", result1.c_str());
// lidy20240829ÐÂ½Ó¿Ú // lidy20240829нӿÚ
string cmd = "java -jar \""; string cmd = "java -jar \"";
cmd.append(getenv("TC_ROOT")).append("\\bin\\uploadMinio.jar\" FS \"").append(json).append("\""); cmd.append(getenv("TC_ROOT")).append("\\bin\\uploadMinio.jar\" FS \"").append(result1).append("\"");
printf("cmd==>%s", cmd.c_str()); printf("cmd==>%s", cmd.c_str());
FILE* pf = NULL; FILE* pf = NULL;
string strResult; string strResult;

@ -42,10 +42,43 @@
#include "CRUL_server_call_httpserver.h" #include "CRUL_server_call_httpserver.h"
#include "common_itk_util.h" #include "common_itk_util.h"
#include <chrono> #include <chrono>
#include <cctype> // for std::isspace
#include <string>
#include <algorithm>
#define EPM_HANDLER_COMMON #define EPM_HANDLER_COMMON
#define MAX_PATH_LENGTH 200 #define MAX_PATH_LENGTH 200
#define MAX_PRINTLINE_LENGTH 400000 #define MAX_PRINTLINE_LENGTH 400000
std::string removeWhitespace(const std::string& str) {
std::string result;
result.reserve(str.size()); // 预留空间以提高性能
// 使用 std::copy_if 和 std::isspace 来过滤掉空白字符
std::copy_if(str.begin(), str.end(), std::back_inserter(result),
[](unsigned char ch) { return !std::isspace(ch); });
return result;
}
// 转义json字符串
void escapeJson2(std::string& str) {
int len = str.length();
int newLen = len;
for (int i = 0; i < len; i++) {
if (str[i] == '"' || str[i] == '\\') {
newLen++;
}
}
std::string escapedStr;
escapedStr.reserve(newLen);
for (int i = 0; i < len; i++) {
if (str[i] == '"' || str[i] == '\\') {
escapedStr.push_back('\\');
}
escapedStr.push_back(str[i]);
}
str = escapedStr;
}
char* concat(char** s, int size) { char* concat(char** s, int size) {
int length = 0; int length = 0;
@ -340,10 +373,18 @@ int chint_changenoticebm(EPM_action_message_t msg) {
json = cJSON_Print(top); json = cJSON_Print(top);
printf("json================%s\n", json); printf("json================%s\n", json);
string result;
result.append(json);
escapeJson2(result);
string result1 = removeWhitespace(result);
printf("result1=============%s\n", result1.c_str());
// lidy20240829ÐÂ½Ó¿Ú // lidy20240829нӿÚ
string cmd = "java -jar \""; string cmd = "java -jar \"";
cmd.append(getenv("TC_ROOT")).append("\\bin\\uploadMinio.jar\" FS \"").append(json).append("\""); cmd.append(getenv("TC_ROOT")).append("\\bin\\uploadMinio.jar\" FS \"").append(result1).append("\"");
printf("cmd==>%s", cmd.c_str()); printf("cmd==>%s", cmd.c_str());
FILE* pf = NULL; FILE* pf = NULL;
string strResult; string strResult;

@ -91,6 +91,7 @@ int chint_check_materialstatus(EPM_action_message_t msg) {
std::map<std::string, std::string> tyMap; std::map<std::string, std::string> tyMap;
//封存集合 //封存集合
std::map<std::string, std::string> fcMap; std::map<std::string, std::string> fcMap;
POM_AM__set_application_bypass(true);
for (int i = 0; i < att_cnt; i++) for (int i = 0; i < att_cnt; i++)
{ {
tag_t target = NULLTAG; tag_t target = NULLTAG;
@ -101,7 +102,7 @@ int chint_check_materialstatus(EPM_action_message_t msg) {
ITKCALL(AOM_ask_value_string(target, "object_type", &objectType)); ITKCALL(AOM_ask_value_string(target, "object_type", &objectType));
//物料 //物料
printf("objectType======%s\n", objectType); printf("objectType======%s\n", objectType);
if (strcmp(objectType, "Part Revision") == 0) { if (tc_strcmp(objectType, "Part Revision") == 0) {
//获取物料编码和物料名称 //获取物料编码和物料名称
char* zt2_MaterialNo = NULL; char* zt2_MaterialNo = NULL;
char* object_name = NULL; char* object_name = NULL;
@ -110,12 +111,12 @@ int chint_check_materialstatus(EPM_action_message_t msg) {
ITKCALL(AOM_ask_value_string(target, "object_desc", &tyStr)); ITKCALL(AOM_ask_value_string(target, "object_desc", &tyStr));
ITKCALL(AOM_UIF_ask_value(target, "zt2_State", &zt2_State)); ITKCALL(AOM_UIF_ask_value(target, "zt2_State", &zt2_State));
printf("tyStr======%s\n", tyStr); printf("tyStr======%s\n", tyStr);
if (strstr(tyStr, "停用")) { if (tc_strstr(tyStr, "停用")) {
//放入停用map //放入停用map
tyMap[zt2_MaterialNo] = object_name; tyMap[zt2_MaterialNo] = object_name;
continue; continue;
} }
else if (strstr(zt2_State, "封存")) { else if (tc_strstr(zt2_State, "封存")) {
//放入封存map //放入封存map
fcMap[zt2_MaterialNo] = object_name; fcMap[zt2_MaterialNo] = object_name;
continue; continue;
@ -124,7 +125,7 @@ int chint_check_materialstatus(EPM_action_message_t msg) {
} }
//物料bom :获取第一层 //物料bom :获取第一层
if (strcmp(objectType, "BOMView Revision") == 0) { if (tc_strcmp(objectType, "BOMView Revision") == 0) {
//获取第一层 //获取第一层
////遍历子BOM获取属性 ////遍历子BOM获取属性
//tag_t window_0_; //tag_t window_0_;
@ -166,7 +167,7 @@ int chint_check_materialstatus(EPM_action_message_t msg) {
ITKCALL(AOM_ask_value_string(rev, "object_type", &objectType_rev)); ITKCALL(AOM_ask_value_string(rev, "object_type", &objectType_rev));
//物料 //物料
if (strcmp(objectType_rev, "Part Revision") == 0) { if (tc_strcmp(objectType_rev, "Part Revision") == 0) {
//获取物料编码和物料名称 //获取物料编码和物料名称
char* zt2_MaterialNo = NULL; char* zt2_MaterialNo = NULL;
char* object_name = NULL; char* object_name = NULL;
@ -175,19 +176,17 @@ int chint_check_materialstatus(EPM_action_message_t msg) {
ITKCALL(AOM_ask_value_string(rev, "object_desc", &tyStr)); ITKCALL(AOM_ask_value_string(rev, "object_desc", &tyStr));
ITKCALL(AOM_UIF_ask_value(rev, "zt2_State", &zt2_State)); ITKCALL(AOM_UIF_ask_value(rev, "zt2_State", &zt2_State));
if (strstr(zt2_State, "封存")) { if (tc_strstr(zt2_State, "封存")) {
//放入封存map //放入封存map
fcMap[zt2_MaterialNo] = object_name; fcMap[zt2_MaterialNo] = object_name;
} }
else if (strstr(tyStr, "停用")) { else if (tc_strstr(tyStr, "停用")) {
//放入停用map //放入停用map
tyMap[zt2_MaterialNo] = object_name; tyMap[zt2_MaterialNo] = object_name;
} }
} }
} }
ITKCALL(BOM_close_window(bom_window_tag));//BOM_close_window
} }
////图纸 ////图纸
//if (strcmp(objectType, "ZT2_Design3DRevision") == 0) { //if (strcmp(objectType, "ZT2_Design3DRevision") == 0) {
@ -233,7 +232,7 @@ int chint_check_materialstatus(EPM_action_message_t msg) {
//图纸 //图纸
if (strcmp(objectType, "ZT2_Design3DRevision") == 0) { if (tc_strcmp(objectType, "ZT2_Design3DRevision") == 0) {
//获取关系文件夹下的物料 //获取关系文件夹下的物料
int wlNum; tag_t* wlTags; int wlNum; tag_t* wlTags;
@ -245,7 +244,7 @@ int chint_check_materialstatus(EPM_action_message_t msg) {
ITKCALL(AOM_ask_value_string(wlTags[j], "object_type", &objectType_rev)); ITKCALL(AOM_ask_value_string(wlTags[j], "object_type", &objectType_rev));
//物料 //物料
printf("objectType_rev======%s\n", objectType_rev); printf("objectType_rev======%s\n", objectType_rev);
if (strcmp(objectType_rev, "Part Revision") == 0) { if (tc_strcmp(objectType_rev, "Part Revision") == 0) {
//获取物料编码和物料名称 //获取物料编码和物料名称
char* zt2_MaterialNo = NULL; char* zt2_MaterialNo = NULL;
char* object_name = NULL; char* object_name = NULL;
@ -254,13 +253,13 @@ int chint_check_materialstatus(EPM_action_message_t msg) {
ITKCALL(AOM_ask_value_string(wlTags[j], "object_desc", &tyStr)); ITKCALL(AOM_ask_value_string(wlTags[j], "object_desc", &tyStr));
ITKCALL(AOM_UIF_ask_value(wlTags[j], "zt2_State", &zt2_State)); ITKCALL(AOM_UIF_ask_value(wlTags[j], "zt2_State", &zt2_State));
printf("zt2_State======%s\n", zt2_State); printf("zt2_State======%s\n", zt2_State);
if (strstr(tyStr, "停用")) { if (tc_strstr(tyStr, "停用")) {
//放入停用map //放入停用map
tyMap[zt2_MaterialNo] = object_name; tyMap[zt2_MaterialNo] = object_name;
printf("00000000000000000000000000\n"); printf("00000000000000000000000000\n");
continue; continue;
} }
else if (strstr(zt2_State, "封存")) { else if (tc_strstr(zt2_State, "封存")) {
//放入封存map //放入封存map
fcMap[zt2_MaterialNo] = object_name; fcMap[zt2_MaterialNo] = object_name;
printf("11111111111111111111111111\n"); printf("11111111111111111111111111\n");
@ -269,8 +268,8 @@ int chint_check_materialstatus(EPM_action_message_t msg) {
} }
} }
} }
} }
POM_AM__set_application_bypass(false);
//收集完map数据进行拼接报错 //收集完map数据进行拼接报错
string errMsg = ""; string errMsg = "";
for (auto it = tyMap.begin(); it != tyMap.end(); it++) { for (auto it = tyMap.begin(); it != tyMap.end(); it++) {

@ -72,6 +72,8 @@ int CHINT_CHANGEITEM_TO_SRM(EPM_action_message_t msg);
int CHINT_CHANGEBOM_TO_SRM(EPM_action_message_t msg); int CHINT_CHANGEBOM_TO_SRM(EPM_action_message_t msg);
int CHINT_CHANGETZCG_TO_SRM(EPM_action_message_t msg); int CHINT_CHANGETZCG_TO_SRM(EPM_action_message_t msg);
EPM_decision_t chint_csh_check(EPM_rule_message_t msg); EPM_decision_t chint_csh_check(EPM_rule_message_t msg);
int AddReleasedStatus(void *);
//user service end //user service end
#ifdef __cplusplus #ifdef __cplusplus
} }

@ -526,6 +526,18 @@ extern DLLAPI int USERSERVICE_custom_register_methods(int *decision, va_list arg
} }
MEM_free(argumentList); MEM_free(argumentList);
} }
{
/*Ìí¼Ó״̬*/
USER_function_t functionPtr = AddReleasedStatus;
int numberOfArguments = 2;
int returnValueType = USERARG_VOID_TYPE;
int *argumentList = (int*)MEM_alloc(numberOfArguments * sizeof(int));
argumentList[0] = USERARG_TAG_TYPE;
argumentList[1] = USERARG_STRING_TYPE;
ITKCALL(USERSERVICE_register_method("AddReleasedStatus", functionPtr, numberOfArguments, argumentList, returnValueType));
printf("Registering AddReleasedStatus finished\n");
MEM_free(argumentList);
}
return ITK_ok; return ITK_ok;
} }

@ -87,3 +87,6 @@ int ITEM_list_all_revs_alpha(tag_t item_tag,int *rev_cnt,tag_t **revs);
char* G2U(const char* gb2312); char* G2U(const char* gb2312);
char* U2G(const char* utf8); char* U2G(const char* utf8);
void getParents(tag_t matnrRev, vector<tag_t>& feeds, vector<vector<string>> back_prefs);
void getNewRev(string wm, bool isp, vector<tag_t> feeds, map<string, string>& revMap, map<string, tag_t>& feedMap);
Loading…
Cancel
Save