1、计划任务自动完成功能开发

2、武汉自动投料增加逻辑:判断物料视图是否为外购,如果是外购,则投料停止,不再展开
3、备件包工艺路线指派和投料功能开发
master
李冬阳 1 year ago
parent 85ab7d65b7
commit d3618b61ce

@ -155,10 +155,11 @@ void getBomMessage(vector<StBomBean>& stBomlines, tag_t cBomLine, StBomBean &pBe
//ITKCALL(AOM_ask_value_tag(pBomLine, "bl_line_object", &mantr));
//ITKCALL(AOM_ask_value_string(mantr, "object_name", &parentName));
ITKCALL(BOM_line_ask_all_child_lines(cBomLine, &c_line_count, &c_line_tags));
tag_t cmantr;
char* cName;
tag_t cmantr = NULLTAG;
char* cName = NULL, * zt2_SZProcuretype = NULL;
ITKCALL(AOM_ask_value_tag(cBomLine, "bl_line_object", &cmantr));
ITKCALL(AOM_ask_value_string(cmantr, "object_name", &cName));
ITKCALL(AOM_ask_value_string(cmantr, "zt2_SZProcuretype", &zt2_SZProcuretype)); //外购不再展开投料
printf("虚拟件===>%s\n", cName);
StBomBean bean;
bean.bomline = cBomLine;
@ -174,7 +175,7 @@ void getBomMessage(vector<StBomBean>& stBomlines, tag_t cBomLine, StBomBean &pBe
// stBomlines.push_back(bean);
pBean.childs.push_back(bean);
}
else {
else if (tc_strcmp(zt2_SZProcuretype, "外购") != 0) {
for (int i = 0; i < c_line_count; i++) {
tag_t c_line_tag = c_line_tags[i];
getBomMessage(stBomlines, c_line_tag, bean);
@ -191,10 +192,11 @@ void getBomMessage(vector<StBomBean> &stBomlines, tag_t cBomLine) {
//ITKCALL(AOM_ask_value_tag(pBomLine, "bl_line_object", &mantr));
//ITKCALL(AOM_ask_value_string(mantr, "object_name", &parentName));
ITKCALL(BOM_line_ask_all_child_lines(cBomLine, &c_line_count, &c_line_tags));
tag_t cmantr;
char* cName;
tag_t cmantr = NULLTAG;
char* cName = NULL, * zt2_SZProcuretype = NULL;
ITKCALL(AOM_ask_value_tag(cBomLine, "bl_line_object", &cmantr));
ITKCALL(AOM_ask_value_string(cmantr, "object_name", &cName));
ITKCALL(AOM_ask_value_string(cmantr, "zt2_SZProcuretype", &zt2_SZProcuretype)); //外购不再展开投料
StBomBean bean;
bean.bomline = cBomLine;
bean.currentName = cName;
@ -207,7 +209,7 @@ void getBomMessage(vector<StBomBean> &stBomlines, tag_t cBomLine) {
stBomlines.push_back(bean);
//printf("st = true===>%s\n", cName);
}
else {
else if (tc_strcmp(zt2_SZProcuretype, "外购") != 0) {
//虚拟件向下展开 //实体件直接投料
printf("虚拟件============>%s\n", cName);
for (int i = 0; i < c_line_count; i++) {
@ -215,7 +217,7 @@ void getBomMessage(vector<StBomBean> &stBomlines, tag_t cBomLine) {
getBomMessage(stBomlines, c_line_tag, bean);
}
stBomlines.push_back(bean);
printf("ÐéÄâ¼þ===========>%d\n", bean.childs.size());
printf("虚拟件===========>%zd\n", bean.childs.size());
}
}
//虚拟向下展开,实体投料
@ -228,7 +230,7 @@ void autoFeedLike(tag_t towGxLine, StBomBean& pBean, vector<StBomBean>& stBomlin
qty = "1";
}
double x = atof(qty);
printf("pBean.childs==>%d %s \n", pBean.childs.size(), qty);
printf("pBean.childs==>%zd %s \n", pBean.childs.size(), qty);
for (int i = 0; i < pBean.childs.size(); i++) {
StBomBean& child = pBean.childs[i];
autoFeedLike(towGxLine, child, stBomlines, xnQty*x);
@ -256,7 +258,7 @@ void autoFeedLike(tag_t towGxLine, StBomBean& pBean, vector<StBomBean>& stBomlin
}
ITKCALL(BOM_line_copy(towGxLine, pBean.bomline, NULLTAG, &newChild));
printf("bl_quantity==>%s\n", bl_quantity.c_str());
AOM_lock(newChild); // bl_occ_type
ITKCALL(AOM_lock(newChild)); // bl_occ_type
//设置事例类型
ITKCALL(AOM_set_value_string(newChild, "bl_sequence_no", bl_seq.c_str()));
ITKCALL(AOM_set_value_string(newChild, "bl_quantity", bl_quantity.c_str()));
@ -269,7 +271,7 @@ void autoFeedLike(tag_t towGxLine, StBomBean& pBean, vector<StBomBean>& stBomlin
void autoFeedLike(tag_t towGxLine, StBomBean& pBean, string name2, vector<StBomBean>& stBomlines) {
//子项名称模糊匹配
printf(" pBean.childs.size()%d\n", pBean.childs.size());
printf(" pBean.childs.size()%zd\n", pBean.childs.size());
for (int i = 0; i < pBean.childs.size(); i++) {
StBomBean& child = pBean.childs[i];
printf("child.currentName%s %s \n", child.currentName.c_str(), name2.c_str());
@ -341,12 +343,11 @@ void startFeed(tag_t meprocess, vector<StBomBean>& stBomlines, FeedRule bean, st
AOM_ask_value_string(ejGx, "object_name", &ejName);
printf("ejName%s %s\n", ejName, bean.ejgx.c_str());
if (bean.ejgx.compare(ejName) == 0) {
printf("stBomlines %d\n", stBomlines.size());
printf("stBomlines %zd\n", stBomlines.size());
cutGxLine(towGxLine);
for (int t = 0; t < stBomlines.size(); t++) {
StBomBean& stBom = stBomlines[t];
tag_t newChild;
printf("stBom.currentName==>%s %d\n", stBom.currentName.c_str(), stBom.childs.size());
printf("stBom.currentName==>%s %zd\n", stBom.currentName.c_str(), stBom.childs.size());
if (stBom.currentName.compare(name1) == 0) {
//if (!stBom.istl && stBom.st && stBom.flag) {
autoFeedLike(towGxLine, stBom, name2, stBomlines);
@ -519,7 +520,7 @@ void AutoFeedBom(tag_t mantr,tag_t meprocess,
if (drawMap.count(drawNo) > 0) {
//图号匹配
vector<FeedRule> beans = drawMap[drawNo];
printf("beans===>%d\n", beans.size());
printf("beans===>%zd\n", beans.size());
for (int t = 0; t < beans.size(); t++) {
FeedRule bean = beans[t];
if (bean.tlth.empty()) {
@ -574,7 +575,7 @@ void AutoFeedBom(tag_t mantr,tag_t meprocess,
AOM_ask_value_string(mantr, "object_name", &nowName);
if (strstr(nowName, s.c_str()) != NULL) {
vector<FeedRule> beans = nameMap[s];
printf("beans===>%d\n", beans.size());
printf("beans===>%zd\n", beans.size());
for (int t = 0; t < beans.size(); t++) {
FeedRule bean = beans[t];
printf("beans===>%s %s\n", bean.yjgx.c_str(), bean.ejgx.c_str());
@ -626,17 +627,17 @@ void AutoFeedBom(tag_t mantr,tag_t meprocess,
ITKCALL(BOM_close_window(ebom_window));
}
void readPbomMsg(tag_t bom_line,string &errBuffer,
map<string, vector<FeedRule>> drawMap, map<string, vector<FeedRule>> nameMap,char *loginId) {
void readPbomMsg(tag_t bom_line, string &errBuffer, map<string, vector<FeedRule>> drawMap,
map<string, vector<FeedRule>> nameMap, char *loginId, boolean isback) {
int c_line_count;
tag_t * c_line_tags;
ITKCALL(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags));
tag_t rev;
char *id,*objName;
ITKCALL(AOM_ask_value_tag(bom_line, "bl_line_object", &rev));
AOM_ask_value_string(rev, "item_id", &id);
AOM_ask_value_string(rev, "object_name", &objName);
if (c_line_count > 0 && (isSt(rev)|| strstr(objName, "±äѹÆ÷") != NULL)) {
ITKCALL(AOM_ask_value_string(rev, "item_id", &id));
ITKCALL(AOM_ask_value_string(rev, "object_name", &objName));
if (c_line_count > 0 && (isSt(rev) || strstr(objName, "变压器") != NULL || isback)) {
int n_references = 0;
int* levels = 0;
@ -647,13 +648,13 @@ void readPbomMsg(tag_t bom_line,string &errBuffer,
//boolean hasProcess = false;
int meNum = 0;
tag_t meprocess;
AOM_ask_value_tag(rev, "owning_user", &user);
AOM_ask_value_string(user, "user_id", &duser);
ITKCALL(AOM_ask_value_tag(rev, "owning_user", &user));
ITKCALL(AOM_ask_value_string(user, "user_id", &duser));
for (int i = 0; i < n_references; i++)
{
char* refType;
tag_t refTag = references_tag[i];
AOM_ask_value_string(refTag, "object_type", &refType);
ITKCALL(AOM_ask_value_string(refTag, "object_type", &refType));
if (strcmp(refType, "MEProcessRevision") == 0) {
//hasProcess = true;
//break;
@ -677,7 +678,7 @@ void readPbomMsg(tag_t bom_line,string &errBuffer,
//}
}
for (int i = 0; i < c_line_count; i++) {
readPbomMsg(c_line_tags[i], errBuffer, drawMap, nameMap, loginId);
readPbomMsg(c_line_tags[i], errBuffer, drawMap, nameMap, loginId, false);
}
}
@ -762,6 +763,32 @@ int AutoFeeding(void *returnValue) {
}
}
}
//20240203备件包工艺路线指派
boolean isback = false;
int back_num = 0;
char** back_vals = NULL, * group_name = NULL, * objName = NULL;
ITKCALL(AOM_ask_value_string(mantr, "object_name", &objName));
tag_t group = NULLTAG;
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 && isback; 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) {
isback = true;
break;
}
}
}
}
//遍历BOM获取所有要投料的
tag_t* bvr_list = NULL, ebom_window, bom_line;
@ -770,7 +797,7 @@ int AutoFeeding(void *returnValue) {
ITKCALL(BOM_create_window(&ebom_window));
ITKCALL(BOM_set_window_top_line(ebom_window, NULL, mantr, NULLTAG, &bom_line));
readPbomMsg(bom_line, errBuffer, drawMap, nameMap, loginId);
readPbomMsg(bom_line, errBuffer, drawMap, nameMap, loginId, isback);
ITKCALL(BOM_close_window(ebom_window));

@ -357,12 +357,12 @@ void getGxbmMap(tag_t processTag, map<string, tag_t>& gxDocMap, map<string, Time
tag_t ebom_window = NULLTAG;
tag_t bom_line = NULLTAG;
tag_t item_tag = NULLTAG, *c_line_tags;
(BOM_create_window(&ebom_window));
ITKCALL(BOM_create_window(&ebom_window));
tag_t* bvr_list = NULL;
(ITEM_rev_list_bom_view_revs(processTag, &bvr_count, &bvr_list));
ITKCALL(ITEM_rev_list_bom_view_revs(processTag, &bvr_count, &bvr_list));
printf("bvr_count=%d", bvr_count);
(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获取
//bom_line工艺
int c_line_count;
ITKCALL(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags)); // 一级工序
@ -371,55 +371,55 @@ void getGxbmMap(tag_t processTag, map<string, tag_t>& gxDocMap, map<string, Time
for (int i = 0; i < c_line_count; i++) {
tag_t oneGx = c_line_tags[i], *towGxLines;
char* gxbm1;
AOM_ask_value_string(oneGx, "bl_ZT2_FirstOPRevision_zt2_ClassificationCode", &gxbm1);
ITKCALL(AOM_ask_value_string(oneGx, "bl_ZT2_FirstOPRevision_zt2_ClassificationCode", &gxbm1));
if (timebeans.count(gxbm1) > 0) {
AOM_lock(oneGx);
ITKCALL(AOM_lock(oneGx));
TimeBean tbean = timebeans[gxbm1];
ITKCALL(AOM_set_value_string(oneGx, "bl_ZT2_FirstOPRevision_zt2_ArtificialTime", tbean.rgsj.c_str()));
ITKCALL(AOM_set_value_string(oneGx, "bl_ZT2_FirstOPRevision_zt2_MachineTime", tbean.jqsj.c_str()));
ITKCALL(AOM_set_value_string(oneGx, "bl_ZT2_FirstOPRevision_zt2_ReadinessTime", tbean.zbsj.c_str()));
ITKCALL(AOM_set_value_string(oneGx, "bl_ZT2_FirstOPRevision_zt2_ProCycle", tbean.zrsczq.c_str()));
AOM_save(oneGx);
AOM_unlock(oneGx);
ITKCALL(AOM_save(oneGx));
ITKCALL(AOM_unlock(oneGx));
}
int c_cnt = 0;
BOM_line_ask_all_child_lines(oneGx, &c_cnt, &towGxLines);
ITKCALL(BOM_line_ask_all_child_lines(oneGx, &c_cnt, &towGxLines));
for (int j = 0; j < c_cnt; j++) {
tag_t towGxLine = towGxLines[j];
tag_t towGx;
char* gxbm2;
ITKCALL(AOM_ask_value_string(towGxLine, "bl_ZT2_FirstOPRevision_zt2_ClassificationCode", &gxbm2));
if (timebeans.count(gxbm2) > 0) {
AOM_lock(towGxLine);
ITKCALL(AOM_lock(towGxLine));
TimeBean tbean = timebeans[gxbm2];
ITKCALL(AOM_set_value_string(towGxLine, "bl_ZT2_FirstOPRevision_zt2_ArtificialTime", tbean.rgsj.c_str()));
ITKCALL(AOM_set_value_string(towGxLine, "bl_ZT2_FirstOPRevision_zt2_MachineTime", tbean.jqsj.c_str()));
ITKCALL(AOM_set_value_string(towGxLine, "bl_ZT2_FirstOPRevision_zt2_ReadinessTime", tbean.zbsj.c_str()));
ITKCALL(AOM_set_value_string(towGxLine, "bl_ZT2_FirstOPRevision_zt2_ProCycle", tbean.zrsczq.c_str()));
AOM_save(towGxLine);
AOM_unlock(towGxLine);
ITKCALL(AOM_save(towGxLine));
ITKCALL(AOM_unlock(towGxLine));
}
char *name;
char* name = NULL;
ITKCALL(AOM_ask_value_tag(towGxLine, "bl_line_object", &towGx));
AOM_ask_value_string(towGx, "object_name", &name);
ITKCALL(AOM_ask_value_string(towGx, "object_name", &name));
//设置质检项
//setZljyx(gxbm2,th, lastId, name, towGx);
if (flBeanMap.count(gxbm2) > 0) {
vector<FlBean> beansVec = flBeanMap[gxbm2];
printf("beansVec===>%d\n", beansVec.size());
printf("beansVec===>%zd\n", beansVec.size());
if (beansVec.size() > 0) {
tag_t axqPmatnr;
AOM_ask_value_tag(towGxLine, "bl_line_object", &axqPmatnr);
(ITEM_rev_list_bom_view_revs(axqPmatnr, &bvr_count, &bvr_list));
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;
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));
AOM_save(newView);
ITKCALL(AOM_save(newView));
ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, axqPmatnr, &newViewBvr));
AOM_save(newViewBvr);
AOM_save(axqPmatnr);
ITKCALL(AOM_save(newViewBvr));
ITKCALL(AOM_save(axqPmatnr));
}
}
//投辅料
@ -430,16 +430,16 @@ void getGxbmMap(tag_t processTag, map<string, tag_t>& gxDocMap, map<string, Time
continue;
}
ITKCALL(BOM_line_add(towGxLine, NULL, cBean.flTag, NULL, &cLine));
AOM_lock(cLine);
ITKCALL(AOM_lock(cLine));
string num = cBean.blQty;
AOM_set_value_string(cLine, "bl_quantity", num.c_str());
ITKCALL(AOM_set_value_string(cLine, "bl_quantity", num.c_str()));
string seqNo = to_string((n + 1) * 10);
AOM_set_value_string(cLine, "bl_sequence_no", seqNo.c_str());
AOM_set_value_string(cLine, "bl_occ_type", "ZT2_FuLiao");
AOM_save(cLine);
ITKCALL(AOM_set_value_string(cLine, "bl_sequence_no", seqNo.c_str()));
ITKCALL(AOM_set_value_string(cLine, "bl_occ_type", "ZT2_FuLiao"));
ITKCALL(AOM_save(cLine));
//最后unlock
AOM_unlock(cLine);
AOM_refresh(cLine, FALSE);
ITKCALL(AOM_unlock(cLine));
ITKCALL(AOM_refresh(cLine, FALSE));
}
}
@ -447,20 +447,18 @@ void getGxbmMap(tag_t processTag, map<string, tag_t>& gxDocMap, map<string, Time
gxDocMap[gxbm2] = towGx;
}
}
BOM_save_window(ebom_window);
BOM_close_window(ebom_window);
ITKCALL(BOM_save_window(ebom_window));
ITKCALL(BOM_close_window(ebom_window));
}
void getGxbmMap(tag_t processTag, map<string, tag_t>& gxDocMap, map<string, TimeBean > timebeans) {
int bvr_count = 0;
tag_t ebom_window = NULLTAG;
tag_t bom_line = NULLTAG;
tag_t item_tag = NULLTAG, *c_line_tags;
(BOM_create_window(&ebom_window));
tag_t ebom_window = NULLTAG, bom_line = NULLTAG, item_tag = NULLTAG, *c_line_tags = NULLTAG;
ITKCALL(BOM_create_window(&ebom_window));
tag_t* bvr_list = NULL;
(ITEM_rev_list_bom_view_revs(processTag, &bvr_count, &bvr_list));
ITKCALL(ITEM_rev_list_bom_view_revs(processTag, &bvr_count, &bvr_list));
printf("bvr_count=%d", bvr_count);
(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获取
//bom_line工艺
int c_line_count;
ITKCALL(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags)); // 一级工序
@ -468,39 +466,39 @@ void getGxbmMap(tag_t processTag, map<string, tag_t>& gxDocMap, map<string, Time
for (int i = 0; i < c_line_count; i++) {
tag_t oneGx = c_line_tags[i], *towGxLines;
char* gxbm1;
AOM_ask_value_string(oneGx, "bl_ZT2_FirstOPRevision_zt2_ClassificationCode", &gxbm1);
ITKCALL(AOM_ask_value_string(oneGx, "bl_ZT2_FirstOPRevision_zt2_ClassificationCode", &gxbm1));
if (timebeans.count(gxbm1) > 0) {
AOM_lock(oneGx);
ITKCALL(AOM_lock(oneGx));
TimeBean tbean = timebeans[gxbm1];
ITKCALL(AOM_set_value_string(oneGx, "bl_ZT2_FirstOPRevision_zt2_ArtificialTime", tbean.rgsj.c_str()));
ITKCALL(AOM_set_value_string(oneGx, "bl_ZT2_FirstOPRevision_zt2_MachineTime", tbean.jqsj.c_str()));
ITKCALL(AOM_set_value_string(oneGx, "bl_ZT2_FirstOPRevision_zt2_ReadinessTime", tbean.zbsj.c_str()));
ITKCALL(AOM_set_value_string(oneGx, "bl_ZT2_FirstOPRevision_zt2_ProCycle", tbean.zrsczq.c_str()));
AOM_save(oneGx);
AOM_unlock(oneGx);
ITKCALL(AOM_save(oneGx));
ITKCALL(AOM_unlock(oneGx));
}
int c_cnt = 0;
BOM_line_ask_all_child_lines(oneGx, &c_cnt, &towGxLines);
ITKCALL(BOM_line_ask_all_child_lines(oneGx, &c_cnt, &towGxLines));
for (int j = 0; j < c_cnt; j++) {
tag_t towGxLine = towGxLines[j];
tag_t towGx;
char* gxbm2;
ITKCALL(AOM_ask_value_string(towGxLine, "bl_ZT2_FirstOPRevision_zt2_ClassificationCode", &gxbm2));
if (timebeans.count(gxbm2) > 0) {
AOM_lock(towGxLine);
ITKCALL(AOM_lock(towGxLine));
TimeBean tbean = timebeans[gxbm2];
ITKCALL(AOM_set_value_string(towGxLine, "bl_ZT2_FirstOPRevision_zt2_ArtificialTime", tbean.rgsj.c_str()));
ITKCALL(AOM_set_value_string(towGxLine, "bl_ZT2_FirstOPRevision_zt2_MachineTime", tbean.jqsj.c_str()));
ITKCALL(AOM_set_value_string(towGxLine, "bl_ZT2_FirstOPRevision_zt2_ReadinessTime", tbean.zbsj.c_str()));
ITKCALL(AOM_set_value_string(towGxLine, "bl_ZT2_FirstOPRevision_zt2_ProCycle", tbean.zrsczq.c_str()));
AOM_save(towGxLine);
AOM_unlock(towGxLine);
ITKCALL(AOM_save(towGxLine));
ITKCALL(AOM_unlock(towGxLine));
}
ITKCALL(AOM_ask_value_tag(towGxLine, "bl_line_object", &towGx));
gxDocMap[gxbm2] = towGx;
}
}
BOM_close_window(ebom_window);
ITKCALL(BOM_close_window(ebom_window));
}
//查询ID
@ -559,9 +557,9 @@ tag_t clone_process_from_template(char* process_item_id, boolean isXq, string pr
tag_t revision_tag = NULLTAG;
ITKCALL(ITEM_ask_latest_rev(item_tag, &revision_tag));
char* nameOld, *item_revision_id;
AOM_ask_value_string(revision_tag, "item_revision_id", &item_revision_id);
AOM_ask_value_string(revision_tag, "object_name", &nameOld);
MEBOM_init_module();
ITKCALL(AOM_ask_value_string(revision_tag, "item_revision_id", &item_revision_id));
ITKCALL(AOM_ask_value_string(revision_tag, "object_name", &nameOld));
ITKCALL(MEBOM_init_module());
tag_t window_tag = NULLTAG;
ITKCALL(ME_create_bop_window(&window_tag));
@ -783,9 +781,9 @@ boolean isXn(tag_t matnr) {
//获取分类属性 判断是否整除
string getClassVal(tag_t top_rev_tag, string& errMessage, ByqBean &bean) {
//, string className
tag_t top_classificationObject, item;
tag_t top_classificationObject = NULLTAG, item = NULLTAG;
ITKCALL(ITEM_ask_item_of_rev(top_rev_tag, &item));
ICS_ask_classification_object(item, &top_classificationObject);
ITKCALL(ICS_ask_classification_object(item, &top_classificationObject));
if (top_classificationObject == NULL_TAG)
{
errMessage.append("顶层对象没有发送到分类\n");
@ -796,8 +794,7 @@ string getClassVal(tag_t top_rev_tag, string& errMessage, ByqBean &bean) {
//ICS_ask_id_name(top_class_tag, &top_class_id, &top_class_name);
printf("BOM TOP LINE CLASS ID = %s | NAME = %s \n", top_class_id, top_class_name);
int n_attrs;
char** attr_names;
char** attr_vals;
char** attr_names = NULL, ** attr_vals = NULL;
ITKCALL(ICS_ask_attributes_of_classification_obj(top_classificationObject, &n_attrs, &attr_names, &attr_vals));
cout << n_attrs << endl;
// int num = 1;
@ -998,7 +995,7 @@ boolean isTcmOnNot(tag_t process) {
}
return flag;
}
void readProcessBom(tag_t bom_line, string& errorBuff,boolean &flag,tag_t &topProcess,string &notTcmBuff) {
void readProcessBom(tag_t bom_line, string& errorBuff, boolean &flag, tag_t &topProcess, string &notTcmBuff, string back) {
int c_line_count;
tag_t mantr, *c_line_tags;
@ -1021,28 +1018,41 @@ void readProcessBom(tag_t bom_line, string& errorBuff,boolean &flag,tag_t &topPr
{
char* refType;
tag_t refTag = references_tag[i];
AOM_ask_value_string(refTag, "object_type", &refType);
ITKCALL(AOM_ask_value_string(refTag, "object_type", &refType));
if (strcmp(refType, "MEProcessRevision") == 0) {
hasProcess = true;
break;
}
}
printf("hasProcess==%d\n", hasProcess);
if (!hasProcess) {
char* bl_desc,*itemID;
AOM_ask_value_string(mantr, "item_id", &itemID);
{
if (strstr(objName, "变压器") != NULL) {
tag_t *byqRev;
char* bl_desc = NULL, * itemID = NULL;
ITKCALL(AOM_ask_value_string(mantr, "item_id", &itemID));
printf("back==%zd\n", back.size());
if (back.size() > 0) {
vector<string> backs;
Split2(back, "@", backs);
tag_t processTag = NULLTAG;
string tmpGyId;
processTag = getTmpProcess(backs[0], backs[1], errorBuff, tmpGyId, false, "", "");
topProcess = processTag;
if (processTag != NULLTAG) {
printf("save_representation2\n");
save_representation2(processTag, mantr, "IMAN_METarget");
}
}
else if (strstr(objName, "变压器") != NULL) {
tag_t* byqRev = NULLTAG;
string tmpGyId;
char *uid;
char* uid = NULL;
int cnt3 = 0;
AOM_ask_value_tags(mantr, "TC_Is_Represented_By", &cnt3, &byqRev);
ITKCALL(AOM_ask_value_tags(mantr, "TC_Is_Represented_By", &cnt3, &byqRev));
ByqBean bean;
ITK__convert_tag_to_uid(byqRev[0], &uid);
printf("objName%s %s\n", objName, uid);
string cpxh = getClassVal(byqRev[0], errorBuff, bean);
char* thId;
AOM_ask_value_string(byqRev[0],"item_id",& thId);
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) {
@ -1056,7 +1066,7 @@ void readProcessBom(tag_t bom_line, string& errorBuff,boolean &flag,tag_t &topPr
}
}
else {
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));
vector<string> descVec1;
Split2(bl_desc, " ", descVec1);
if (descVec1.size() > 1) {
@ -1071,14 +1081,13 @@ void readProcessBom(tag_t bom_line, string& errorBuff,boolean &flag,tag_t &topPr
wordNo = drawNoVec1[2];
}
string byqId = "1ZDB300000P-", tmpGyId;
tag_t byqTag, byqRev;
tag_t byqTag = NULLTAG, byqRev = NULLTAG, processTag = NULLTAG;
byqId.append(wordNo);
ITKCALL(ITEM_find_item(byqId.c_str(), &byqTag));
ITKCALL(ITEM_ask_latest_rev(byqTag, &byqRev));
ByqBean bean;
string cpxh = getClassVal(byqRev, errorBuff, bean);
printf("cpxh===>%s\n", cpxh.c_str());
tag_t processTag = NULLTAG;
if (strstr(objName, "线圈") == NULL) {
processTag = getTmpProcess(cpxh, drawNo, errorBuff, tmpGyId, false, "", wordNo);
if (processTag != NULLTAG) {
@ -1137,10 +1146,10 @@ void readProcessBom(tag_t bom_line, string& errorBuff,boolean &flag,tag_t &topPr
}
}
}
}
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);
readProcessBom(c_line_tag, errorBuff, flag, topProcess, notTcmBuff, "");
}
}
@ -1157,7 +1166,7 @@ tag_t getProcess(tag_t designRev) {
{
char* refType;
tag_t refTag = references_tag[i];
AOM_ask_value_string(refTag, "object_type", &refType);
ITKCALL(AOM_ask_value_string(refTag, "object_type", &refType));
if (strcmp(refType, "MEProcessRevision") == 0) {
hasProcess = true;
process = refTag;
@ -1176,17 +1185,17 @@ int CloneTempProcess(void *returnValue)
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;
tag_t item_tag = NULLTAG, *c_line_tags = NULLTAG;
(BOM_create_window(&ebom_window));
tag_t* bvr_list = NULL;
(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);
(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 notTcmBuff;
char *bl_desc;
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));
int n_references = 0;
int* levels = 0;
@ -1200,32 +1209,128 @@ int CloneTempProcess(void *returnValue)
{
char* refType;
tag_t refTag = references_tag[i];
AOM_ask_value_string(refTag, "object_type", &refType);
ITKCALL(AOM_ask_value_string(refTag, "object_type", &refType));
if (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,*topId;
AOM_ask_value_string(designRev, "object_name", &objName);
AOM_ask_value_string(designRev, "item_id", &topId);
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物料
if (strstr(objName, "变压器") != NULL) {
//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;
int* b_levels = 0;
tag_t* b_refs_tag = NULLTAG;
char** b_rel_name = NULL, * pcode = NULL;
string cpxh = "";
//判断当前物料对象是否在“产成品”文件夹ZT2_ProjectFolder
ITKCALL(ITEM_ask_item_of_rev(designRev, &item_tag));
ITKCALL(WSOM_where_referenced2(item_tag, 1, &b_refs, &b_levels, &b_refs_tag, &b_rel_name));
for (int i = 0; i < b_refs; i++) {
char* ref_type = NULL;
ITKCALL(AOM_ask_value_string(b_refs_tag[i], "object_type", &ref_type));
printf("ref_type:%s\n", ref_type);
if (tc_strcmp(ref_type, "ZT2_ProjectFolder") != 0)
continue;
int n_projs = 0;
tag_t* projs = NULLTAG;
ITKCALL(AOM_ask_value_tags(b_refs_tag[i], "contents", &n_projs, &projs));
for (int j = 0; j < n_projs; j++) {
int n_drows = 0;
tag_t proj_rev = NULLTAG, * drows = NULLTAG;
ITKCALL(ITEM_ask_latest_rev(projs[j], &proj_rev));
ITKCALL(AOM_ask_value_tags(proj_rev, "TC_Is_Represented_By", &n_drows, &drows));
printf("n_drows:%d\n", n_drows);
if (n_drows == 0)
continue;
ByqBean bean;
cpxh = getClassVal(drows[0], errorBuff, bean);
isback = true;
break;
}
if (isback)
break;
}
backs.append(cpxh).append("@").append(tuhao);
/*string sql = "select a.GYID from CHINT_WORKHOUR_WhProductXH a,CHINT_WORKHOUR_WhGYRule b ";
sql.append("where a.COMPANYCODE=b.COMPANYCODE and a.ProductZu=b.ProductZu ")
.append("and a.COMPANYCODE='").append(group_name)
.append("' and a.ProductXH='").append(cpxh)
.append("' and b.TuHao='").append(tuhao)
.append("'");
int outputColumn = 0, outputValueCount = 0;
char*** outputValue = NULL, sqlc[1024];
tc_strcpy(sqlc, sql.c_str());
QuerySQLNoInputParam(sqlc, &outputColumn, &outputValueCount, &outputValue);
if (outputValueCount > 0) {
gyid = outputValue[0][0];
}
for (int i = 0; i < outputValueCount; i++) {
}*/
}
else if (strstr(objName, "变压器") != NULL) {
tag_t *topMatnrs,*pMaterials;
int num = 0, num2=0;
AOM_ask_value_tags(designRev, "TC_Is_Represented_By", &num, &topMatnrs);
ITKCALL(AOM_ask_value_tags(designRev, "TC_Is_Represented_By", &num, &topMatnrs));
printf("num===>%d\n", num);
if (num >= 1) {
tag_t tzRev = topMatnrs[0];
AOM_ask_value_tags(tzRev, "representation_for", &num2, &pMaterials);
ITKCALL(AOM_ask_value_tags(tzRev, "representation_for", &num2, &pMaterials));
for (int x = 0; x < num2; x++) {
char *pId,*zt2_ifpbom;
tag_t pMatr = pMaterials[x];
AOM_ask_value_string(pMatr, "item_id", &pId);
AOM_ask_value_string(pMatr, "zt2_ifpbom", &zt2_ifpbom);
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) {
tag_t process = getProcess(pMatr);
if (process != NULLTAG) {
@ -1263,31 +1368,19 @@ int CloneTempProcess(void *returnValue)
errorBuff = "当前选中的物料已经存在工艺路线.\n";
}
}
printf("mapByq===>%d\n", mapByq.size());
printf("mapByq===>%zd\n", mapByq.size());
if (hasProcess) {
errorBuff = "当前选中的物料已经存在工艺路线.\n";
}else if ((strcmp(bl_desc, "") == 0 || strstr(bl_desc,"-")==NULL)&& strstr(objName, "变压器") == NULL) {
}else if ((strcmp(bl_desc, "") == 0 || strstr(bl_desc,"-")==NULL) && strstr(objName, "变压器") == NULL && !isback) {
errorBuff = "当前选中的物料版本没有图号信息,请检查.\n";
}
else {
POM_AM__set_application_bypass(true);
int url_num = 0;
char** url_vals = NULL;
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;
}
tag_t topProcess = NULLTAG;
boolean flag = false;
printf("errorBuff==>%s\n", errorBuff.c_str());
readProcessBom(bom_line, errorBuff, flag, topProcess, notTcmBuff);
readProcessBom(bom_line, errorBuff, flag, topProcess, notTcmBuff, backs);
if (topProcess != NULLTAG) {
map<string, tag_t>::iterator it;
for (it = mapByq.begin(); it != mapByq.end(); it++) {
@ -1296,18 +1389,18 @@ int CloneTempProcess(void *returnValue)
save_representation2(topProcess, matnrPrev, "IMAN_METarget");
}
}
DisConnServer();
if (!flag) {
errorBuff = "当前选中的PBOM没有实件无需做工艺路线.";
}
POM_AM__set_application_bypass(false);
}
DisConnServer();
errorBuff.append(notTcmBuff);
if (errorBuff.empty()) {
errorBuff = "succ";
}
printf("errorBuff==>%s\n", errorBuff.c_str());
BOM_close_window(ebom_window);
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;

@ -23,32 +23,32 @@
<Keyword>Win32Proj</Keyword>
<RootNamespace>General</RootNamespace>
<ProjectName>General</ProjectName>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
@ -130,18 +130,18 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;IPLIB=none;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_USRDLL;_CONSOLE;IPLIB=none;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>false</SDLCheck>
<AdditionalIncludeDirectories>D:\curl-7.84.0\curl-7.84.0\builds\libcurl-vc15-x64-release-dll-ipv6-sspi-schannel\include;D:\include13\11\11\include;D:\include13\11\11\include_cpp;D:\dflittk\oci\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>Z:\TC_install\ZhengTai\c\libcurl-vc15-x64-release-dll-ipv6-sspi-schannel\include;Z:\TC_install\YSR\c\TC11.6\include;Z:\TC_install\YSR\c\TC11.6\include_cpp;Z:\TC_install\YSR\c\clib\OCI\include;Z:\TC_install\ZhengTai\c\libxl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>D:\include13\11\11\lib\*.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>D:\include13\11\11\lib</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>libuser_exits.ar.lib</IgnoreSpecificDefaultLibraries>
<AdditionalDependencies>Z:\TC_install\YSR\c\TC11.6\lib\*.lib;Z:\TC_install\ZhengTai\c\libxl\lib\*.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>Z:\TC_install\YSR\c\TC11.6\lib;Z:\TC_install\ZhengTai\c\libxl\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>libuser_exits.ar.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
</Link>
</ItemDefinitionGroup>
<ItemGroup>

@ -314,6 +314,202 @@ int CHINT_task_complete(EPM_action_message_t msg) {
}
return ifail;
}
int CHINT_yptask_complete(EPM_action_message_t msg) {
ECHO("=========================================================\n");
ECHO("CHINT_yptask_complete 开始执行\n");
ECHO("=========================================================\n");
int ifail = ITK_ok, sub_task_count = 0, targetCnt = 0, url_num = 0, numl = 0;
char** url_vals = NULL, * userName = NULL;
tag_t root_task = NULLTAG, * sub_tasks = NULL, current_task = NULLTAG, type_tag = NULLTAG;
tag_t* targets = NULLTAG, userTag = NULLTAG, * task_list = NULLTAG, query = NULLTAG;
vector<string> prefVec;
ITKCALL(PREF_ask_char_values("CHINT_yptask_complete", &url_num, &url_vals));
if (url_num == 0) {
printf("CHINT_yptask_complete首选项配置不正确\n");
return ifail;
}
Split(url_vals[0], ";", prefVec);
current_task = msg.task;
ITKCALL(EPM_ask_root_task(msg.task, &root_task));
ITKCALL(EPM_ask_sub_tasks(root_task, &sub_task_count, &sub_tasks));
ITKCALL(EPM_ask_attachments(root_task, EPM_target_attachment, &targetCnt, &targets));
//获取当前用户任务列表
ITKCALL(POM_get_user(&userName, &userTag));
ITKCALL(EPM_ask_assigned_tasks(userTag, 2, &numl, &task_list));
printf("task_list===>%d\n", numl);
ITKCALL(QRY_find2("查询项目", &query));
printf("targetCnt===>%d\n", targetCnt);
for (int t = 0; t < targetCnt; t++) {
tag_t rev = targets[t], item = NULLTAG;
char* id = NULL, *type = NULL, *name = NULL;
bool finish = true;
ITKCALL(WSOM_ask_object_type2(rev, &type));
ITKCALL(WSOM_ask_name2(rev, &name));
ITKCALL(AOM_ask_value_string(rev, "item_id", &id));
for (int p = 0; finish && p < prefVec.size(); p++) {
vector<string> split, types, tasks;
Split(prefVec[p], "=", split);
if (tc_strstr(split[0].c_str(), type) == nullptr) {
//若首选项不包含该对象类型则跳过
continue;
}
printf("pref===>%s\n", prefVec[p].c_str());
int index = -1;
Split(split[0], "&", types);
if (p == 0)
printf("types===>%zd\n", types.size());
for (int i = 0; i < types.size(); i++) {
if (tc_strstr(types[i].c_str(), type) != nullptr) {
if (tc_strcmp(types[i].c_str(), type) == 0) {
index = i;
break;
}
else if (tc_strcmp("ZT2_Design3DRevision", type) == 0) {
//类型如果为ZT2_Design3DRevision需判断id是否包含首选项中-后的子字符串
vector<string> sp;
Split(types[i], "-", sp);
if (tc_strstr(id, sp[1].c_str()) != NULL) {
index = i;
break;
}
}
else {
//部分类型不仅需要匹配类型,还要匹配名称
string typeStr = type;
typeStr.append("-").append(name);
if (tc_strcmp(types[i].c_str(), typeStr.c_str()) == 0) {
index = i;
break;
}
}
}
}
printf("index===>%d\n", index);
if (index < 0) {
continue;
}
//调用查询查询项目“zt2_WBSNo”-WBS号“zt2_ProjectCode”-工程编号查找对应的项目ZT2_ProjectItem
printf("query\n");
tag_t* projects = NULLTAG;
char* zt2_WBSNo = NULL, * zt2_ProjectNo = NULL;
ITKCALL(ITEM_ask_item_of_rev(rev, &item));
ITKCALL(AOM_ask_value_string(item, "zt2_WBSNo", &zt2_WBSNo));
ITKCALL(AOM_ask_value_string(item, "zt2_ProjectNo", &zt2_ProjectNo));
char* qry_entries[2] = { "WBS号", "工程编号" }, * qry_values[2] = { zt2_WBSNo, zt2_ProjectNo };
int queryCnt = 0;
ITKCALL(QRY_execute(query, 2, qry_entries, qry_values, &queryCnt, &projects));
printf("queryCnt===>%d\n", queryCnt);
if (queryCnt == 0) {
printf("未找到项目对象\n");
finish = false;
break;
}
//根据当前任务流程目标下的item类型在定义好的首选项中查询另外的对象版本是否已发布
//对象存在项目文件夹“1 - 电磁设计”和“2 - 组件布置图”)
tag_t* projectFolder = NULLTAG, * folders = NULLTAG;
int pfolderCnt = 0, folderCnt = 0;
ITKCALL(AOM_ask_value_tags(projects[0], "IMAN_reference", &pfolderCnt, &projectFolder));
if (pfolderCnt == 0) {
printf("未找到项目执行文件夹\n");
finish = false;
break;
}
ITKCALL(AOM_ask_value_tags(projectFolder[0], "contents", &folderCnt, &folders));
for (int f = 0; f < folderCnt; f++) {
char* folderName = NULL;
ITKCALL(WSOM_ask_name2(folders[f], &folderName));
if (tc_strcmp(folderName, "1-电磁设计") == 0 || tc_strcmp(folderName, "2-组件布置图") == 0) {
tag_t* subItems = NULLTAG, subRev = NULLTAG;
int subCnt = 0;
ITKCALL(AOM_ask_value_tags(folders[f], "contents", &subCnt, &subItems));
for (int j = 0; j < subCnt; j++) {
char* subType = NULL, * subId = NULL, * subName = NULL;
ITKCALL(ITEM_ask_latest_rev(subItems[j], &subRev));
ITKCALL(WSOM_ask_object_type2(subRev, &subType));
ITKCALL(WSOM_ask_name2(subRev, &subName));
ITKCALL(AOM_ask_value_string(subRev, "item_id", &subId));
for (int i = 0; i < types.size(); i++) {
if (i != index && tc_strstr(types[i].c_str(), subType) != NULL) {
if (tc_strcmp(types[i].c_str(), subType) == 0) {
tag_t* status = NULLTAG;
int statusCnt = 0;
ITKCALL(WSOM_status_ask_effectivities(subRev, &statusCnt, &status));
if (statusCnt == 0) {
printf("No Status===>%s\n", subId);
goto ENDCOMPLETE;
}
break;
}
else if (tc_strcmp("ZT2_Design3DRevision", subType) == 0) {
//类型如果为ZT2_Design3DRevision需判断id是否包含首选项中-后的子字符串
vector<string> sp;
Split(types[i], "-", sp);
if (tc_strstr(subId, sp[1].c_str()) != NULL) {
tag_t* status = NULLTAG;
int statusCnt = 0;
ITKCALL(WSOM_status_ask_effectivities(subRev, &statusCnt, &status));
if (statusCnt == 0) {
printf("No Status===>%s\n", subId);
goto ENDCOMPLETE;
}
break;
}
}
else {
//部分类型不仅需要匹配类型,还要匹配名称
string typeStr = subType;
typeStr.append("-").append(subName);
if (tc_strcmp(types[i].c_str(), typeStr.c_str()) == 0) {
tag_t* status = NULLTAG;
int statusCnt = 0;
ITKCALL(WSOM_status_ask_effectivities(subRev, &statusCnt, &status));
if (statusCnt == 0) {
printf("No Status===>%s\n", subId);
goto ENDCOMPLETE;
}
break;
}
}
}
}
}
}
}
char* projectId = NULL;
ITKCALL(AOM_ask_value_string(projects[0], "item_id", &projectId));
Split(split[1], "&", tasks);
for (int i = 0; i < tasks.size(); i++) {
string projName = projectId;
projName.append("-").append(tasks[i]);
printf("projName %s \n", projName.c_str());
for (int j = 0; j < numl; j++) {
tag_t taskTag = task_list[j];
char* taskName;
ITKCALL(AOM_ask_value_string(taskTag, "job_name", &taskName));
printf("taskName %s \n", taskName);
if (strstr(taskName, projName.c_str()) != NULL) {
ITKCALL(EPM_set_task_result(taskTag, EPM_RESULT_Completed));
ITKCALL(EPM_trigger_action(taskTag, EPM_complete_action, ""));
finish = false;
}
}
}
ENDCOMPLETE:
printf("ENDCOMPLETE\n");
break;
}
}
return ifail;
}
int chint_CheckTable_State(EPM_action_message_t msg) {
int ifail = ITK_ok;

@ -56,6 +56,8 @@ int CHINT_SavePost(METHOD_message_t* msg, va_list args);
bool isTcm(tag_t mantr);
bool isBomViewTcm(tag_t mantr);
void TCMAndOwner(tag_t matnrTop);
int CHINT_yptask_complete(EPM_action_message_t msg);
//user service end
#ifdef __cplusplus
}
@ -85,6 +87,7 @@ void TCMAndOwner(tag_t matnrTop);
#define S_LSChange "ÁÙʱ¸ü¸Ä"
#define BL_QUANTITY "bl_quantity"
#define BL_LINE_OBJECT "bl_line_object"
/*
#define ITKCALL( argument ) \
{ \
int retcode = argument; \
@ -97,4 +100,4 @@ void TCMAndOwner(tag_t matnrTop);
printf( " in file ["__FILE__"], line [%d]\n\n", __LINE__ ); \
if (s != 0) MEM_free (s); \
} \
}
}*/

@ -232,6 +232,14 @@ extern DLLAPI int USERSERVICE_custom_register_handlers(int *decision, va_list ar
else {
printf("Registering action handler CHINT_task_complete failed %d\n", ifail);
}
ifail = EPM_register_action_handler("CHINT_yptask_complete", "CHINT_yptask_complete", (EPM_action_handler_t)CHINT_yptask_complete);
if (ifail == 0) {
printf("Registering action handler CHINT_yptask_complete successful\n");
}
else {
printf("Registering action handler CHINT_yptask_complete failed %d\n", ifail);
}
ifail = EPM_register_action_handler("CHINT_cossheet_upgrade", "CHINT_cossheet_upgrade", (EPM_action_handler_t)CHINT_cossheet_upgrade);
if (ifail == 0) {
printf("Registering action handler CHINT_cossheet_upgrade successful\n");

@ -28,7 +28,7 @@ $HISTORY$
#include "string_utils.h"
void Split( string strArg, string spliter, vector<string> &ans )
/*void Split(string strArg, string spliter, vector<string>& ans)
{
ans.clear();
size_t index0;
@ -50,7 +50,43 @@ void Split( string strArg, string spliter, vector<string> &ans )
break;
}
}
}*/
void Split(string strArg, string spliter, vector<string>& ans)
{
ans.clear();
size_t index0;
string one_arg;
if (strArg.size() < 1) {
ans.push_back(strArg);
return;
}
if (strArg.find_first_not_of(' ') == string::npos)
strArg = "";
while (strArg.size() > 0)
{
index0 = strArg.find(spliter);
//printf(" index0:%d", (int)index0);
if (index0 != string::npos)
{
if (index0 == 0) {
strArg = strArg.substr(index0 + spliter.size());
ans.push_back("");
}
else {
one_arg = strArg.substr(0, index0);
strArg = strArg.substr(index0 + spliter.size());
ans.push_back(one_arg);
}
}
else
{
ans.push_back(strArg);
break;
}
}
}
char* GSTR_clone( char **dst, const char *src )
{
char *retVal = NULL;

Loading…
Cancel
Save