|
|
|
@ -90,12 +90,16 @@ void save_representation2(tag_t primaryTag, tag_t secondTag, char* relationType)
|
|
|
|
|
|
|
|
|
|
ITKCALL(AOM_refresh(primaryTag, TRUE));
|
|
|
|
|
ITKCALL(AOM_refresh(secondTag, TRUE));
|
|
|
|
|
(AOM_lock(primaryTag));
|
|
|
|
|
(AOM_lock(secondTag));
|
|
|
|
|
tag_t relationTag = NULLTAG;
|
|
|
|
|
ITKCALL(GRM_create_relation(primaryTag, secondTag, typeTag, NULLTAG, &relationTag));//如果关系已经存在,那么就是增加对象
|
|
|
|
|
|
|
|
|
|
ITKCALL(GRM_save_relation(relationTag));//很必要
|
|
|
|
|
(AOM_save(primaryTag));
|
|
|
|
|
(AOM_unlock(primaryTag));
|
|
|
|
|
(AOM_save(secondTag));
|
|
|
|
|
(AOM_unlock(secondTag));
|
|
|
|
|
ITKCALL(AOM_refresh(primaryTag, 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) {
|
|
|
|
|
tag_t *tableRow;
|
|
|
|
|
ITKCALL(ITEM_create_item(NULL, objName.c_str(), "ZT2_QCHECK", NULL, &item, &rev));
|
|
|
|
|
(AOM_save(item));
|
|
|
|
|
(AOM_save(rev));
|
|
|
|
|
(AOM_lock(item));
|
|
|
|
|
(AOM_lock(rev));
|
|
|
|
|
ITKCALL(AOM_insert_table_rows(rev, "zt2_QCHECKS", 0, beans.size(), &tableRow));
|
|
|
|
|
(AOM_save(rev));
|
|
|
|
|
(AOM_unlock(rev));
|
|
|
|
|
(AOM_unlock(rev));//20241211
|
|
|
|
|
(AOM_save(item));
|
|
|
|
|
(AOM_unlock(item));
|
|
|
|
|
(AOM_unlock(item));//20241211
|
|
|
|
|
for (int i = 0; i < beans.size(); i++) {
|
|
|
|
|
tag_t table = tableRow[i];
|
|
|
|
|
(AOM_lock(table));
|
|
|
|
@ -360,6 +362,7 @@ void setZljyx(string gxbm2, string th, string lastId, string name, tag_t towGx)
|
|
|
|
|
(AOM_unlock(table));
|
|
|
|
|
}
|
|
|
|
|
(AOM_save(towGx));
|
|
|
|
|
(AOM_unlock(towGx));
|
|
|
|
|
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];
|
|
|
|
|
printf("beansVec===>%zd\n", beansVec.size());
|
|
|
|
|
if (beansVec.size() > 0) {
|
|
|
|
|
tag_t axqPmatnr;
|
|
|
|
|
tag_t axqPmatnr = NULLTAG;
|
|
|
|
|
ITKCALL(AOM_ask_value_tag(towGxLine, "bl_line_object", &axqPmatnr));
|
|
|
|
|
ITKCALL(ITEM_rev_list_bom_view_revs(axqPmatnr, &bvr_count, &bvr_list));
|
|
|
|
|
printf("bvr_count=%d\n", bvr_count);
|
|
|
|
|
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(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView));
|
|
|
|
|
(AOM_save(newView));
|
|
|
|
|
(AOM_unlock(newView));//20241211
|
|
|
|
|
ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, axqPmatnr, &newViewBvr));
|
|
|
|
|
(AOM_save(newViewBvr));
|
|
|
|
|
(AOM_unlock(newViewBvr));//20241211
|
|
|
|
|
(AOM_save(axqPmatnr));
|
|
|
|
|
(AOM_unlock(axqPmatnr));//20241211
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//投辅料
|
|
|
|
|
for (int n = 0; n < beansVec.size(); n++) {
|
|
|
|
|
tag_t cLine;
|
|
|
|
|
tag_t cLine = NULLTAG;
|
|
|
|
|
FlBean cBean = beansVec[n];
|
|
|
|
|
if (cBean.flTag == NULLTAG) {
|
|
|
|
|
continue;
|
|
|
|
@ -795,7 +801,7 @@ boolean isXn(tag_t matnr) {
|
|
|
|
|
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
|
|
|
|
|
tag_t top_classificationObject = NULLTAG, item = NULLTAG;
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
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) {
|
|
|
|
|
//errMessage.append("分类属性低压线圈绕线方式为空,请检查。\n");
|
|
|
|
|
//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]);
|
|
|
|
|
}
|
|
|
|
|
//break;
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
//五柱铁心
|
|
|
|
|
cout << attr_names[ii] << "\t"
|
|
|
|
|
<< 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 ¬TcmBuff, string back) {
|
|
|
|
|
|
|
|
|
|
int c_line_count;
|
|
|
|
|
tag_t mantr, *c_line_tags;
|
|
|
|
|
int c_line_count = 0;
|
|
|
|
|
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(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags));
|
|
|
|
|
char *objName;
|
|
|
|
|
AOM_ask_value_string(mantr, "object_name", &objName);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(mantr, "object_name", &objName));
|
|
|
|
|
if (c_line_count > 0 && (isXn(mantr) || strstr(objName, "变压器") != NULL)) {
|
|
|
|
|
printf("实体\n");
|
|
|
|
|
flag = true;
|
|
|
|
|
//检查是否有工艺路线
|
|
|
|
|
int n_references = 0;
|
|
|
|
|
int* levels = 0;
|
|
|
|
|
int n_references = 0, * levels = 0;
|
|
|
|
|
tag_t* references_tag = NULLTAG;
|
|
|
|
|
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);
|
|
|
|
|
map<string, string> cmap1, cmap2;
|
|
|
|
|
if (!hasProcess) {
|
|
|
|
|
char* bl_desc = NULL, *itemID = NULL;
|
|
|
|
|
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");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (strstr(objName, "变压器") != NULL) {
|
|
|
|
|
else if (tc_strstr(objName, "变压器") != NULL) {
|
|
|
|
|
tag_t* byqRev = NULLTAG;
|
|
|
|
|
string tmpGyId;
|
|
|
|
|
char* uid = NULL;
|
|
|
|
@ -1066,12 +1077,12 @@ void readProcessBom(tag_t bom_line, string& errorBuff, boolean &flag, tag_t &top
|
|
|
|
|
ByqBean bean;
|
|
|
|
|
ITK__convert_tag_to_uid(byqRev[0], &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;
|
|
|
|
|
ITKCALL(AOM_ask_value_string(byqRev[0], "item_id", &thId));
|
|
|
|
|
printf("cpxh===>%s\n", cpxh.c_str());
|
|
|
|
|
tag_t processTag = NULLTAG;
|
|
|
|
|
if (strstr(objName, "线圈") == NULL) {
|
|
|
|
|
if (tc_strstr(objName, "线圈") == NULL) {
|
|
|
|
|
vector<string> idVec;
|
|
|
|
|
Split2(thId, "-", idVec);
|
|
|
|
|
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;
|
|
|
|
|
tag_t byqTag = NULLTAG, byqRev = NULLTAG, processTag = NULLTAG;
|
|
|
|
|
byqId.append(wordNo);
|
|
|
|
|
printf("byqId===>%s\n", byqId.c_str());
|
|
|
|
|
ITKCALL(ITEM_find_item(byqId.c_str(), &byqTag));
|
|
|
|
|
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;
|
|
|
|
|
string cpxh = getClassVal(byqRev, errorBuff, bean);
|
|
|
|
|
string cpxh = getClassVal(byqRev, errorBuff, bean, cmap2);
|
|
|
|
|
printf("cpxh===>%s\n", cpxh.c_str());
|
|
|
|
|
if (strstr(objName, "线圈") == NULL) {
|
|
|
|
|
if (tc_strstr(objName, "线圈") == NULL) {
|
|
|
|
|
processTag = getTmpProcess(cpxh, drawNo, errorBuff, tmpGyId, false, "", wordNo);
|
|
|
|
|
if (processTag != NULLTAG) {
|
|
|
|
|
save_representation2(processTag, mantr, "IMAN_METarget");
|
|
|
|
@ -1112,7 +1132,21 @@ void readProcessBom(tag_t bom_line, string& errorBuff, boolean &flag, tag_t &top
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
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线圈未在变压器参数表中维护绕线方式分类属性,请前往维护
|
|
|
|
|
if (bean.dyxq.empty()) {
|
|
|
|
|
errorBuff.append("当前低压线圈未在变压器参数表中维护绕线方式分类属性,请前往维护\n");
|
|
|
|
@ -1120,7 +1154,7 @@ void readProcessBom(tag_t bom_line, string& errorBuff, boolean &flag, tag_t &top
|
|
|
|
|
}
|
|
|
|
|
xqfs = bean.dyxq;
|
|
|
|
|
}
|
|
|
|
|
else if (strstr(objName, "中压线圈") != NULL) {
|
|
|
|
|
else if (tc_strstr(objName, "中压线圈") != NULL) {
|
|
|
|
|
//当前XXX线圈未在变压器参数表中维护绕线方式分类属性,请前往维护
|
|
|
|
|
if (bean.zyxq.empty()) {
|
|
|
|
|
errorBuff.append("当前中压线圈未在变压器参数表中维护绕线方式分类属性,请前往维护\n");
|
|
|
|
@ -1128,7 +1162,7 @@ void readProcessBom(tag_t bom_line, string& errorBuff, boolean &flag, tag_t &top
|
|
|
|
|
}
|
|
|
|
|
xqfs = bean.zyxq;
|
|
|
|
|
}
|
|
|
|
|
else if (strstr(objName, "高压线圈") != NULL) {
|
|
|
|
|
else if (tc_strstr(objName, "高压线圈") != NULL) {
|
|
|
|
|
//当前XXX线圈未在变压器参数表中维护绕线方式分类属性,请前往维护
|
|
|
|
|
if (bean.gyxq.empty()) {
|
|
|
|
|
errorBuff.append("当前高压线圈未在变压器参数表中维护绕线方式分类属性,请前往维护\n");
|
|
|
|
@ -1136,7 +1170,7 @@ void readProcessBom(tag_t bom_line, string& errorBuff, boolean &flag, tag_t &top
|
|
|
|
|
}
|
|
|
|
|
xqfs = bean.gyxq;
|
|
|
|
|
}
|
|
|
|
|
else if (strstr(objName, "调压线圈") != NULL) {
|
|
|
|
|
else if (tc_strstr(objName, "调压线圈") != NULL) {
|
|
|
|
|
//当前XXX线圈未在变压器参数表中维护绕线方式分类属性,请前往维护
|
|
|
|
|
if (bean.tyxq.empty()) {
|
|
|
|
|
errorBuff.append("当前调压线圈未在变压器参数表中维护绕线方式分类属性,请前往维护\n");
|
|
|
|
@ -1144,14 +1178,14 @@ void readProcessBom(tag_t bom_line, string& errorBuff, boolean &flag, tag_t &top
|
|
|
|
|
}
|
|
|
|
|
xqfs = bean.tyxq;
|
|
|
|
|
}
|
|
|
|
|
else if (strstr(objName, "稳压线圈") != NULL) {
|
|
|
|
|
else if (tc_strstr(objName, "稳压线圈") != NULL) {
|
|
|
|
|
//当前XXX线圈未在变压器参数表中维护绕线方式分类属性,请前往维护
|
|
|
|
|
if (bean.wyxq.empty()) {
|
|
|
|
|
errorBuff.append("当前稳压线圈未在变压器参数表中维护绕线方式分类属性,请前往维护\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
xqfs = bean.wyxq;
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
processTag = getTmpProcess(cpxh, drawNo, errorBuff, tmpGyId, true, xqfs, wordNo);
|
|
|
|
|
if (processTag != NULLTAG) {
|
|
|
|
|
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++) {
|
|
|
|
|
tag_t c_line_tag = c_line_tags[i];
|
|
|
|
|
readProcessBom(c_line_tag, errorBuff, flag, topProcess, notTcmBuff, "");
|
|
|
|
@ -1191,30 +1225,37 @@ tag_t getProcess(tag_t designRev) {
|
|
|
|
|
}
|
|
|
|
|
return process;
|
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
void CloneProcess(tag_t designRev, vector<vector<string>> back_prefs, string& errorBuff, string& notTcmBuff) {
|
|
|
|
|
int bvr_count = 0, c_line_count;
|
|
|
|
|
tag_t ebom_window = NULLTAG;
|
|
|
|
|
tag_t bom_line = NULLTAG;
|
|
|
|
|
tag_t item_tag = NULLTAG, *c_line_tags = NULLTAG;
|
|
|
|
|
ITKCALL(BOM_create_window(&ebom_window));
|
|
|
|
|
tag_t ebom_window = NULLTAG, bom_line = NULLTAG, item_tag = NULLTAG, *c_line_tags = NULLTAG;
|
|
|
|
|
tag_t* bvr_list = NULL;
|
|
|
|
|
ITKCALL(BOM_create_window(&ebom_window));
|
|
|
|
|
ITKCALL(ITEM_rev_list_bom_view_revs(designRev, &bvr_count, &bvr_list));
|
|
|
|
|
printf("bvr_count=%d", bvr_count);
|
|
|
|
|
|
|
|
|
|
ITKCALL(BOM_set_window_top_line_bvr(ebom_window, bvr_list[0], &bom_line)); //顶层bom获取
|
|
|
|
|
string errorBuff;
|
|
|
|
|
string notTcmBuff;
|
|
|
|
|
char *bl_desc;
|
|
|
|
|
//string errorBuff, notTcmBuff;
|
|
|
|
|
char *bl_desc = NULL;
|
|
|
|
|
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* levels = 0;
|
|
|
|
|
tag_t* references_tag = NULLTAG;
|
|
|
|
@ -1228,61 +1269,12 @@ int CloneTempProcess(void *returnValue)
|
|
|
|
|
char* refType;
|
|
|
|
|
tag_t refTag = references_tag[i];
|
|
|
|
|
ITKCALL(AOM_ask_value_string(refTag, "object_type", &refType));
|
|
|
|
|
if (strcmp(refType, "MEProcessRevision") == 0) {
|
|
|
|
|
if (tc_strcmp(refType, "MEProcessRevision") == 0) {
|
|
|
|
|
hasProcess = true;
|
|
|
|
|
processTagTop = refTag;
|
|
|
|
|
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) {
|
|
|
|
|
isback = false;
|
|
|
|
|
int b_refs = 0;
|
|
|
|
@ -1311,7 +1303,8 @@ int CloneTempProcess(void *returnValue)
|
|
|
|
|
if (n_drows == 0)
|
|
|
|
|
continue;
|
|
|
|
|
ByqBean bean;
|
|
|
|
|
cpxh = getClassVal(drows[0], errorBuff, bean);
|
|
|
|
|
map<string, string> cmap;
|
|
|
|
|
cpxh = getClassVal(drows[0], errorBuff, bean, cmap);
|
|
|
|
|
isback = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -1349,7 +1342,7 @@ int CloneTempProcess(void *returnValue)
|
|
|
|
|
tag_t pMatr = pMaterials[x];
|
|
|
|
|
ITKCALL(AOM_ask_value_string(pMatr, "item_id", &pId));
|
|
|
|
|
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);
|
|
|
|
|
if (process != NULLTAG) {
|
|
|
|
|
meProcess = process;
|
|
|
|
@ -1386,8 +1379,40 @@ int CloneTempProcess(void *returnValue)
|
|
|
|
|
//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());
|
|
|
|
|
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";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
@ -1424,6 +1449,109 @@ int CloneTempProcess(void *returnValue)
|
|
|
|
|
}
|
|
|
|
|
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";
|
|
|
|
|
}
|
|
|
|
|
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));
|
|
|
|
|
tc_strcpy(*((char**)returnValue), errorBuff.c_str());
|
|
|
|
|
return ifail;
|
|
|
|
|