20241018代码上传

master
李冬阳 8 months ago
parent 2891a6fbf2
commit 9d29f993db

@ -320,7 +320,8 @@ void autoFeedLike(tag_t towGxLine, StBomBean& pBean, string name2, vector<StBomB
if (tc_strstr(child.currentName.c_str(), nameLike.c_str()) != NULL) {
autoFeedLike(towGxLine, child, stBomlines, 1);
}
}else if (name2.compare(child.currentName) == 0) {
}
else if (name2.compare(child.currentName) == 0) {
printf("===================\n");
autoFeedLike(towGxLine, child, stBomlines, 1);
}
@ -745,6 +746,95 @@ void readPbomMsg(tag_t bom_line, string &errBuffer, map<string, vector<FeedRule>
readPbomMsg(c_line_tags[i], errBuffer, drawMap, nameMap, loginId, false);
}
}
//判断是否为备件包
bool isBack(char* objName, vector<vector<string>> back_prefs) {
boolean isback = false;
for (int i = 0; i < back_prefs.size() && !isback; i++) {
vector<string> backs = back_prefs[i];
for (int j = 0; j < back_prefs.size(); j++) {
if (tc_strstr(objName, backs[j].c_str()) != NULL) {
isback = true;
break;
}
}
}
return isback;
}
void AutoFeeding(tag_t matnrRev, vector<vector<string>> back_prefs, string &errBuffer,
map<string, vector<FeedRule>> drawMap, map<string, vector<FeedRule>> nameMap, char *loginId) {
tag_t mantr = getPBomTag(matnrRev);
//lidy20240203备件包工艺路线指派
char *objName = NULL;
ITKCALL(AOM_ask_value_string(mantr, "object_name", &objName));
//首选项格式:组名:匹配字段1;匹配字段2
boolean isback = isBack(objName, back_prefs);
//遍历BOM获取所有要投料的
tag_t* bvr_list = NULLTAG, ebom_window = NULLTAG, bom_line = NULLTAG;
int bvr_count = 0;
ITKCALL(ITEM_rev_list_bom_view_revs(mantr, &bvr_count, &bvr_list));
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, isback);
ITKCALL(BOM_close_window(ebom_window));
}
void getParents(tag_t matnrRev, vector<tag_t>& feeds, vector<vector<string>> back_prefs) {
int n_parents = 0, *levels;
tag_t* parents = NULLTAG;
ITKCALL(PS_where_used_all(matnrRev, 1, &n_parents, &levels, &parents));
for (int i = 0; i < n_parents; i++) {
char* type = NULL;
ITKCALL(AOM_ask_value_string(parents[i], "object_type", &type));
if (tc_strcmp(type, "MEProcessRevision") == 0) {
continue;
}
else if (tc_strcmp(type, "Part Revision") != 0) {
getParents(parents[i], feeds, back_prefs);
continue;
}
char *objName = NULL;
ITKCALL(AOM_ask_value_string(parents[i], "object_name", &objName));
int st = isSt(parents[i]);
if (st == 1 || tc_strstr(objName, "变压器") != NULL || isBack(objName, back_prefs)) {
feeds.push_back(parents[i]);
}
else if (st == 0) {
//如果找到外购,就停止继续遍历,这条线就退出
continue;
}
else {
getParents(parents[i], feeds, back_prefs);
}
}
}
void getNewRev(string wm, bool isp, vector<tag_t> feeds, map<string, string>& revMap, map<string, tag_t>& feedMap) {
for (int j = 0; j < feeds.size(); j++) {
char *isP2 = NULL;
ITKCALL(AOM_ask_value_string(feeds[j], "zt2_ifpbom", &isP2));
if (tc_strcmp(isP2, isp ? "P" : "") == 0) {
char *zt2_MaterialNo2 = NULL, *zt2_WBSNo2 = NULL;
ITKCALL(AOM_ask_value_string(feeds[j], "zt2_WBSNo", &zt2_WBSNo2));
ITKCALL(AOM_ask_value_string(feeds[j], "zt2_MaterialNo", &zt2_MaterialNo2));
string wm2 = zt2_WBSNo2;
wm2.append("&").append(zt2_MaterialNo2);
if (wm2 == wm) {
date_t date;
ITKCALL(AOM_ask_value_date(feeds[j], "creation_date", &date));
string date_s = getDateString(date);
if (revMap.count(wm) == 0 || date_s > revMap[wm]) {
revMap[wm] = date_s;
feedMap[wm] = feeds[j];
}
}
}
}
}
//int EbomToPMethod(void *returnValue);
int AutoFeeding(void *returnValue) {
@ -759,7 +849,7 @@ int AutoFeeding(void *returnValue) {
printf("search1");
QuerySQLNoInputParam((char*)sql22.c_str(), &colmun2, &count2, &outputValue2);*/
POM_AM__set_application_bypass(true);
char *loginId;
char *loginId = NULL;
ITKCALL(POM_get_user_id(&loginId));
int ifail = ITK_ok;
tag_t matnrRev;
@ -768,7 +858,6 @@ int AutoFeeding(void *returnValue) {
ITK__convert_uid_to_tag(revUid, &matnrRev);
string errBuffer;
tag_t mantr = getPBomTag(matnrRev);
int url_num = 0;
char** url_vals = NULL;
@ -831,43 +920,65 @@ 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));
char** back_vals = NULL, *group_name = NULL;
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<vector<string>> back_prefs;
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) {
isback = true;
break;
back_prefs.push_back(backs);
}
}
char *objName = NULL;
ITKCALL(AOM_ask_value_string(matnrRev, "object_name", &objName));
if (isSt(matnrRev) == 0) {
errBuffer.append("请选择自制件");
}
else if (isSt(matnrRev) == 1 || tc_strstr(objName, "变压器") != NULL || isBack(objName, back_prefs)) {
AutoFeeding(matnrRev, back_prefs, errBuffer, drawMap, nameMap, loginId);
}
else {
//lidy20240807若选中对象为虚拟件需要向上找到最终的E或者P物料进行投料
vector<tag_t> feeds;
getParents(matnrRev, 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);
}
}
//遍历BOM获取所有要投料的
tag_t* bvr_list = NULL, ebom_window, bom_line;
int bvr_count;
ITKCALL(ITEM_rev_list_bom_view_revs(mantr, &bvr_count, &bvr_list));
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, isback);
ITKCALL(BOM_close_window(ebom_window));
POM_AM__set_application_bypass(false);
auto end = std::chrono::high_resolution_clock::now();

@ -271,7 +271,10 @@ int CHINT_CHANGEBOM_TO_SRM(EPM_action_message_t msg) {
xml.append(json_to_char);
xml.append("</m:data></m:ChangeDifferenceSync></SOAP-ENV:Body></SOAP-ENV:Envelope>");
//WriteLog("\nworkflowCode=EH_TE_ChangeNotice\nuserCode=%s\nfinishStart=true\n", userCode.c_str());
WriteLog("组织之后的XMLJSON\n%s\n", xml.c_str());
string msg = "组织之后的XMLJSON\n";
msg.append(xml);
//WriteLog("组织之后的XMLJSON\n%s\n", xml.c_str());
WriteLog2(msg.c_str());
string returnMsg = "";// ecnSendOA(userCode.c_str(), json_to_char, url);
for (int i = 0; i < urls.size(); i++) {
returnMsg.append(ecnSendSRM(xml, urls[i]));

@ -114,7 +114,12 @@ cJSON* getEHDepart(string ecnCode, string section, string &uuid) {
if (i == 0) {
vector<string> uuidVec;
Split(outputValue1[i][4],";", uuidVec);
if (uuidVec.size() > 1) {
printf("outputValue %zd===> %s\n", uuidVec.size(), uuidVec[1].c_str());
}
else {
printf("outputValue %zd===> %s\n", uuidVec.size(), outputValue1[i][4]);
}
if (uuidVec.size() > 1 && strstr(uuidVec[1].c_str(),"null") == NULL) {
uuid = uuidVec[1];
}
@ -351,7 +356,10 @@ int CHINT_ECN_SendOA(EPM_action_message_t msg) {
char *json_to_char = cJSON_Print(paramValue);
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";
msg.append(json_to_char).append("\n");
WriteLog2(msg.c_str());
string returnMsg = ecnSendOA(userCode.c_str(), json_to_char, url);
WriteLog("»Ø´«ÐÅÏ¢\n %s\n", returnMsg.c_str());
if (!returnMsg.empty()) {
@ -510,13 +518,16 @@ int CHINT_CHANGEITEM_TO_SRM(EPM_action_message_t msg) {
ecnuid = uid;
}
}
ref_cnt = 0;
bool iffilechange = false;
tag_t *afters = NULLTAG;
ITKCALL(AOM_ask_value_tags(taskTag, "ZT2_ChangeAfter", &ref_cnt, &afters));
//printf("ZT2_ChangeAfter ===>%d\n", ref_cnt);
for (int i = 0; i < ref_cnt; i++) {
char *type = NULL;
ITKCALL(WSOM_ask_object_type2(afters[i], &type));
if (tc_strcmp(type, "ZT2_Desiqn3DRevision") == 0 || tc_strcmp(type, "ZT2_ProcureRevision") == 0) {
//printf("type ===>%s\n", type);
if (tc_strcmp(type, "ZT2_Design3DRevision") == 0 || tc_strcmp(type, "ZT2_ProcureRevision") == 0) {
iffilechange = true;
break;
}
@ -610,7 +621,10 @@ int CHINT_CHANGEITEM_TO_SRM(EPM_action_message_t msg) {
xml.append("</m:data></m:ChangeNotificationSync></SOAP-ENV:Body></SOAP-ENV:Envelope>");
//WriteLog("\nworkflowCode=EH_TE_ChangeNotice\nuserCode=%s\nfinishStart=true\n", userCode.c_str());
WriteLog("组织之后的XMLJSON\n%s\n", xml.c_str());
string msg = "组织之后的XMLJSON\n";
msg.append(xml);
//WriteLog("组织之后的XMLJSON\n%s\n", xml.c_str());
WriteLog2(msg.c_str());
string returnMsg = "";// ecnSendOA(userCode.c_str(), json_to_char, url);
for (int i = 0; i < urls.size(); i++) {
returnMsg.append(ecnSendSRM(xml, urls[i]));//.append("\n")

@ -464,3 +464,27 @@ string ecnSendSRM(string entityParamValues, string url) {
return msgVal;
}
void yp_query(char* yp_url, string json) {
printf("yp_query:\n%s\nyp_url:\n%s\n", json.c_str(), yp_url);
CURL *curl = curl_easy_init();
std::stringstream out;
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, yp_url);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, G2U(json.c_str()));
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &out);
CURLcode ret = curl_easy_perform(curl);
string str_json = U2G(out.str().c_str());
curl_easy_cleanup(curl);
printf("yp_query return Msg===>%s\n", str_json.c_str());
}

@ -13,3 +13,4 @@ string getUserIdOAUUID(string uuid, string url);
string getAssignFromYP(string url);
void updatePiProject(string json, string url);
string ecnSendSRM(string entityParamValues, string url);
void yp_query(char* yp_url, string json);

@ -253,7 +253,7 @@ string getJdbVal(string name, string yqz, string checkcode, string draw, string
int outputColumn2 = 0, outputValueCount2 = 0;
char*** outputValue2 = NULL;
QuerySQLNoInputParam(selectRxfs3, &outputColumn2, &outputValueCount2, &outputValue2);
if (outputValueCount1 > 0) {
if (outputValueCount2 > 0) {
val = outputValue2[0][0];
}
}

@ -115,25 +115,29 @@ string& replace_all2(string& str, const string& old_value, const string& new_v
return str;
}
tag_t getSapPart(tag_t designRevLine, tag_t designRev, string& errBuff, NodeBean& bean) {
auto start = std::chrono::high_resolution_clock::now();
int num = 0;
tag_t* mantrs;
char *type, *item_id;
ITKCALL(AOM_ask_value_string(designRev, "object_type", &type));
ITKCALL(AOM_ask_value_string(designRev, "item_id", &item_id));
if (strcmp(type, "Part Revision") == 0) {
if (tc_strcmp(type, "Part Revision") == 0) {
return designRev;
}
ITKCALL(AOM_ask_value_tags(designRev, "representation_for", &num, &mantrs));
//printf("num===>%d\n", num);
vector<tag_t> parts;
if (strstr(item_id, "1ZDB300000P") != NULL) {
auto bomtime = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = bomtime - start;
printf("getSapPart1%f\n", elapsed.count());
if (tc_strstr(item_id, "1ZDB300000P") != NULL) {
ITKCALL(AOM_ask_value_tags(designRev, "representation_for", &num, &mantrs));
map<string, tag_t> partsCcp;
for (int i = 0; i < num; i++) {
char* type, *zt2_ifpbom, *itemId;
ITKCALL(AOM_ask_value_string(mantrs[i], "object_type", &type));
ITKCALL(AOM_ask_value_string(mantrs[i], "zt2_ifpbom", &zt2_ifpbom));
ITKCALL(AOM_ask_value_string(mantrs[i], "item_id", &itemId));
if (strstr(type, "Part") != NULL && strcmp(zt2_ifpbom, "P") != 0) { //
if (tc_strstr(type, "Part") != NULL && tc_strcmp(zt2_ifpbom, "P") != 0) { //
tag_t matnrItem;
ITKCALL(ITEM_ask_item_of_rev(mantrs[i], &matnrItem));
partsCcp[itemId] = matnrItem;
@ -147,6 +151,10 @@ tag_t getSapPart(tag_t designRevLine, tag_t designRev, string& errBuff, NodeBean
}*/
}
}
bomtime = std::chrono::high_resolution_clock::now();
elapsed = bomtime - start;
printf("getSapPart1num%d%f\n", num, elapsed.count());
map<string, tag_t>::iterator it;
for (it = partsCcp.begin(); it != partsCcp.end(); it++) {
string s = it->first;
@ -160,20 +168,27 @@ tag_t getSapPart(tag_t designRevLine, tag_t designRev, string& errBuff, NodeBean
bean.ccps.push_back(partRevLast);
}
}
bomtime = std::chrono::high_resolution_clock::now();
elapsed = bomtime - start;
printf("getSapPart1it%zd%f\n", partsCcp.size(), elapsed.count());
}
else {
else if (tc_strstr(item_id, "2ZDB") == NULL) {
ITKCALL(AOM_ask_value_tags(designRev, "representation_for", &num, &mantrs));
map<string, tag_t> partsCcp;
for (int i = 0; i < num; i++) {
char* type, *zt2_ifpbom, *itemId;
ITKCALL(AOM_ask_value_string(mantrs[i], "object_type", &type));
ITKCALL(AOM_ask_value_string(mantrs[i], "zt2_ifpbom", &zt2_ifpbom));
ITKCALL(AOM_ask_value_string(mantrs[i], "item_id", &itemId));
if (strstr(type, "Part") != NULL && strcmp(zt2_ifpbom, "P") != 0) { //
if (tc_strstr(type, "Part") != NULL && tc_strcmp(zt2_ifpbom, "P") != 0) { //
tag_t matnrItem;
ITKCALL(ITEM_ask_item_of_rev(mantrs[i], &matnrItem));
partsCcp[itemId] = matnrItem;
}
}
bomtime = std::chrono::high_resolution_clock::now();
elapsed = bomtime - start;
printf("getSapPart2num%d%f\n", num, elapsed.count());
map<string, tag_t>::iterator it;
for (it = partsCcp.begin(); it != partsCcp.end(); it++) {
string s = it->first;
@ -183,6 +198,9 @@ tag_t getSapPart(tag_t designRevLine, tag_t designRev, string& errBuff, NodeBean
//}
parts.push_back(partRevLast);
}
bomtime = std::chrono::high_resolution_clock::now();
elapsed = bomtime - start;
printf("getSapPart2it%zd%f\n", partsCcp.size(), elapsed.count());
}
if (parts.size() == 1) {
return parts[0];
@ -200,7 +218,11 @@ tag_t getSapPart(tag_t designRevLine, tag_t designRev, string& errBuff, NodeBean
//}
ITKCALL(AOM_ask_value_string(designRevLine, "ZT2_TYSpecifications", &zt2_TYJNo));
ITKCALL(AOM_ask_value_string(designRev, "zt2_Specifications", &spec));
if (strcmp(zt2_TYJNo, "") != 0) {
bomtime = std::chrono::high_resolution_clock::now();
elapsed = bomtime - start;
printf("getSapPart2%f\n", elapsed.count());
if (tc_strcmp(zt2_TYJNo, "") != 0) {
string qryVal;
tag_t query = NULLTAG, *tags;
map<string, tag_t> map_revs;
@ -219,6 +241,7 @@ tag_t getSapPart(tag_t designRevLine, tag_t designRev, string& errBuff, NodeBean
map_revs[zt2_MaterialNo] = rev;
}
}
vector<string> keySet = KeySet(map_revs);
sort(keySet.begin(), keySet.end(), myCompare);
for (int i = 0; i < keySet.size(); i++) {
@ -238,7 +261,11 @@ tag_t getSapPart(tag_t designRevLine, tag_t designRev, string& errBuff, NodeBean
if (vals[k].rfind("F064:", 0) == 0) {
string temp = replace_all2(vals[k], "F064:", "");
printf("temp===>%s\n", temp.c_str());
if (strstr(zt2_TYJNo, temp.c_str()) != NULL) {
if (tc_strstr(zt2_TYJNo, temp.c_str()) != NULL) {
bomtime = std::chrono::high_resolution_clock::now();
elapsed = bomtime - start;
printf("getSapPart3%f\n", elapsed.count());
return map_revs[materialNo];
}
break;
@ -246,7 +273,7 @@ tag_t getSapPart(tag_t designRevLine, tag_t designRev, string& errBuff, NodeBean
}
}
}
if (!strcmp(zt2_Diagram, "Y") == 0 && !strcmp(zt2_Diagram, "") == 0) {
if (!tc_strcmp(zt2_Diagram, "Y") == 0 && !tc_strcmp(zt2_Diagram, "") == 0) {
string buffErr = "";
buffErr.append("缺少物料编码[找不到与通用件规格相匹配的物料-(*").append(searchId)
.append("*").append(zt2_TYJNo).append(")];\n");
@ -258,11 +285,41 @@ tag_t getSapPart(tag_t designRevLine, tag_t designRev, string& errBuff, NodeBean
}
}
if (tc_strstr(item_id, "2ZDB") != NULL) {
ITKCALL(AOM_ask_value_tags(designRev, "representation_for", &num, &mantrs));
map<string, tag_t> partsCcp;
for (int i = 0; i < num; i++) {
char* type, *zt2_ifpbom, *itemId;
ITKCALL(AOM_ask_value_string(mantrs[i], "object_type", &type));
ITKCALL(AOM_ask_value_string(mantrs[i], "zt2_ifpbom", &zt2_ifpbom));
ITKCALL(AOM_ask_value_string(mantrs[i], "item_id", &itemId));
if (tc_strstr(type, "Part") != NULL && tc_strcmp(zt2_ifpbom, "P") != 0) { //
tag_t matnrItem;
ITKCALL(ITEM_ask_item_of_rev(mantrs[i], &matnrItem));
partsCcp[itemId] = matnrItem;
}
}
bomtime = std::chrono::high_resolution_clock::now();
elapsed = bomtime - start;
printf("getSapPart2num%d%f\n", num, elapsed.count());
map<string, tag_t>::iterator it;
for (it = partsCcp.begin(); it != partsCcp.end(); it++) {
string s = it->first;
tag_t partLast = partsCcp[s], partRevLast;
ITKCALL(ITEM_ask_latest_rev(partLast, &partRevLast));
//if (parts.size() == 0) {
//}
parts.push_back(partRevLast);
}
bomtime = std::chrono::high_resolution_clock::now();
elapsed = bomtime - start;
printf("getSapPart2it%zd%f\n", partsCcp.size(), elapsed.count());
}
for (int i = 0; i < parts.size(); i++) {
tag_t part = parts[i];
char* specPart;
ITKCALL(AOM_ask_value_string(part, "zt2_Specifications", &specPart));
if (strcmp(specPart, spec) == 0) {
if (tc_strcmp(specPart, spec) == 0) {
return part;
}
/*String spec2 = parts.get(i).getProperty("zt2_Specifications");
@ -270,7 +327,10 @@ tag_t getSapPart(tag_t designRevLine, tag_t designRev, string& errBuff, NodeBean
return parts.get(i);
}*/
}
if (!strcmp(zt2_Diagram, "Y") == 0 && !strcmp(zt2_Diagram, "") == 0) {
bomtime = std::chrono::high_resolution_clock::now();
elapsed = bomtime - start;
printf("getSapPart4%f\n", elapsed.count());
if (!tc_strcmp(zt2_Diagram, "Y") == 0 && !tc_strcmp(zt2_Diagram, "") == 0) {
//errBuff.append("缺少物料编码[找不到相同规格的物料(").append(spec).append(")];");
string buffErr = "";
buffErr.append("缺少物料编码[找不到相同规格的物料(").append(spec).append(")];");
@ -398,7 +458,11 @@ void askLineVal(NodeBean& bean, tag_t bom_line, tag_t designRev, string& errBuff
bean.bl_sequence_no = bl_sequence_no;
}
//根据图纸获取物料 包含通用件的逻辑
auto start = std::chrono::high_resolution_clock::now();
tag_t part = getSapPart(bom_line, designRev, errBuff, bean);
auto bomtime = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = bomtime - start;
printf("getSapPart%f\n", elapsed.count());
//printf("11111111\n");
if (part != NULLTAG) {
//BOM_writer
@ -569,14 +633,12 @@ void getAllXnj(vector<tag_t> xnzjbVec, int maxNum, int &xxt,
* @param dbName
* @param loginUserId
*/
void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName, char *loginUserId)
void recyReadBom(tag_t bom_line, tag_t designRev, NodeBean& pBean, string& errBuff, string dbName, char *loginUserId)
{
int c_line_count;
char* uid, *type, *zt2_Diagram, *source, *itemId, *object_name;
//图纸版本、子行
tag_t designRev, *c_line_tags;
ITKCALL(AOM_ask_value_tag(bom_line, "bl_line_object", &designRev));
//printf("1222");
int c_line_count = 0;
char *itemId = NULL, *uid = NULL, *type = NULL, *zt2_Diagram = NULL, *source = NULL, *object_name = NULL, *os = NULL;
tag_t *c_line_tags;
ITKCALL(AOM_ask_value_string(designRev, "item_id", &itemId));
ITK__convert_tag_to_uid(designRev, &uid);
//printf("revUid===>%s\n", uid);
pBean.revUid = uid;
@ -603,9 +665,6 @@ void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName
return;
}
boolean flagMat = false;
//根据图纸获取物料信息
askLineVal(pBean, bom_line, designRev, errBuff, flagMat);
tag_t tagUser;
char *tagId;
ITKCALL(AOM_ask_value_tag(designRev, "owning_user", &tagUser));
@ -618,6 +677,15 @@ void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName
if (strcmp(type, "ZT2_XNZJBRevision") == 0) {
return;
}
if (bom_line != NULLTAG) {
//图纸版本、子行
ITKCALL(AOM_ask_value_string(bom_line, "object_string", &os));
//ITKCALL(AOM_ask_value_tag(bom_line, "bl_line_object", &designRev));
//printf("1222");
boolean flagMat = false;
//根据图纸获取物料信息
askLineVal(pBean, bom_line, designRev, errBuff, flagMat);
//外购 不展开子件
if (strstr(itemId, "2ZD") != NULL || strstr(itemId, "4ZD") != NULL) {
if (!flagMat) {
@ -642,6 +710,8 @@ void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName
}
AOM_refresh(bom_line, FALSE);*/
ITKCALL(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags));
}
//转换时原材料展开逻辑
if (c_line_count == 0 && !dbName.empty() && (strstr(itemId, "1ZD") != NULL ||
strstr(itemId, "2ZD") != NULL || strstr(itemId, "4ZD") != NULL)) {
@ -664,7 +734,6 @@ void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName
if (found == std::string::npos) {
errBuff.append(buffErr);
}
}
for (int t = 0; t < outputValueCount1; t++) {
string materialno = outputValue1[t][0];
@ -698,13 +767,13 @@ void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName
if (suppressed) {
continue;
}
char* os = NULL;
ITKCALL(AOM_ask_value_string(c_line_tags[i], "object_string", &os));
char* os2 = NULL;
ITKCALL(AOM_ask_value_string(c_line_tags[i], "object_string", &os2));
//修改过之后之前已经是解包的状态了
logical flag;
char *remark;
ITKCALL(BOM_line_is_packed(c_line_tags[i], &flag));
printf("flag1=%d==>%s\n", flag, os);
printf("flag1=%d==>%s\n", flag, os2);
ITKCALL(AOM_ask_value_string(c_line_tags[i], "ZT2_Remark", &remark));
//printf("recyReadBom:%s\n", remark);
if (flag) {
@ -747,7 +816,7 @@ void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName
cBean.packNum = count + 1;
cBean.topNum = atoi(topNum);
cBean.remark = remark;
recyReadBom(c_line_tags[i], cBean, errBuff, dbName, loginUserId);
recyReadBom(c_line_tags[i], c_Rev, cBean, errBuff, dbName, loginUserId);
pBean.childs.push_back(cBean);
}
@ -782,7 +851,7 @@ void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName
cBean.revUid = cUid;
cBean.designRev = c_Rev;
cBean.remark = remark;
recyReadBom(c_line_tags[i], cBean, errBuff, dbName, loginUserId);
recyReadBom(c_line_tags[i], c_Rev, cBean, errBuff, dbName, loginUserId);
pBean.childs.push_back(cBean);
}
}
@ -800,7 +869,7 @@ void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName
* @param dbName
* @param idVector DEBOM
*/
void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName, vector<string> idVector)
void recyReadBom2(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName, vector<string> idVector)
{
int c_line_count;
char* uid, *type, *zt2_Diagram, *source, *itemId, *object_name;
@ -967,7 +1036,7 @@ void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName
cBean.packNum = count + 1;
cBean.topNum = atoi(topNum);
cBean.remark = remark;
recyReadBom(c_line_tags[i], cBean, errBuff, dbName, idVector);
recyReadBom2(c_line_tags[i], cBean, errBuff, dbName, idVector);
pBean.childs.push_back(cBean);
}
@ -993,7 +1062,7 @@ void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName
cBean.revUid = cUid;
cBean.designRev = c_Rev;
cBean.remark = remark;
recyReadBom(c_line_tags[i], cBean, errBuff, dbName, idVector);
recyReadBom2(c_line_tags[i], cBean, errBuff, dbName, idVector);
pBean.childs.push_back(cBean);
}
}
@ -1064,7 +1133,7 @@ void getAllXnj(vector<tag_t> xnzjbVec, int maxNum, int &xxt,
xxt = xxt + 1;
cBean.bl_sequence_no = lastnum;
cBean.remark = remark;
recyReadBom(cc_line_tags[j], cBean, errBuff, dbName, idVector);
recyReadBom2(cc_line_tags[j], cBean, errBuff, dbName, idVector);
pBean.childs.push_back(cBean);
}
printf("xnzjbVec2 ===> %d ==>%d \n", xnzjbVec2.size(), qtyPXn);
@ -1135,7 +1204,7 @@ void getAllXnj(vector<tag_t> xnzjbVec, int maxNum, int &xxt,
cBean.bl_sequence_no = lastnum;
cBean.remark = remark;
//非虚拟件的继续原逻辑展开
recyReadBom(cc_line_tags[j], cBean, errBuff, dbName, loginUserId);
recyReadBom(cc_line_tags[j], c_Rev, cBean, errBuff, dbName, loginUserId);
pBean.childs.push_back(cBean);
}
printf("xnzjbVec2 ===> %d ==>%d \n", xnzjbVec2.size(), qtyPXn);
@ -1642,9 +1711,10 @@ int DbomToEMethod(void* returnValue) {
tag_t* bvr_list = NULL;
ITKCALL(ITEM_rev_list_bom_view_revs(designRev, &bvr_count, &bvr_list));
printf("bvr_count=%d", bvr_count);
if (bvr_count > 0) {
ITKCALL(BOM_set_window_top_line_bvr(ebom_window, bvr_list[0], &bom_line)); //顶层bom获取
printf("顶层bom获取\n");
}
//(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags));
NodeBean topBean;
@ -1683,7 +1753,7 @@ int DbomToEMethod(void* returnValue) {
printf("dbName===%s\n", dbName.c_str());
ITKCALL(POM_get_user_id(&loginUserId));
recyReadBom(bom_line, topBean, errBuff, dbName, loginUserId);
recyReadBom(bom_line, designRev, topBean, errBuff, dbName, loginUserId);
DisConnServer();
ITKCALL(BOM_close_window(ebom_window));
auto time2 = std::chrono::high_resolution_clock::now();
@ -1882,7 +1952,7 @@ int DbomToEMethodUser(void* returnValue) {
elapsed = time1 - start;
printf("time1%f\n", elapsed.count());
recyReadBom(bom_line, topBean, errBuff, dbName, idVector);
recyReadBom2(bom_line, topBean, errBuff, dbName, idVector);
auto time2 = std::chrono::high_resolution_clock::now();
elapsed = time2 - start;
printf("time2%f\n", elapsed.count());

@ -1527,6 +1527,7 @@ tag_t saveAsMaterial(EBomUpBean topBean, boolean isTop,
*/
void startUpdate(EBomUpBean upBean, tag_t pBomTag, int len, tag_t dcproxy,
boolean isTop, string &hasChange, map<string, tag_t>& saveAsMap) {
auto start = std::chrono::high_resolution_clock::now();
//记录的EBOM下面的子件
printf("startUpdate===>%s\n", upBean.matnrNo.c_str());
vector<EBomUpBean> vecs = upBean.parentBean;
@ -1552,6 +1553,10 @@ void startUpdate(EBomUpBean upBean, tag_t pBomTag, int len, tag_t dcproxy,
//原来没有PBOM
return;
}
auto bomtime = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = bomtime - start;
printf("startUpdate1 %s£º%f\n", upBean.matnrNo.c_str(), elapsed.count());
ITKCALL(BOM_set_window_top_line_bvr(ebom_window2, bvr_list2[0], &bom_line)); //顶层bom获取
ITKCALL(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags));
for (int i = 0; i < c_line_count; i++) {
@ -1576,6 +1581,9 @@ void startUpdate(EBomUpBean upBean, tag_t pBomTag, int len, tag_t dcproxy,
ITKCALL(BOM_line_cut(c_line_tag));//pBomMap[matnrNo] = c_line_tag;
}
}
bomtime = std::chrono::high_resolution_clock::now();
elapsed = bomtime - start;
printf("startUpdate2 %s£º%f\n", upBean.matnrNo.c_str(), elapsed.count());
//移除所有非P 再从EBOM复制
printf("xqTagVec===>%d\n", xqTagVec.size());
POM_AM__set_application_bypass(true);
@ -1596,15 +1604,18 @@ void startUpdate(EBomUpBean upBean, tag_t pBomTag, int len, tag_t dcproxy,
}
addToAmatnrUp(vecs, len, newPAmatnr, lastFlag);
}
bomtime = std::chrono::high_resolution_clock::now();
elapsed = bomtime - start;
printf("startUpdate3 %s£º%f\n", upBean.matnrNo.c_str(), elapsed.count());
if (xqTagVec.size() == 0) {
//不是线圈 移除后复制
printf("vecs===>%zd\n", vecs.size());
for (int i = 0; i < vecs.size(); i++) {
printf("i===>%d\n", i);
//printf("i===>%d\n", i);
EBomUpBean cupBean = vecs[i];
//重新复制
if (std::find(matnrVec.begin(), matnrVec.end(), cupBean.matnrNo) != matnrVec.end()) {
printf("matnrVec ===>%s\n", cupBean.matnrNo.c_str());
//printf("matnrVec ===>%s\n", cupBean.matnrNo.c_str());
tag_t c_line_tag = pBomMap[cupBean.matnrNo], bomView = NULLTAG, childPTag = NULLTAG;
boolean flagAs = false;
@ -1615,12 +1626,12 @@ void startUpdate(EBomUpBean upBean, tag_t pBomTag, int len, tag_t dcproxy,
ITKCALL(BOM_save_window(bomView));
ITKCALL(BOM_close_window(bomView));
}
printf("i2===>%d\n", i);
//printf("i2===>%d\n", i);
}
else {
boolean flagLc = false;
char* seq = NULL, *ZT2_Remark = NULL;
printf("matnrVecNotP===>%s\n", cupBean.matnrNo.c_str());
//printf("matnrVecNotP===>%s\n", cupBean.matnrNo.c_str());
tag_t cline = cupBean.bomline, newChild = NULLTAG;
ITKCALL(BOM_line_copy(bom_line, cline, NULLTAG, &newChild));
if (newChild == NULLTAG) {
@ -1655,6 +1666,9 @@ void startUpdate(EBomUpBean upBean, tag_t pBomTag, int len, tag_t dcproxy,
}
}
}
bomtime = std::chrono::high_resolution_clock::now();
elapsed = bomtime - start;
printf("startUpdate4 %s£º%f\n", upBean.matnrNo.c_str(), elapsed.count());
for (int i = 0; i < matnrVec.size(); i++) {
bool cut = true;
for (int j = 0; j < vecs.size(); j++) {
@ -1669,11 +1683,17 @@ void startUpdate(EBomUpBean upBean, tag_t pBomTag, int len, tag_t dcproxy,
ITKCALL(BOM_line_cut(c_line_tag));
}
}/**/
bomtime = std::chrono::high_resolution_clock::now();
elapsed = bomtime - start;
printf("startUpdate5 %s£º%f\n", upBean.matnrNo.c_str(), elapsed.count());
}
//移除所有非P 再从EBOM复制
ITKCALL(BOM_save_window(ebom_window2));
ITKCALL(BOM_close_window(ebom_window2));
bomtime = std::chrono::high_resolution_clock::now();
elapsed = bomtime - start;
printf("startUpdate6 %s£º%f\n", upBean.matnrNo.c_str(), elapsed.count());
printf("startUpdate end===>%s\n", upBean.matnrNo.c_str());
}
/**

@ -32,6 +32,7 @@
#include <sa/workcontext.h>
#include <ss/ss_errors.h>
#include <ae/datasettype.h>
#include <thread>
// #include "hx_custom.h"
#include "tc_log.h"
// #include "jk_custom.h"
@ -202,6 +203,7 @@ void addToFlow(tag_t bom_line,tag_t rootTask_tag, map<string, string> &uidMap) {
int target = EPM_target_attachment;
//版本有BOM视图且发布
ITKCALL(AOM_ask_value_tags(rev, "structure_revisions", &structs, &structure_revisions));
printf("structs===>%d\n", structs);
if (structs > 0) {
int statusNum = 0, statusNum2=0;
char *revUid = NULL, *bomUid = NULL;
@ -211,6 +213,7 @@ void addToFlow(tag_t bom_line,tag_t rootTask_tag, map<string, string> &uidMap) {
if (uidMap.count(revUid) == 0) {
uidMap[revUid] = "1";
ITKCALL(AOM_ask_value_tags(rev, "release_status_list", &statusNum, &release_status_list2));
printf("statusNum===>%d\n", statusNum);
if (statusNum > 0) {
//已发布的版本放在引用关系
ITKCALL(EPM_add_attachments(rootTask_tag, 1, &rev, &reference));
@ -219,6 +222,7 @@ void addToFlow(tag_t bom_line,tag_t rootTask_tag, map<string, string> &uidMap) {
tag_t *stageTags;
int stageNum = 0;
ITKCALL(AOM_ask_value_tags(rev, "process_stage_list", &stageNum, &stageTags));
printf("stageNum===>%d\n", stageNum);
if (stageNum > 0) {
//已有流程的版本放在引用关系
ITKCALL(EPM_add_attachments(rootTask_tag, 1, &rev, &reference));
@ -235,11 +239,13 @@ void addToFlow(tag_t bom_line,tag_t rootTask_tag, map<string, string> &uidMap) {
//printf("bomUid:%s\n", bomUid);
statusNum = 0;
ITKCALL(AOM_ask_value_tags(struct_revision, "release_status_list", &statusNum, &release_status_list));
printf("statusNum2===>%d\n", statusNum);
if (statusNum==0 && uidMap.count(bomUid)==0) {
uidMap[bomUid] = "1";
tag_t *stageTags;
int stageNum = 0;
ITKCALL(AOM_ask_value_tags(struct_revision, "process_stage_list", &stageNum, &stageTags));
printf("stageNum2===>%d\n", stageNum);
if (stageNum > 0) {
ITKCALL(EPM_add_attachments(rootTask_tag, 1, &struct_revision, &reference));
}
@ -253,11 +259,12 @@ void addToFlow(tag_t bom_line,tag_t rootTask_tag, map<string, string> &uidMap) {
int c_line_count;
tag_t * c_line_tags;
ITKCALL(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags));
printf("c_line_count===>%d\n", c_line_count);
for (int num = 0; num < c_line_count; num++) {
addToFlow(c_line_tags[num], rootTask_tag, uidMap);
}
}
string getPrefVal(char *url_vals,char *itemId) {
vector<string> taskComps;
string name;
@ -272,6 +279,7 @@ string getPrefVal(char *url_vals,char *itemId) {
}
return name;
}
int CHINT_task_complete(EPM_action_message_t msg) {
int ifail = ITK_ok;
@ -282,20 +290,22 @@ int CHINT_task_complete(EPM_action_message_t msg) {
int sub_task_count = 0, occur_of_counts = 0;
tag_t* taskAttches = NULLTAG;
tag_t cur_task = NULLTAG;
char* jobName;
char* jobName = NULL;
current_task = msg.task;
AOM_ask_value_string(current_task, "job_name", &jobName);
EPM_ask_root_task(msg.task, &root_task);
EPM_ask_sub_tasks(root_task, &sub_task_count, &sub_tasks);
EPM_ask_attachments(root_task, EPM_target_attachment, &occur_of_counts, &taskAttches);
ITKCALL(AOM_ask_value_string(current_task, "job_name", &jobName));
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, &occur_of_counts, &taskAttches));
int url_num = 0;
char** url_vals = NULL,*uid;
PREF_ask_char_values("CHINT_TaskComplete", &url_num, &url_vals);
char* userName;
int numl;
tag_t workContents,userTag,*task_list;
char** url_vals = NULL, *uid = NULL, *yp_url = NULL;
ITKCALL(PREF_ask_char_values("CHINT_TaskComplete", &url_num, &url_vals));
ITKCALL(PREF_ask_char_value("CHINT_YPTaskURL", 0, &yp_url));
char* userName = NULL;
int numl = 0;
tag_t workContents = NULLTAG, userTag = NULLTAG, *task_list = NULLTAG;
//EPM_inbox_query
POM_get_user(&userName, &userTag);
ITKCALL(POM_get_user(&userName, &userTag));
ITKCALL(EPM_ask_assigned_tasks(userTag, 2, &numl, &task_list));
printf("提示:uid%d\n", numl);
//获取当前节点信息 00089 和 ID前缀
@ -315,26 +325,42 @@ int CHINT_task_complete(EPM_action_message_t msg) {
printf("n_found===>%d\n", n_found);
for (int t = 0; t < n_found; t++) {
tag_t rev = tags[t];
char *id;
AOM_ask_value_string(rev, "item_id", &id);
tag_t pItem = tags[t];
char *zt2_ProjectCode = NULL;
string tasklists = "";
//通过项目ID属性item_id找工作列表任务的逻辑改成通过项目属性“zt2_ProjectCode”查找
ITKCALL(AOM_ask_value_string(pItem, "zt2_ProjectCode", &zt2_ProjectCode));
string names = getPrefVal(url_vals[0], (char*)projectVec[0].c_str());
vector<string> nameVec;
Split(names,"&", nameVec);
for (int i = 0; i < nameVec.size(); i++) {
string projName = id;
string projName = zt2_ProjectCode;
projName.append("-").append(nameVec[i]);
printf("projName %s \n", projName.c_str());
bool find = true;
for (int j = 0; j < numl; j++) {
tag_t taskTag = task_list[j];
char *taskName;
AOM_ask_value_string(taskTag, "job_name", &taskName);
char *taskName = NULL;
ITKCALL(AOM_ask_value_string(taskTag, "job_name", &taskName));
printf("taskName %s \n", taskName);
if (strstr(taskName, projName.c_str())!=NULL) {
if (tc_strstr(taskName, projName.c_str()) != NULL) {
ITKCALL(EPM_set_task_result(taskTag, EPM_RESULT_Completed));
ITKCALL(EPM_trigger_action(taskTag, EPM_complete_action, ""));
}
}
if (find) {
//有数据需要完成计划任务但是实际要执行任务里没有的,需要单独调用查询执行处理,不需要等待接口返回
if (tasklists.size() > 0)
tasklists.append(",");
tasklists.append("{\"taskname\": \"").append(nameVec[i]).append("\"}");
}
}
if (tasklists.size() > 0) {
string json = "{\"projectcode\":\"";
json.append(zt2_ProjectCode).append("\",\"tasklists\":[").append(tasklists).append("]}");
thread newThread(yp_query, yp_url, json);
newThread.detach();
}
}
return ifail;
@ -346,7 +372,7 @@ int CHINT_yptask_complete(EPM_action_message_t msg) {
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;
char** url_vals = NULL, * userName = NULL, *yp_url = 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;
@ -358,6 +384,8 @@ int CHINT_yptask_complete(EPM_action_message_t msg) {
}
Split(url_vals[0], ";", prefVec);
ITKCALL(PREF_ask_char_value("CHINT_YPTaskURL", 0, &yp_url));
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));
@ -373,6 +401,7 @@ int CHINT_yptask_complete(EPM_action_message_t msg) {
for (int t = 0; t < targetCnt; t++) {
tag_t rev = targets[t], item = NULLTAG;
char* id = NULL, *type = NULL, *name = NULL;
string tasklists = "";
bool finish = true;
ITKCALL(WSOM_ask_object_type2(rev, &type));
ITKCALL(WSOM_ask_name2(rev, &name));
@ -508,14 +537,15 @@ int CHINT_yptask_complete(EPM_action_message_t msg) {
}
}
}
char* projectId = NULL;
ITKCALL(AOM_ask_value_string(projects[0], "item_id", &projectId));
//通过项目ID属性item_id找工作列表任务的逻辑改成通过项目属性“zt2_ProjectCode”查找
char* zt2_ProjectCode = NULL;
ITKCALL(AOM_ask_value_string(projects[0], "zt2_ProjectCode", &zt2_ProjectCode));
Split(split[1], "&", tasks);
for (int i = 0; i < tasks.size(); i++) {
string projName = projectId;
string projName = zt2_ProjectCode;
projName.append("-").append(tasks[i]);
printf("projName %s \n", projName.c_str());
bool find = true;
for (int j = 0; j < numl; j++) {
tag_t taskTag = task_list[j];
char* taskName;
@ -525,8 +555,22 @@ int CHINT_yptask_complete(EPM_action_message_t msg) {
ITKCALL(EPM_set_task_result(taskTag, EPM_RESULT_Completed));
ITKCALL(EPM_trigger_action(taskTag, EPM_complete_action, ""));
finish = false;
find = false;
}
}
if (find) {
//有数据需要完成计划任务但是实际要执行任务里没有的,需要单独调用查询执行处理,不需要等待接口返回
if (tasklists.size() > 0)
tasklists.append(",");
tasklists.append("{\"taskname\": \"").append(tasks[i]).append("\"}");
}
}
if (tasklists.size() > 0) {
string json = "{\"projectcode\":\"";
json.append(zt2_ProjectCode).append("\",\"tasklists\":[").append(tasklists).append("]}");
thread newThread(yp_query, yp_url, json);
newThread.detach();
}
ENDCOMPLETE:
printf("ENDCOMPLETE\n");
@ -822,6 +866,7 @@ int chint_add_to_workflow(EPM_action_message_t msg) {
ITKCALL(AOM_ask_value_string(comp, "item_id", &itemId));
ITKCALL(ITEM_ask_item_of_rev(comp, &itemTag));
if (itemMap.count(itemId) == 0) {
printf("itemId===>%s\n", itemId);
itemMap[itemId] = itemTag;
}
}
@ -833,6 +878,7 @@ int chint_add_to_workflow(EPM_action_message_t msg) {
for (it = itemMap.begin(); it != itemMap.end(); it++) {
string s = it->first;
tag_t part = itemMap[s];
printf("itemMap===>%s\n", s.c_str());
//遍历BOM获取所有要投料的
tag_t* bvr_list = NULL, ebom_window = NULL, bom_line = NULL, partRev = NULL;
@ -925,7 +971,7 @@ int chint_remove_other_deisgndata(EPM_action_message_t msg) {
char *revtype = NULL;
ITKCALL(AOM_ask_value_string(refs[i], "object_type", &revtype));
printf("revtype===>%s\n", revtype);
if (tc_strcmp(type, "Part Revision") != 0) {
if (tc_strcmp(revtype, "Part Revision") != 0) {
ITKCALL(AOM_ask_value_tag(taskTag, "owning_user", &tagUser));
break;
}

@ -296,12 +296,28 @@ int chint_changenotice(EPM_action_message_t msg) {
printf("json================%s\n", json);
// lidy20240829新接口
string cmd = "java -jar \"";
cmd.append(getenv("TC_ROOT")).append("\\bin\\uploadMinio.jar\" FS \"").append(json).append("\"");
printf("cmd==>%s", cmd.c_str());
FILE* pf = NULL;
string strResult;
char buf2[8000] = { 0 };
if ((pf = _popen(cmd.c_str(), "r")) == NULL) {
printf("接口返回1\n");
}
else {
printf("接口返回2\n");
while (fgets(buf2, sizeof buf2, pf)) {
strResult += buf2;
}
_pclose(pf);
}
//µ÷ÓýӿÚ
CURL* curl;
/*CURL* curl;
CURLcode res;
char readBuffer[10000];
memset(readBuffer, 0, 10000);
@ -322,10 +338,10 @@ int chint_changenotice(EPM_action_message_t msg) {
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, gtou(json));
res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
curl_easy_cleanup(curl);*/
char* gbk_readBuffer = utog(readBuffer);
char* gbk_readBuffer = utog(strResult.c_str());
printf("json================%s\n", gbk_readBuffer);
cJSON* result_json = cJSON_Parse(gbk_readBuffer);
cJSON* code = cJSON_GetObjectItem(result_json, "code");

@ -341,12 +341,28 @@ int chint_changenoticebm(EPM_action_message_t msg) {
printf("json================%s\n", json);
// lidy20240829新接口
string cmd = "java -jar \"";
cmd.append(getenv("TC_ROOT")).append("\\bin\\uploadMinio.jar\" FS \"").append(json).append("\"");
printf("cmd==>%s", cmd.c_str());
FILE* pf = NULL;
string strResult;
char buf2[8000] = { 0 };
if ((pf = _popen(cmd.c_str(), "r")) == NULL) {
printf("接口返回1\n");
}
else {
printf("接口返回2\n");
while (fgets(buf2, sizeof buf2, pf)) {
strResult += buf2;
}
_pclose(pf);
}
//µ÷ÓýӿÚ
CURL* curl;
/*CURL* curl;
CURLcode res;
char readBuffer[10000];
memset(readBuffer, 0, 10000);
@ -367,10 +383,10 @@ int chint_changenoticebm(EPM_action_message_t msg) {
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, gtoubm(json));
res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
curl_easy_cleanup(curl);*/
char* gbk_readBuffer = utogbm(readBuffer);
char* gbk_readBuffer = utogbm(strResult.c_str());
printf("json================%s\n", gbk_readBuffer);
cJSON* result_json = cJSON_Parse(gbk_readBuffer);
cJSON* code = cJSON_GetObjectItem(result_json, "code");

@ -243,6 +243,18 @@ void WriteLog(const char* format, ...)
}
}
void WriteLog2(const char* msg) {
printf("%s\n", msg);
if (logFile) {
//info(msg);
fprintf(logFile, "%s\n", msg);
fflush(logFile);
}
else {
printf("*!Error!*: Log File Not Exist\n");
}
}
void CloseLog(void)
{
if(logFile)

@ -26,6 +26,7 @@ extern "C" {
//void ECHO(char *format, ...);
void CreateLogFile(char* FunctionName, char **fullname);
void WriteLog(const char* format, ...);
void WriteLog2(const char* msg);
void CloseLog(void);
//void set_bypass(logical bypass);
//void current_time( date_t * date_tag );

@ -174,3 +174,14 @@ string getNow(char* format) {
}
return str;
}
string getDateString(date_t date) {
string str = "";
str.append(to_string(date.year)).append("-").
append(to_string(date.month + 1)).append("-").
append(to_string(date.day)).append(" ").
append(to_string(date.hour)).append(":").
append(to_string(date.minute)).append(":").
append(to_string(date.second));
return str;
}

@ -26,6 +26,7 @@ string getNow(char* format);
//int CompareDate( date_t date1, date_t date2 );
//int GetRandomTempFile( char tempFile[256] );
//logical IsItemRevisionType( char object_type[WSO_name_size_c + 1] );
string getDateString(date_t date);
#ifdef __cplusplus
}

Loading…
Cancel
Save