20240325代码上传

1、增加更改通知单新版excel文件签名handler
2、增加指派变更会签handler
3、历史代码BUG修改
master
李冬阳 1 year ago
parent d3618b61ce
commit 6a474871ff

@ -192,56 +192,87 @@ int CHINT_ECN_SendOA(EPM_action_message_t msg) {
ECHO("CHINT_ECN_SendOA 开始执行\n"); ECHO("CHINT_ECN_SendOA 开始执行\n");
ECHO("=========================================================\n"); ECHO("=========================================================\n");
tag_t root_task = NULLTAG, *sub_tasks = NULL, current_task = NULLTAG, type_tag = NULLTAG; tag_t root_task = NULLTAG, *sub_tasks = NULL, current_task = NULLTAG, type_tag = NULLTAG;
int sub_task_count = 0, occur_of_counts = 0; int sub_task_count = 0, occur_of_counts = 0, url_num;
tag_t* taskAttches = NULLTAG; tag_t* taskAttches = NULLTAG;
tag_t cur_task = NULLTAG; tag_t cur_task = NULLTAG;
char* jobName; char* jobName = NULL, **url_vals = NULL;
current_task = msg.task; current_task = msg.task;
AOM_ask_value_string(current_task, "job_name", &jobName); ITKCALL(AOM_ask_value_string(current_task, "job_name", &jobName));
EPM_ask_root_task(msg.task, &root_task); ITKCALL(EPM_ask_root_task(msg.task, &root_task));
EPM_ask_sub_tasks(root_task, &sub_task_count, &sub_tasks); ITKCALL(EPM_ask_sub_tasks(root_task, &sub_task_count, &sub_tasks));
EPM_ask_attachments(root_task, EPM_target_attachment, &occur_of_counts, &taskAttches); ITKCALL(EPM_ask_attachments(root_task, EPM_target_attachment, &occur_of_counts, &taskAttches));
ITKCALL(PREF_ask_char_values("database_tc", &url_num, &url_vals));
string base_url = url_vals[0];
base_url.append("/").append(url_vals[2]);
printf("url ==>%s\n", base_url.c_str());
if (ConnServer(url_vals[3], url_vals[4], (char*)base_url.c_str()) == -1) {
printf("中间数据表访问失败\n");
ifail = 919050;
ITKCALL(EMH_store_error_s1(EMH_severity_error, ifail, "database_tc"));
return ifail;
}
//获取url地址 //获取url地址
char* url, *userId, *urlId;// char* url, *userId, *urlId;//
PREF_ask_char_value("CHINT_ECNSendOAUrl", 0, &url); ITKCALL(PREF_ask_char_value("CHINT_ECNSendOAUrl", 0, &url));
PREF_ask_char_value("CHINT_OAUserID_RUL", 0, &urlId); ITKCALL(PREF_ask_char_value("CHINT_OAUserID_RUL", 0, &urlId));
char* log_file = NULL; char* log_file = NULL;
CreateLogFile("CHINT_ECN_SendOA", &log_file); // CreateLogFile("CHINT_ECN_SendOA", &log_file); //
//获取当前流程目标 //获取当前流程目标
connectSql(); connectSql();
POM_get_user_id(&userId); ITKCALL(POM_get_user_id(&userId));
string email = userId; string email = userId;
email.append("@chint.com"); email.append("@chint.com");
string userXML = getUserIdOA(email, urlId); string userXML = getUserIdOA(email, urlId);
//获取登陆组 //获取登陆组
tag_t group; tag_t group;
char *groupName, *taskUid; char *groupName, *taskUid;
POM_ask_group(&groupName, &group); ITKCALL(POM_ask_group(&groupName, &group));
AOM_ask_value_string(group, PROP_GROUP_NAME, &groupName); ITKCALL(AOM_ask_value_string(group, PROP_GROUP_NAME, &groupName));
string userCode = readXmlId(userXML); string userCode = readXmlId(userXML);
ITK__convert_tag_to_uid(msg.task, &taskUid); //流程uid ITK__convert_tag_to_uid(msg.task, &taskUid); //流程uid
for (int count = 0; count < occur_of_counts; count++) { for (int count = 0; count < occur_of_counts; count++) {
char *type; char *type;
tag_t taskTag = taskAttches[count]; tag_t taskTag = taskAttches[count];
AOM_ask_value_string(taskTag, "object_type", &type); ITKCALL(AOM_ask_value_string(taskTag, "object_type", &type));
if (strcmp(type, "ZT2_Change") == 0) { if (strcmp(type, "ZT2_Change") == 0) {
//如果当前流程目标下的变更单对应的影响分析如果仅包含技术工艺无其他部门则不需要触发此handler
char *itemId = NULL;
ITKCALL(AOM_ask_value_string(taskTag, "item_id", &itemId));
printf("id ===>%s\n", itemId);
string sql = "select \"principal\",\"section\" FROM CHINT_ECN_NOTIFICATION where \"result\"='是' and \"ecncode\"='";
sql.append(itemId).append("'");
int outputColumn1 = 0, outputValueCount1 = 0;
char*** outputValue1 = NULL;
printf("sql ===>%s\n", sql.c_str());
QuerySQLNoInputParam((char*)sql.c_str(), &outputColumn1, &outputValueCount1, &outputValue1);
printf("outputValueCount1 ===>%d\n", outputValueCount1);
boolean pro = true;
for (int i = 0; i < outputValueCount1; i++) {
if (tc_strcmp(outputValue1[i][1], "技术部") != 0 && tc_strcmp(outputValue1[i][1], "工艺部") != 0) {
pro = false;
break;
}
}
if (pro) {
continue;
}
//获取属性 查询数据库填写JSON //获取属性 查询数据库填写JSON
int unitCnt, processCnt = 0; int unitCnt, processCnt = 0;
char* changeType, *productModel, char* changeType, *productModel,
*productName, *fileName, *contractNo, *contractName, *productName, *fileName, *contractNo, *contractName,
*changeDateStr, **changeUnits, *itemId, *changeRequestNo, **processTypes; *changeDateStr, **changeUnits, *changeRequestNo, **processTypes;
AOM_ask_value_string(taskTag, "item_id", &itemId);
date_t changeDate; date_t changeDate;
AOM_ask_value_string(taskTag, "zt2_ChangeType", &changeType);//变更类型 ITKCALL(AOM_ask_value_string(taskTag, "zt2_ChangeType", &changeType));//变更类型
AOM_ask_value_string(taskTag, "zt2_ProductModel", &productModel);//产品型号 ITKCALL(AOM_ask_value_string(taskTag, "zt2_ProductModel", &productModel));//产品型号
AOM_ask_value_string(taskTag, "zt2_ProductName", &productName); // 产品名称 ITKCALL(AOM_ask_value_string(taskTag, "zt2_ProductName", &productName)); // 产品名称
AOM_ask_value_string(taskTag, "zt2_FileName", &fileName); // 文件代号及名称 ITKCALL(AOM_ask_value_string(taskTag, "zt2_FileName", &fileName)); // 文件代号及名称
AOM_ask_value_string(taskTag, "zt2_ContractNo", &contractNo); // 合同代号 ITKCALL(AOM_ask_value_string(taskTag, "zt2_ContractNo", &contractNo)); // 合同代号
AOM_ask_value_string(taskTag, "zt2_ContractName", &contractName); // 合同名称 ITKCALL(AOM_ask_value_string(taskTag, "zt2_ContractName", &contractName)); // 合同名称
AOM_ask_value_date(taskTag, "zt2_ChangeDate", &changeDate); // 变更实施日期 ITKCALL(AOM_ask_value_date(taskTag, "zt2_ChangeDate", &changeDate)); // 变更实施日期
AOM_ask_value_strings(taskTag, "zt2_ChangeUnit1",&unitCnt, &changeUnits); // 合同名称 ITKCALL(AOM_ask_value_strings(taskTag, "zt2_ChangeUnit1",&unitCnt, &changeUnits)); // 合同名称
AOM_ask_value_string(taskTag, "zt2_ChangRequestNo", &changeRequestNo); // 更改通知单号 ITKCALL(AOM_ask_value_string(taskTag, "zt2_ChangRequestNo", &changeRequestNo)); // 更改通知单号
AOM_ask_value_strings(taskTag, PROP_PROCESS, &processCnt, &processTypes); ITKCALL(AOM_ask_value_strings(taskTag, PROP_PROCESS, &processCnt, &processTypes));
cJSON* paramValue = cJSON_CreateObject(); cJSON* paramValue = cJSON_CreateObject();
//json添加字段 //json添加字段
/*S_ProductFeature 产品特性 字符串 A; B; C /*S_ProductFeature 产品特性 字符串 A; B; C
@ -273,7 +304,7 @@ int CHINT_ECN_SendOA(EPM_action_message_t msg) {
cJSON_AddStringToObject(paramValue, "S_Pcodename", fileName); cJSON_AddStringToObject(paramValue, "S_Pcodename", fileName);
cJSON_AddStringToObject(paramValue, "S_Contractcode", contractNo); cJSON_AddStringToObject(paramValue, "S_Contractcode", contractNo);
cJSON_AddStringToObject(paramValue, "S_ContractName", contractName); cJSON_AddStringToObject(paramValue, "S_ContractName", contractName);
DATE_date_to_string(changeDate, "%Y-%m-%d", &changeDateStr); ITKCALL(DATE_date_to_string(changeDate, "%Y-%m-%d", &changeDateStr));
cJSON_AddStringToObject(paramValue, "T_MaterialDate", changeDateStr); cJSON_AddStringToObject(paramValue, "T_MaterialDate", changeDateStr);
cJSON_AddStringToObject(paramValue, "S_FFBM", changeUnits[0]); cJSON_AddStringToObject(paramValue, "S_FFBM", changeUnits[0]);
//EH_DrawingInformation图样信息 //EH_DrawingInformation图样信息
@ -308,11 +339,12 @@ int CHINT_ECN_SendOA(EPM_action_message_t msg) {
WriteLog("组织之后的JSON\n %s\n", json_to_char); WriteLog("组织之后的JSON\n %s\n", json_to_char);
WriteLog("回传信息\n %s\n", returnMsg.c_str()); WriteLog("回传信息\n %s\n", returnMsg.c_str());
if (!returnMsg.empty()) { if (!returnMsg.empty()) {
EMH_store_error_s1(EMH_severity_user_error, EMH_USER_error_base, returnMsg.c_str()); ITKCALL(EMH_store_error_s1(EMH_severity_user_error, EMH_USER_error_base, returnMsg.c_str()));
} }
} }
} }
DisConnServer();
closeConn(); closeConn();
CloseLog(); CloseLog();
//string str = uploadMinio("uploadMinio.jar", log_file); //string str = uploadMinio("uploadMinio.jar", log_file);

@ -148,7 +148,11 @@ string readXmlId(string xmlMsg) {
tinyxml2::XMLDocument doc; tinyxml2::XMLDocument doc;
doc.Parse(U2G(xmlMsg.c_str())); doc.Parse(U2G(xmlMsg.c_str()));
tinyxml2::XMLElement* root = doc.RootElement(); tinyxml2::XMLElement* root = doc.RootElement();
//tinyxml2::XMLElement* fault = root->FirstChildElement("Fault");
tinyxml2::XMLElement* typeEle = root->FirstChildElement("TYPE"); tinyxml2::XMLElement* typeEle = root->FirstChildElement("TYPE");
if (typeEle == NULL) {
return "Fault";
}
tinyxml2::XMLElement* item = root->FirstChildElement("items"); tinyxml2::XMLElement* item = root->FirstChildElement("items");
char * type = (char*)typeEle->GetText(); char * type = (char*)typeEle->GetText();
if (strcmp(type, "S") == 0) { if (strcmp(type, "S") == 0) {
@ -159,8 +163,28 @@ string readXmlId(string xmlMsg) {
} }
return typeEle->GetText(); return typeEle->GetText();
} }
/*获取用户ID string readXmlEmailId(string xmlMsg) {
*/ printf("xmlMsg %s \n", xmlMsg.c_str());
tinyxml2::XMLDocument doc;
doc.Parse(U2G(xmlMsg.c_str()));
tinyxml2::XMLElement* root = doc.RootElement();
//tinyxml2::XMLElement* fault = root->FirstChildElement("Fault");
tinyxml2::XMLElement* typeEle = root->FirstChildElement("TYPE");
if (typeEle == NULL) {
return "Fault";
}
tinyxml2::XMLElement* item = root->FirstChildElement("items");
char * type = (char*)typeEle->GetText();
if (strcmp(type, "S") == 0) {
printf("1111");
tinyxml2::XMLElement* itemsCs = item->FirstChildElement("EH_HR_UserItems_CS");
tinyxml2::XMLElement* code = itemsCs->FirstChildElement("Email");
return code->GetText();
}
return typeEle->GetText();
}
/*获取用户ID
string getUserIdOA(string email, string url) { string getUserIdOA(string email, string url) {
CURL* curl; CURL* curl;
CURLcode res; CURLcode res;
@ -178,7 +202,7 @@ string getUserIdOA(string email, string url) {
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
string temp; //Email=string&Name=string %E9%82%B5%E9%AA%8F%E9%BD%90 string temp; //Email=string&Name=string %E9%82%B5%E9%AA%8F%E9%BD%90
temp.append("Email=&Name=%E9%82%B5%E4%BF%8A%E9%BD%90");// .append("Email=").append("&Name=邵俊齐"); //.append(email) temp.append("Email=&Name=%E9%82%B5%E4%BF%8A%E9%BD%90&UserUUID=");// .append("Email=").append("&Name=邵俊齐"); //.append(email)
printf("temp=%s\n", temp.c_str()); printf("temp=%s\n", temp.c_str());
const char* data = temp.c_str(); const char* data = temp.c_str();
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
@ -190,6 +214,79 @@ string getUserIdOA(string email, string url) {
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
printf("return Msg===>%s\n", str_json.c_str()); printf("return Msg===>%s\n", str_json.c_str());
return str_json; return str_json;
}*/
/*获取用户ID
*/
string getUserIdOA(string email, string url) {
CURL* curl;
CURLcode res;
std::stringstream out;
curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &out);
struct curl_slist* headers = NULL;
headers = curl_slist_append(headers, "item: 2100004876");
headers = curl_slist_append(headers, "wbs: ");
headers = curl_slist_append(headers, "factoryNo: ");
headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
string temp = "Email="; //Email=string&Name=string %E9%82%B5%E9%AA%8F%E9%BD%90
//temp.append("Email=&Name=%E9%82%B5%E4%BF%8A%E9%BD%90&UserUUID=");// .append("Email=").append("&Name=邵俊齐"); //.append(email)
temp.append(email).append("&Name=&UserUUID=");
printf("temp=%s\n", temp.c_str());
const char* data = temp.c_str();
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
res = curl_easy_perform(curl);
//curl_easy_strerror
printf("res=%d\n", res);
curl_slist_free_all(headers);
}
string str_json = out.str();
curl_easy_cleanup(curl);
printf("return Msg===>%s\n", str_json.c_str());
return str_json;
}
/*通过UUID获取用户ID
*/
string getUserIdOAUUID(string uuid, string url) {
CURL* curl;
CURLcode res;
std::stringstream out;
curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &out);
struct curl_slist* headers = NULL;
headers = curl_slist_append(headers, "item: 2100004876");
headers = curl_slist_append(headers, "wbs: ");
headers = curl_slist_append(headers, "factoryNo: ");
headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
string temp; //Email=string&Name=string %E9%82%B5%E9%AA%8F%E9%BD%90
temp.append("Email=&Name=&UserUUID=").append(uuid);// .append("Email=").append("&Name=邵俊齐"); //.append(email)
printf("temp=%s\n", temp.c_str());
const char* data = temp.c_str();
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
res = curl_easy_perform(curl);
//curl_easy_strerror
printf("res=%d\n", res);
curl_slist_free_all(headers);
}
string str_json = out.str();
curl_easy_cleanup(curl);
printf("return Msg===>%s\n", str_json.c_str());
return U2G(str_json.c_str());
} }
//½âÎöOAµÄ·µ»ØÐÅÏ¢ //½âÎöOAµÄ·µ»ØÐÅÏ¢
string readXmlMSG(string xmlMsg) { string readXmlMSG(string xmlMsg) {

@ -7,6 +7,8 @@ string callHttpGet(string url);
string sendOA(string sfid, string instanceId, string entityParamValues, string url); string sendOA(string sfid, string instanceId, string entityParamValues, string url);
string ecnSendOA(string instanceId, string entityParamValues, string url); string ecnSendOA(string instanceId, string entityParamValues, string url);
string readXmlId(string xmlMsg); string readXmlId(string xmlMsg);
string readXmlEmailId(string xmlMsg);
string getUserIdOA(string email, string url); string getUserIdOA(string email, string url);
string getUserIdOAUUID(string uuid, string url);
string getAssignFromYP(string url); string getAssignFromYP(string url);
void updatePiProject(string json, string url); void updatePiProject(string json, string url);

@ -102,12 +102,12 @@ void updateTemGxCode(tag_t processTag, map<string, TemGxBean> temGxMap) {
tag_t ebom_window = NULLTAG; tag_t ebom_window = NULLTAG;
tag_t bom_line = NULLTAG; tag_t bom_line = NULLTAG;
tag_t item_tag = NULLTAG, *c_line_tags; tag_t item_tag = NULLTAG, *c_line_tags;
(BOM_create_window(&ebom_window)); ITKCALL(BOM_create_window(&ebom_window));
tag_t* bvr_list = NULL; 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); 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工艺 //bom_line工艺
int c_line_count; int c_line_count;
ITKCALL(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags)); // 一级工序 ITKCALL(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags)); // 一级工序
@ -120,9 +120,9 @@ void updateTemGxCode(tag_t processTag, map<string, TemGxBean> temGxMap) {
if (temGxMap.count(gxbm1) > 0) { if (temGxMap.count(gxbm1) > 0) {
char* oldName; char* oldName;
TemGxBean temGxBean = temGxMap[gxbm1]; TemGxBean temGxBean = temGxMap[gxbm1];
AOM_lock(oneGxLine); ITKCALL(AOM_lock(oneGxLine));
AOM_set_value_string(oneGxLine, "bl_ZT2_FirstOPRevision_zt2_ClassificationCode", temGxBean.temGxCode.c_str()); ITKCALL(AOM_set_value_string(oneGxLine, "bl_ZT2_FirstOPRevision_zt2_ClassificationCode", temGxBean.temGxCode.c_str()));
AOM_save(oneGxLine); ITKCALL(AOM_save(oneGxLine));
AOM_unlock(oneGxLine); AOM_unlock(oneGxLine);
ITKCALL(AOM_ask_value_tag(oneGxLine, "bl_line_object", &oneGx)); ITKCALL(AOM_ask_value_tag(oneGxLine, "bl_line_object", &oneGx));
ITKCALL(ITEM_ask_item_of_rev(oneGx, &gxItem)); ITKCALL(ITEM_ask_item_of_rev(oneGx, &gxItem));
@ -326,27 +326,27 @@ void setZljyx(string gxbm2, string th,string lastId,string name,tag_t towGx) {
if (beans.size()>0) { if (beans.size()>0) {
tag_t *tableRow; tag_t *tableRow;
ITEM_create_item(NULL, objName.c_str(), "ZT2_QCHECK", NULL, &item, &rev); ITKCALL(ITEM_create_item(NULL, objName.c_str(), "ZT2_QCHECK", NULL, &item, &rev));
AOM_save(item); ITKCALL(AOM_save(item));
AOM_save(rev); ITKCALL(AOM_save(rev));
AOM_lock(item); ITKCALL(AOM_lock(item));
AOM_lock(rev); ITKCALL(AOM_lock(rev));
ITKCALL(AOM_insert_table_rows(rev, "zt2_QCHECKS", 0, beans.size(), &tableRow)); ITKCALL(AOM_insert_table_rows(rev, "zt2_QCHECKS", 0, beans.size(), &tableRow));
AOM_save(rev); ITKCALL(AOM_save(rev));
AOM_unlock(rev); ITKCALL(AOM_unlock(rev));
AOM_save(item); ITKCALL(AOM_save(item));
AOM_unlock(item); ITKCALL(AOM_unlock(item));
for (int i = 0; i < beans.size(); i++) { for (int i = 0; i < beans.size(); i++) {
tag_t table = tableRow[i]; tag_t table = tableRow[i];
AOM_lock(table); ITKCALL(AOM_lock(table));
AOM_set_value_string(table,"zt2_code", beans[i].no.c_str()); ITKCALL(AOM_set_value_string(table,"zt2_code", beans[i].no.c_str()));
AOM_set_value_string(table, "zt2_jjxbh", beans[i].mentNo.c_str()); ITKCALL(AOM_set_value_string(table, "zt2_jjxbh", beans[i].mentNo.c_str()));
AOM_set_value_string(table, "zt2_jyxmc", beans[i].mentDesc.c_str()); ITKCALL(AOM_set_value_string(table, "zt2_jyxmc", beans[i].mentDesc.c_str()));
AOM_set_value_string(table, "zt2_jyxsjjg", beans[i].mentResult.c_str()); ITKCALL(AOM_set_value_string(table, "zt2_jyxsjjg", beans[i].mentResult.c_str()));
AOM_save(table); ITKCALL(AOM_save(table));
AOM_unlock(table); ITKCALL(AOM_unlock(table));
} }
AOM_save(towGx); ITKCALL(AOM_save(towGx));
save_representation2(towGx, item, "ZT2_QualityCheckRelation"); save_representation2(towGx, item, "ZT2_QualityCheckRelation");
} }
@ -403,7 +403,7 @@ void getGxbmMap(tag_t processTag, map<string, tag_t>& gxDocMap, map<string, Time
ITKCALL(AOM_ask_value_tag(towGxLine, "bl_line_object", &towGx)); ITKCALL(AOM_ask_value_tag(towGxLine, "bl_line_object", &towGx));
ITKCALL(AOM_ask_value_string(towGx, "object_name", &name)); ITKCALL(AOM_ask_value_string(towGx, "object_name", &name));
//设置质检项 //设置质检项
//setZljyx(gxbm2,th, lastId, name, towGx); setZljyx(gxbm2,th, lastId, name, towGx);
if (flBeanMap.count(gxbm2) > 0) { if (flBeanMap.count(gxbm2) > 0) {
vector<FlBean> beansVec = flBeanMap[gxbm2]; vector<FlBean> beansVec = flBeanMap[gxbm2];
printf("beansVec===>%zd\n", beansVec.size()); printf("beansVec===>%zd\n", beansVec.size());

File diff suppressed because it is too large Load Diff

@ -122,9 +122,7 @@ tag_t getSapPart(tag_t designRevLine, tag_t designRev, string& errBuff, NodeBean
return designRev; return designRev;
} }
ITKCALL(AOM_ask_value_tags(designRev, "representation_for", &num, &mantrs)); ITKCALL(AOM_ask_value_tags(designRev, "representation_for", &num, &mantrs));
//printf("num===>%d\n", num);
//新增逻辑 获取图纸下最新版本的E物料对象 会存在多个版本的
vector<tag_t> parts; vector<tag_t> parts;
if (strstr(item_id, "1ZDB300000P") != NULL) { if (strstr(item_id, "1ZDB300000P") != NULL) {
map<string, tag_t> partsCcp; map<string, tag_t> partsCcp;
@ -137,6 +135,14 @@ tag_t getSapPart(tag_t designRevLine, tag_t designRev, string& errBuff, NodeBean
tag_t matnrItem; tag_t matnrItem;
ITEM_ask_item_of_rev(mantrs[i], &matnrItem); ITEM_ask_item_of_rev(mantrs[i], &matnrItem);
partsCcp[itemId] = matnrItem; partsCcp[itemId] = matnrItem;
//partsCcp.push_back();
/*if (parts.size()==0) {
parts.push_back(mantrs[i]);
}
else {
printf("===========\n");
bean.ccps.push_back(mantrs[i]);
}*/
} }
} }
map<string, tag_t>::iterator it; map<string, tag_t>::iterator it;
@ -171,29 +177,18 @@ tag_t getSapPart(tag_t designRevLine, tag_t designRev, string& errBuff, NodeBean
string s = it->first; string s = it->first;
tag_t partLast = partsCcp[s], partRevLast; tag_t partLast = partsCcp[s], partRevLast;
ITEM_ask_latest_rev(partLast, &partRevLast); ITEM_ask_latest_rev(partLast, &partRevLast);
if (parts.size() == 0) { //if (parts.size() == 0) {
//}
parts.push_back(partRevLast); parts.push_back(partRevLast);
} }
} }
//for (int i = 0; i < num; i++) {
// char* type, *zt2_ifpbom;
// AOM_ask_value_string(mantrs[i], "object_type", &type);
// AOM_ask_value_string(mantrs[i], "zt2_ifpbom", &zt2_ifpbom);
// if (strstr(type, "Part") != NULL && strcmp(zt2_ifpbom, "P") != 0) { //
// tag_t matnrItem, partRevLast;
// ITEM_ask_item_of_rev(mantrs[i], &matnrItem);
// ITEM_ask_latest_rev(matnrItem, &partRevLast);
// parts.push_back(partRevLast);
// }
//}
}
if (parts.size() == 1) { if (parts.size() == 1) {
return parts[0]; return parts[0];
} }
string searchId; string searchId;
char* id, *zt2_TYJNo, *spec, *zt2_Diagram; char* id, *zt2_TYJNo, *spec, *zt2_Diagram;
AOM_ask_value_string(designRev, "zt2_Diagram", &zt2_Diagram); ITKCALL(AOM_ask_value_string(designRev, "zt2_Diagram", &zt2_Diagram));
AOM_ask_value_string(designRev, "item_id", &id); ITKCALL(AOM_ask_value_string(designRev, "item_id", &id));
//AOM_ask_value_string(designRev, "zt2_DrawingNo", &zt2_DrawingNo); //AOM_ask_value_string(designRev, "zt2_DrawingNo", &zt2_DrawingNo);
/*if (strcmp(zt2_DrawingNo,"") != 0 && strcmp(zt2_DrawingNo, id) != 0) { /*if (strcmp(zt2_DrawingNo,"") != 0 && strcmp(zt2_DrawingNo, id) != 0) {
searchId = zt2_DrawingNo; searchId = zt2_DrawingNo;
@ -201,8 +196,8 @@ tag_t getSapPart(tag_t designRevLine, tag_t designRev, string& errBuff, NodeBean
else {*/ else {*/
searchId = id; searchId = id;
//} //}
AOM_ask_value_string(designRevLine, "ZT2_TYSpecifications", &zt2_TYJNo); ITKCALL(AOM_ask_value_string(designRevLine, "ZT2_TYSpecifications", &zt2_TYJNo));
AOM_ask_value_string(designRev, "zt2_Specifications", &spec); ITKCALL(AOM_ask_value_string(designRev, "zt2_Specifications", &spec));
if (strcmp(zt2_TYJNo, "") != 0) { if (strcmp(zt2_TYJNo, "") != 0) {
string qryVal; string qryVal;
tag_t query = NULLTAG, *tags; tag_t query = NULLTAG, *tags;
@ -218,7 +213,7 @@ tag_t getSapPart(tag_t designRevLine, tag_t designRev, string& errBuff, NodeBean
tag_t rev = tags[t]; tag_t rev = tags[t];
if (isTcm(rev)) { if (isTcm(rev)) {
char* zt2_MaterialNo; char* zt2_MaterialNo;
AOM_ask_value_string(rev, "zt2_MaterialNo", &zt2_MaterialNo); ITKCALL(AOM_ask_value_string(rev, "zt2_MaterialNo", &zt2_MaterialNo));
map_revs[zt2_MaterialNo] = rev; map_revs[zt2_MaterialNo] = rev;
} }
} }
@ -291,13 +286,13 @@ tag_t getSapPart(tag_t designRevLine, tag_t designRev, string& errBuff, NodeBean
} }
/** /**
* DBOM * DBOM
* @param bom_line DBOM * @param bom_line DBOM
* @param bean BOM * @param bean BOM
* @param errBuff * @param errBuff
* @param designRev * @param designRev
* @param flagMat * @param flagMat
*/ */
void askLineVal(NodeBean& bean, tag_t bom_line, tag_t designRev, string& errBuff, boolean &flagMat) { void askLineVal(NodeBean& bean, tag_t bom_line, tag_t designRev, string& errBuff, boolean &flagMat) {
char* bl_quantity, *bl_plmxml_occ_xform, *bl_sequence_no, *sffc; char* bl_quantity, *bl_plmxml_occ_xform, *bl_sequence_no, *sffc;
ITKCALL(AOM_ask_value_string(bom_line, "bl_sequence_no", &bl_sequence_no)); ITKCALL(AOM_ask_value_string(bom_line, "bl_sequence_no", &bl_sequence_no));
@ -404,12 +399,12 @@ void askLineVal(NodeBean& bean, tag_t bom_line, tag_t designRev, string& errBuff
} }
} }
/** /**
* *
* @param bom_line DBOM * @param bom_line DBOM
* @param materialutilization * @param materialutilization
* @param errMessage * @param errMessage
* @param desginRev * @param desginRev
*/ */
string getTyjZl(tag_t bom_line, string materialutilization, tag_t desginRev, string &errMessage) { string getTyjZl(tag_t bom_line, string materialutilization, tag_t desginRev, string &errMessage) {
char *ZT2_TYSpecifications, *ZT2_TYWeight, *item_id; char *ZT2_TYSpecifications, *ZT2_TYWeight, *item_id;
AOM_ask_value_string(bom_line, "item_id", &item_id); AOM_ask_value_string(bom_line, "item_id", &item_id);
@ -476,13 +471,13 @@ void getAllXnj(vector<tag_t> xnzjbVec, int maxNum, int &xxt,
void getAllXnj(vector<tag_t> xnzjbVec, int maxNum, int &xxt, void getAllXnj(vector<tag_t> xnzjbVec, int maxNum, int &xxt,
string& errBuff, string dbName, NodeBean& pBean, int qtyXn, vector<string> idVector); string& errBuff, string dbName, NodeBean& pBean, int qtyXn, vector<string> idVector);
/** /**
* DBOM * DBOM
* @param bom_line DBOM * @param bom_line DBOM
* @param pBean BOM * @param pBean BOM
* @param errBuff * @param errBuff
* @param dbName * @param dbName
* @param loginUserId * @param loginUserId
*/ */
void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName, char *loginUserId) void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName, char *loginUserId)
{ {
int c_line_count; int c_line_count;
@ -686,13 +681,13 @@ void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName
getAllXnj(xnzjbVec, maxNum, xxt, errBuff, dbName, pBean, 1, loginUserId); getAllXnj(xnzjbVec, maxNum, xxt, errBuff, dbName, pBean, 1, loginUserId);
} }
/** /**
* DBOMEBOMBOM使 * DBOMEBOMBOM使
* @param bom_line DBOM * @param bom_line DBOM
* @param pBean EBOM * @param pBean EBOM
* @param errBuff * @param errBuff
* @param dbName * @param dbName
* @param idVector DEBOM * @param idVector DEBOM
*/ */
void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName, vector<string> idVector) void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName, vector<string> idVector)
{ {
int c_line_count; int c_line_count;
@ -875,15 +870,15 @@ void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName
getAllXnj(xnzjbVec, maxNum, xxt, errBuff, dbName, pBean, 1, idVector); getAllXnj(xnzjbVec, maxNum, xxt, errBuff, dbName, pBean, 1, idVector);
} }
/** /**
* *
* @param xnzjbVec * @param xnzjbVec
* @param maxNum * @param maxNum
* @param xxt * @param xxt
* @param errBuff * @param errBuff
* @param dbName * @param dbName
* @param qtyXn * @param qtyXn
* @param idVector ID * @param idVector ID
*/ */
void getAllXnj(vector<tag_t> xnzjbVec, int maxNum, int &xxt, void getAllXnj(vector<tag_t> xnzjbVec, int maxNum, int &xxt,
string& errBuff, string dbName, NodeBean& pBean, int qtyXn, vector<string> idVector) { string& errBuff, string dbName, NodeBean& pBean, int qtyXn, vector<string> idVector) {
@ -942,15 +937,15 @@ void getAllXnj(vector<tag_t> xnzjbVec, int maxNum, int &xxt,
} }
} }
/** /**
* *
* @param xnzjbVec * @param xnzjbVec
* @param maxNum * @param maxNum
* @param xxt * @param xxt
* @param errBuff * @param errBuff
* @param dbName * @param dbName
* @param qtyXn * @param qtyXn
* @param loginUserId ID * @param loginUserId ID
*/ */
void getAllXnj(vector<tag_t> xnzjbVec, int maxNum, int &xxt, void getAllXnj(vector<tag_t> xnzjbVec, int maxNum, int &xxt,
string& errBuff, string dbName, NodeBean& pBean, int qtyXn, char *loginUserId) { string& errBuff, string dbName, NodeBean& pBean, int qtyXn, char *loginUserId) {
@ -1061,19 +1056,19 @@ boolean firstRevision(tag_t designRev, tag_t mantr) {
} }
} }
/** /**
* DBOM EBOM * DBOM EBOM
* @param topBean BOM * @param topBean BOM
*/ */
map<string, int> getDBomMesg(NodeBean topBean) { map<string, int> getDBomMesg(NodeBean topBean) {
printf("getDBomMesg\n");
vector<NodeBean> childs = topBean.childs; vector<NodeBean> childs = topBean.childs;
map<string, int> dMap; map<string, int> dMap;
for (int i = 0; i < childs.size(); i++) { for (int i = 0; i < childs.size(); i++) {
NodeBean cBean = childs[i]; NodeBean cBean = childs[i];
char *matnrNo, *uid; char *matnrNo, *uid;
AOM_ask_value_string(cBean.mantr, MATERIALNO, &matnrNo); ITKCALL(AOM_ask_value_string(cBean.mantr, MATERIALNO, &matnrNo));
ITK__convert_tag_to_uid(cBean.mantr, &uid); ITK__convert_tag_to_uid(cBean.mantr, &uid);
printf("uid[%s]\n", uid); printf("uid[%s]matnrNo[%s]\n", uid, matnrNo);
printf("matnrNo[%s]\n", matnrNo);
int qtyPXn = 1; int qtyPXn = 1;
string cnt = cBean.bl_quantity; string cnt = cBean.bl_quantity;
if (strcmp(cnt.c_str(), "") != 0) { if (strcmp(cnt.c_str(), "") != 0) {
@ -1089,11 +1084,12 @@ map<string, int> getDBomMesg(NodeBean topBean) {
return dMap; return dMap;
} }
/** /**
* EBOM DBOM * EBOM DBOM
* @param mantrRev E * @param mantrRev E
* @param flag bom * @param flag bom
*/ */
map<string, int> getBomMsg(tag_t mantrRev, bool& flag) { map<string, int> getBomMsg(tag_t mantrRev, bool& flag) {
printf("getBomMsg\n");
map<string, int> bomMsgMap; map<string, int> bomMsgMap;
tag_t* bvr_list = NULL, bom_line, ebom_window; tag_t* bvr_list = NULL, bom_line, ebom_window;
int bvr_count = 0; int bvr_count = 0;
@ -1114,10 +1110,10 @@ map<string, int> getBomMsg(tag_t mantrRev, bool& flag) {
tag_t c_Rev; tag_t c_Rev;
char *matnrNo, *cnt; char *matnrNo, *cnt;
ITKCALL(AOM_ask_value_tag(c_line_tags[t], "bl_line_object", &c_Rev)); ITKCALL(AOM_ask_value_tag(c_line_tags[t], "bl_line_object", &c_Rev));
AOM_ask_value_string(c_Rev, "zt2_MaterialNo", &matnrNo); ITKCALL(AOM_ask_value_string(c_Rev, "zt2_MaterialNo", &matnrNo));
printf("zt2_MaterialNo===>%s\n", matnrNo); printf("zt2_MaterialNo===>%s\n", matnrNo);
int qtyPXn = 1; int qtyPXn = 1;
AOM_ask_value_string(c_line_tags[t], "bl_quantity", &cnt); ITKCALL(AOM_ask_value_string(c_line_tags[t], "bl_quantity", &cnt));
if (strcmp(cnt, "") != 0) { if (strcmp(cnt, "") != 0) {
qtyPXn = atoi(cnt); qtyPXn = atoi(cnt);
} }
@ -1128,14 +1124,14 @@ map<string, int> getBomMsg(tag_t mantrRev, bool& flag) {
bomMsgMap[matnrNo] = qtyPXn; bomMsgMap[matnrNo] = qtyPXn;
} }
} }
BOM_close_window(ebom_window); ITKCALL(BOM_close_window(ebom_window));
return bomMsgMap; return bomMsgMap;
} }
/** /**
* EbomDbom * EbomDbom
* @param dMap D - * @param dMap D -
* @param eMap E - * @param eMap E -
*/ */
boolean combEAndDbom(map<string, int> dMap, map<string, int> eMap) { boolean combEAndDbom(map<string, int> dMap, map<string, int> eMap) {
map<string, int>::iterator it; map<string, int>::iterator it;
//名称模糊匹配 //名称模糊匹配
@ -1152,18 +1148,18 @@ boolean combEAndDbom(map<string, int> dMap, map<string, int> eMap) {
return false; return false;
} }
/** /**
* *
*/ */
void TCMAndOwner(tag_t matnrTop) { void TCMAndOwner(tag_t matnrTop) {
int num = 0, revNum; int num = 0, revNum;
tag_t *mantrsAs, dsuser, *structure_revisions; tag_t *mantrsAs, dsuser, *structure_revisions;
AOM_ask_value_tags(matnrTop, "TC_Is_Represented_By", &num, &mantrsAs); ITKCALL(AOM_ask_value_tags(matnrTop, "TC_Is_Represented_By", &num, &mantrsAs));
AOM_ask_value_tag(mantrsAs[0], "owning_user", &dsuser); ITKCALL(AOM_ask_value_tag(mantrsAs[0], "owning_user", &dsuser));
tag_t defGroup; tag_t defGroup;
ITKCALL(AOM_ask_value_tag(dsuser, "default_group", &defGroup)); ITKCALL(AOM_ask_value_tag(dsuser, "default_group", &defGroup));
ITKCALL(AOM_set_ownership(matnrTop, dsuser, defGroup)); ITKCALL(AOM_set_ownership(matnrTop, dsuser, defGroup));
if (num > 0) { if (num > 0) {
AOM_ask_value_tags(matnrTop, "structure_revisions", &revNum, &structure_revisions); ITKCALL(AOM_ask_value_tags(matnrTop, "structure_revisions", &revNum, &structure_revisions));
if (revNum > 0) { if (revNum > 0) {
ITKCALL(AOM_set_ownership(structure_revisions[0], dsuser, defGroup)); ITKCALL(AOM_set_ownership(structure_revisions[0], dsuser, defGroup));
} }
@ -1172,16 +1168,17 @@ void TCMAndOwner(tag_t matnrTop) {
proProcessCreate(matnrTop, process_name);*/ proProcessCreate(matnrTop, process_name);*/
} }
/** /**
* DBOMEBOM * DBOMEBOM
* @param topBean BOM * @param topBean BOM
* @param isTop * @param isTop
* @param hasChange * @param hasChange
* @param saveAsMap uid - * @param saveAsMap uid -
*/ */
tag_t saveAsMaterial(NodeBean topBean, boolean isTop, string &hasChange, map<string, tag_t>& saveAsMap) { tag_t saveAsMaterial(NodeBean topBean, boolean isTop, string &hasChange, map<string, tag_t>& saveAsMap) {
tag_t mantr = topBean.mantr;//升版之前的E物料 tag_t mantr = topBean.mantr;//升版之前的E物料
char* oldUid; char* oldUid;
ITK__convert_tag_to_uid(mantr, &oldUid); ITK__convert_tag_to_uid(mantr, &oldUid);
printf("saveAsMaterial:%s\n", oldUid);
if (saveAsMap.count(oldUid) > 0) { if (saveAsMap.count(oldUid) > 0) {
return saveAsMap[oldUid]; return saveAsMap[oldUid];
} }
@ -1191,8 +1188,8 @@ tag_t saveAsMaterial(NodeBean topBean, boolean isTop, string &hasChange, map<str
if (flag) { if (flag) {
return mantr; return mantr;
} }
printf("dBomMesg[%d]", dBomMesg.size()); printf("dBomMesg[%d]\n", dBomMesg.size());
printf("eBomMesg[%d]", eBomMesg.size()); printf("eBomMesg[%d]\n", eBomMesg.size());
boolean needAs = false; boolean needAs = false;
if (dBomMesg.size() != eBomMesg.size()) { if (dBomMesg.size() != eBomMesg.size()) {
//升版 + 发布 //升版 + 发布
@ -1206,6 +1203,7 @@ tag_t saveAsMaterial(NodeBean topBean, boolean isTop, string &hasChange, map<str
printf("=======TEST======\n"); printf("=======TEST======\n");
//升版并发布 没发布的产成品直接更新 //升版并发布 没发布的产成品直接更新
if (isTcm(mantr) && isBomViewTcm(mantr)) { if (isTcm(mantr) && isBomViewTcm(mantr)) {
POM_AM__set_application_bypass(true);
ITKCALL(ITEM_copy_rev(mantr, NULL, &mantr)); ITKCALL(ITEM_copy_rev(mantr, NULL, &mantr));
TCMAndOwner(mantr); TCMAndOwner(mantr);
if (isTop) { if (isTop) {
@ -1216,16 +1214,13 @@ tag_t saveAsMaterial(NodeBean topBean, boolean isTop, string &hasChange, map<str
} }
return mantr; return mantr;
} }
void createEbom(NodeBean topBean, boolean isTop, string &hasChange, map<string, tag_t>& saveAsMap) string createEbom(NodeBean topBean, boolean isTop, string &hasChange, map<string, tag_t>& saveAsMap)
{ {
tag_t ebom_window = NULLTAG; printf("createEbom start\n");
string errMsg = "";
tag_t bom_line = NULLTAG; tag_t bom_line = NULLTAG;
vector<NodeBean> childs = topBean.childs; vector<NodeBean> childs = topBean.childs;
//printf("子line数量 %d \n", childs.size()); //printf("子line数量 %d \n", childs.size());
tag_t desBean = topBean.designRev;
char* id;
AOM_ask_value_string(desBean, "item_id", &id);
printf("id %s \n", id);
tag_t mantr = topBean.mantr; tag_t mantr = topBean.mantr;
//判断是否最初版本 不是就和当前的EBOM进行比较 //判断是否最初版本 不是就和当前的EBOM进行比较
//相同就跳过不升版、不同就升版、只比较数量 //相同就跳过不升版、不同就升版、只比较数量
@ -1234,42 +1229,62 @@ void createEbom(NodeBean topBean, boolean isTop, string &hasChange, map<string,
boolean flagChange = true; boolean flagChange = true;
if (mantr != NULLTAG && childs.size() > 0) { if (mantr != NULLTAG && childs.size() > 0) {
printf("-----"); char* id = NULL, * object_string = NULL;
ITKCALL(AOM_ask_value_string(mantr, "object_string", &object_string));
printf("createEbom%s\n", object_string);
tag_t desBean = topBean.designRev;
ITKCALL(AOM_ask_value_string(desBean, "item_id", &id));
printf("designRev%s \n", id);
tag_t* bvr_list = NULL; tag_t* bvr_list = NULL;
int bvr_count; int bvr_count;
ITKCALL(ITEM_rev_list_bom_view_revs(mantr, &bvr_count, &bvr_list)); ITKCALL(ITEM_rev_list_bom_view_revs(mantr, &bvr_count, &bvr_list));
//没有BOM视图创建 //没有BOM视图创建
if (bvr_count == 0) { if (bvr_count == 0) {
tag_t newView, newViewBvr, pitem, dsuser; tag_t newView, newViewBvr, pitem, dsuser;
ITEM_ask_item_of_rev(mantr, &pitem); ITKCALL(ITEM_ask_item_of_rev(mantr, &pitem));
ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView)); ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView));
AOM_save(newView); ITKCALL(AOM_save(newView));
ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, mantr, &newViewBvr)); ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, mantr, &newViewBvr));
AOM_save(newViewBvr); ITKCALL(AOM_save(newViewBvr));
AOM_save(mantr); ITKCALL(AOM_save(mantr));
AOM_ask_value_tag(desBean, "owning_user", &dsuser); ITKCALL(AOM_ask_value_tag(desBean, "owning_user", &dsuser));
tag_t defGroup; tag_t defGroup;
ITKCALL(AOM_ask_value_tag(dsuser, "default_group", &defGroup)); ITKCALL(AOM_ask_value_tag(dsuser, "default_group", &defGroup));
ITKCALL(AOM_set_ownership(newView, dsuser, defGroup)); ITKCALL(AOM_set_ownership(newView, dsuser, defGroup));
ITKCALL(AOM_set_ownership(newViewBvr, dsuser, defGroup)); ITKCALL(AOM_set_ownership(newViewBvr, dsuser, defGroup));
} }
//变更当前BOM层级 已发布的不需要更改
if (bvr_count > 0) {
char* date_released = NULL;
ITKCALL(AOM_UIF_ask_value(bvr_list[0], "date_released", &date_released));
//ITKCALL(AOM_ask_value_date(bvr_list[0], "date_released", &date_released));
printf("bvr_list%d%s \n", bvr_count, date_released);
if (date_released && tc_strlen(date_released) > 0) {
flagChange = false;
char* released = NULL;
ITKCALL(AOM_UIF_ask_value(mantr, "date_released", &released));
printf("released%s \n", released);
if (!released || tc_strlen(released) == 0) {
errMsg.append(object_string).append("");
printf("errMsg%s \n", errMsg.c_str());
return errMsg;
}
}
}
if (flagChange) {
tag_t ebom_window = NULLTAG;
ITKCALL(BOM_create_window(&ebom_window)); ITKCALL(BOM_create_window(&ebom_window));
//移除原来的 //移除原来的
char*topUidTest;
ITK__convert_tag_to_uid(mantr, &topUidTest);
printf("topUidTest =======> %s \n", topUidTest);
ITKCALL(BOM_set_window_top_line(ebom_window, NULL, mantr, NULLTAG, &bom_line)); ITKCALL(BOM_set_window_top_line(ebom_window, NULL, mantr, NULLTAG, &bom_line));
//变更当前BOM层级 已发布的不需要更改
if (flagChange) {
if (bvr_count > 0) { if (bvr_count > 0) {
int c_line_count; int c_line_count;
tag_t* c_line_tags; tag_t* c_line_tags;
ITKCALL(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags)); ITKCALL(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags));
for (int t = 0; t < c_line_count; t++) { for (int t = 0; t < c_line_count; t++) {
char* val; char* val;
AOM_ask_value_string(c_line_tags[t], "bl_occ_zt2_DtoE", &val); ITKCALL(AOM_ask_value_string(c_line_tags[t], "bl_occ_zt2_DtoE", &val));
if (strcmp(val, "DBOM转换") == 0) { if (strcmp(val, "DBOM转换") == 0) {
BOM_line_cut(c_line_tags[t]); ITKCALL(BOM_line_cut(c_line_tags[t]));
} }
} }
} }
@ -1277,8 +1292,12 @@ void createEbom(NodeBean topBean, boolean isTop, string &hasChange, map<string,
NodeBean cBean = childs[i]; NodeBean cBean = childs[i];
if (cBean.mantr != NULLTAG) { if (cBean.mantr != NULLTAG) {
tag_t cLine; tag_t cLine;
char* bom_string = NULL;
ITKCALL(AOM_ask_value_string(bom_line, "object_string", &bom_string));
printf("bom_line%s\n", bom_string);
ITKCALL(BOM_line_add(bom_line, NULL, cBean.mantr, NULL, &cLine)); ITKCALL(BOM_line_add(bom_line, NULL, cBean.mantr, NULL, &cLine));
AOM_lock(cLine); if (cLine != NULLTAG) {
ITKCALL(AOM_lock(cLine));
if (cBean.packNum > 0) { if (cBean.packNum > 0) {
string num = cBean.bl_quantity; string num = cBean.bl_quantity;
num = to_string(cBean.topNum / cBean.packNum); num = to_string(cBean.topNum / cBean.packNum);
@ -1290,37 +1309,43 @@ void createEbom(NodeBean topBean, boolean isTop, string &hasChange, map<string,
} }
AOM_set_value_string(cLine, "bl_plmxml_occ_xform", cBean.bl_plmxml_occ_xform); ITKCALL(AOM_set_value_string(cLine, "bl_plmxml_occ_xform", cBean.bl_plmxml_occ_xform));
AOM_set_value_string(cLine, "bl_sequence_no", cBean.bl_sequence_no.c_str()); ITKCALL(AOM_set_value_string(cLine, "bl_sequence_no", cBean.bl_sequence_no.c_str()));
ITKCALL(AOM_set_value_string(cLine, "bl_occ_zt2_DtoE", "DBOM转换")); ITKCALL(AOM_set_value_string(cLine, "bl_occ_zt2_DtoE", "DBOM转换"));
AOM_save(cLine); ITKCALL(AOM_save(cLine));
//最后unlock //最后unlock
AOM_unlock(cLine); ITKCALL(AOM_unlock(cLine));
AOM_refresh(cLine, FALSE); ITKCALL(AOM_refresh(cLine, FALSE));
}
else {
printf("搭建BOM失败\n");
}
} }
else { else {
printf("eeeeee\n"); printf("eeeeee\n");
} }
} }
ITKCALL(BOM_save_window(ebom_window)); ITKCALL(BOM_save_window(ebom_window));
ITKCALL(BOM_close_window(ebom_window));
} }
BOM_close_window(ebom_window); printf("eeeeee2\n");
for (int i = 0; i < childs.size(); i++) { for (int i = 0; i < childs.size(); i++) {
NodeBean cBean = childs[i]; NodeBean cBean = childs[i];
createEbom(cBean, false, hasChange, saveAsMap); errMsg.append(createEbom(cBean, false, hasChange, saveAsMap));
} }
} }
else { else {
printf("topBean.mantr == NULLTAG\n"); printf("topBean.mantr == NULLTAG\n");
} }
printf("eeerrMsg:%s\n", errMsg.c_str());
return errMsg;
} }
void copyEBomLine(tag_t matnrTop, tag_t otherPbom) { void copyEBomLine(tag_t matnrTop, tag_t otherPbom) {
tag_t ebom_window, ebom_window2, *bvr_list, *bvr_list2, bom_line, bom_line2, *c_line_tags, *c_line_tags2; tag_t ebom_window, ebom_window2, *bvr_list, *bvr_list2, bom_line, bom_line2, *c_line_tags, *c_line_tags2;
int bvr_count = 0, bvr_count2 = 0, c_line_count, c_line_count2; int bvr_count = 0, bvr_count2 = 0, c_line_count, c_line_count2;
(BOM_create_window(&ebom_window)); ITKCALL(BOM_create_window(&ebom_window));
(ITEM_rev_list_bom_view_revs(matnrTop, &bvr_count, &bvr_list)); ITKCALL(ITEM_rev_list_bom_view_revs(matnrTop, &bvr_count, &bvr_list));
printf("bvr_count=%d \n", bvr_count); printf("bvr_count=%d \n", bvr_count);
if (bvr_count == 0) { if (bvr_count == 0) {
//errBuff.append("不存在EBOM请检查\n"); //errBuff.append("不存在EBOM请检查\n");
@ -1331,50 +1356,50 @@ void copyEBomLine(tag_t matnrTop, tag_t otherPbom) {
ITKCALL(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags)); ITKCALL(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags));
(ITEM_rev_list_bom_view_revs(otherPbom, &bvr_count2, &bvr_list2)); ITKCALL(ITEM_rev_list_bom_view_revs(otherPbom, &bvr_count2, &bvr_list2));
if (bvr_count2 == 0) { if (bvr_count2 == 0) {
tag_t newView, newViewBvr, pitem; tag_t newView, newViewBvr, pitem;
ITEM_ask_item_of_rev(otherPbom, &pitem); ITKCALL(ITEM_ask_item_of_rev(otherPbom, &pitem));
ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView)); ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView));
AOM_save(newView); ITKCALL(AOM_save(newView));
ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, otherPbom, &newViewBvr)); ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, otherPbom, &newViewBvr));
AOM_save(newViewBvr); ITKCALL(AOM_save(newViewBvr));
AOM_save(otherPbom); ITKCALL(AOM_save(otherPbom));
int num = 0; int num = 0;
tag_t dsuser, *structure_revisions, *bom_view_tags, *mantrs; tag_t dsuser, *structure_revisions, *bom_view_tags, *mantrs;
ITKCALL(AOM_ask_value_tags(otherPbom, "TC_Is_Represented_By", &num, &mantrs)); ITKCALL(AOM_ask_value_tags(otherPbom, "TC_Is_Represented_By", &num, &mantrs));
if (num == 1) { if (num == 1) {
AOM_ask_value_tag(mantrs[0], "owning_user", &dsuser); ITKCALL(AOM_ask_value_tag(mantrs[0], "owning_user", &dsuser));
tag_t defGroup; tag_t defGroup;
ITKCALL(AOM_ask_value_tag(dsuser, "default_group", &defGroup)); ITKCALL(AOM_ask_value_tag(dsuser, "default_group", &defGroup));
ITKCALL(AOM_set_ownership(newView, dsuser, defGroup)); ITKCALL(AOM_set_ownership(newView, dsuser, defGroup));
ITKCALL(AOM_set_ownership(newViewBvr, dsuser, defGroup)); ITKCALL(AOM_set_ownership(newViewBvr, dsuser, defGroup));
} }
//return; //return;
(ITEM_rev_list_bom_view_revs(otherPbom, &bvr_count2, &bvr_list2)); ITKCALL(ITEM_rev_list_bom_view_revs(otherPbom, &bvr_count2, &bvr_list2));
} }
(BOM_create_window(&ebom_window2)); ITKCALL(BOM_create_window(&ebom_window2));
(BOM_set_window_top_line_bvr(ebom_window2, bvr_list2[0], &bom_line2)); //顶层bom获取 ITKCALL(BOM_set_window_top_line_bvr(ebom_window2, bvr_list2[0], &bom_line2)); //顶层bom获取
ITKCALL(BOM_line_ask_all_child_lines(bom_line2, &c_line_count2, &c_line_tags2)); ITKCALL(BOM_line_ask_all_child_lines(bom_line2, &c_line_count2, &c_line_tags2));
for (int i = 0; i < c_line_count2; i++) { for (int i = 0; i < c_line_count2; i++) {
BOM_line_cut(c_line_tags2[i]); ITKCALL(BOM_line_cut(c_line_tags2[i]));
} }
for (int i = 0; i < c_line_count; i++) { for (int i = 0; i < c_line_count; i++) {
tag_t newChild; char *bl_seqNo; tag_t newChild; char *bl_seqNo;
ITKCALL(BOM_line_copy(bom_line2, c_line_tags[i], NULLTAG, &newChild)); ITKCALL(BOM_line_copy(bom_line2, c_line_tags[i], NULLTAG, &newChild));
AOM_ask_value_string(c_line_tags[i], "bl_sequence_no", &bl_seqNo); ITKCALL(AOM_ask_value_string(c_line_tags[i], "bl_sequence_no", &bl_seqNo));
AOM_lock(newChild); ITKCALL(AOM_lock(newChild));
AOM_set_value_string(newChild, "bl_sequence_no", bl_seqNo); ITKCALL(AOM_set_value_string(newChild, "bl_sequence_no", bl_seqNo));
AOM_save(newChild); ITKCALL(AOM_save(newChild));
//最后unlock //最后unlock
AOM_unlock(newChild); ITKCALL(AOM_unlock(newChild));
} }
//tag_t newChild; //tag_t newChild;
//ITKCALL(BOM_line_copy(bom_line2, c_line_tags[i], NULLTAG, &newChild)); //ITKCALL(BOM_line_copy(bom_line2, c_line_tags[i], NULLTAG, &newChild));
ITKCALL(BOM_save_window(ebom_window2)); ITKCALL(BOM_save_window(ebom_window2));
BOM_close_window(ebom_window2); ITKCALL(BOM_close_window(ebom_window2));
BOM_close_window(ebom_window); ITKCALL(BOM_close_window(ebom_window));
} }
//获取分类属性 判断是否整除 //获取分类属性 判断是否整除
int getClassValByTop(tag_t item, string& errMessage) { int getClassValByTop(tag_t item, string& errMessage) {
@ -1436,16 +1461,16 @@ int getClassValByTop(tag_t item, string& errMessage) {
return num; return num;
} }
/** /**
* DBOMEBOM * DBOMEBOM
*/ */
int DbomToEMethod(void* returnValue) { int DbomToEMethod(void* returnValue) {
int ifail = ITK_ok; int ifail = ITK_ok;
char *sql = NULL, *revUid; char *sql = NULL, *revUid;
tag_t designRev, item; tag_t designRev, item;
ITKCALL(ifail = USERARG_get_string_argument(&revUid)); ITKCALL(ifail = USERARG_get_string_argument(&revUid));
ITK__convert_uid_to_tag(revUid, &designRev); ITK__convert_uid_to_tag(revUid, &designRev);
ITEM_ask_item_of_rev(designRev, &item); ITKCALL(ITEM_ask_item_of_rev(designRev, &item));
ITEM_ask_latest_rev(item, &designRev); ITKCALL(ITEM_ask_latest_rev(item, &designRev));
if (open("PLMUser", "PLMUser", "BDP2020", "10.128.20.35")) { if (open("PLMUser", "PLMUser", "BDP2020", "10.128.20.35")) {
printf("链接SQLSERVER失败\n"); printf("链接SQLSERVER失败\n");
} }
@ -1457,12 +1482,12 @@ int DbomToEMethod(void* returnValue) {
tag_t ebom_window = NULLTAG; tag_t ebom_window = NULLTAG;
tag_t bom_line = NULLTAG; tag_t bom_line = NULLTAG;
tag_t item_tag = NULLTAG, *c_line_tags; tag_t item_tag = NULLTAG, *c_line_tags;
(BOM_create_window(&ebom_window)); ITKCALL(BOM_create_window(&ebom_window));
tag_t* bvr_list = NULL; 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); 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获取
printf("顶层bom获取\n"); printf("顶层bom获取\n");
//(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags)); //(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags));
@ -1473,7 +1498,7 @@ int DbomToEMethod(void* returnValue) {
xsLen = getClassValByTop(designRev, errBuff); xsLen = getClassValByTop(designRev, errBuff);
int url_num = 0; int url_num = 0;
char** url_vals = NULL; char** url_vals = NULL;
PREF_ask_char_values("database_tc", &url_num, &url_vals); ITKCALL(PREF_ask_char_values("database_tc", &url_num, &url_vals));
string url = url_vals[0]; string url = url_vals[0];
url.append("/").append(url_vals[2]); url.append("/").append(url_vals[2]);
@ -1487,7 +1512,7 @@ int DbomToEMethod(void* returnValue) {
string dbName; string dbName;
int url_num2 = 0; int url_num2 = 0;
char** url_vals2 = NULL; char** url_vals2 = NULL;
PREF_ask_char_values("CHINT_MATERIAL_RAW", &url_num2, &url_vals2); ITKCALL(PREF_ask_char_values("CHINT_MATERIAL_RAW", &url_num2, &url_vals2));
for (int t = 0; t < url_num2; t++) { for (int t = 0; t < url_num2; t++) {
vector<string> vec; vector<string> vec;
Split(url_vals2[t], ":", vec); Split(url_vals2[t], ":", vec);
@ -1497,18 +1522,26 @@ int DbomToEMethod(void* returnValue) {
} }
char *loginUserId; char *loginUserId;
printf("dbName===%s\n", dbName.c_str()); printf("dbName===%s\n", dbName.c_str());
POM_get_user_id(&loginUserId); ITKCALL(POM_get_user_id(&loginUserId));
recyReadBom(bom_line, topBean, errBuff, dbName, loginUserId); recyReadBom(bom_line, topBean, errBuff, dbName, loginUserId);
DisConnServer(); DisConnServer();
BOM_close_window(ebom_window); ITKCALL(BOM_close_window(ebom_window));
//搭建BOM //搭建BOM
POM_AM__set_application_bypass(true); POM_AM__set_application_bypass(true);
printf("error %s \n", errBuff.c_str()); printf("error %s \n", errBuff.c_str());
if (errBuff.empty()) { if (errBuff.empty()) {
string hasChange = ""; string hasChange = "";
map<string, tag_t> saveAsMap; map<string, tag_t> saveAsMap;
createEbom(topBean, true, hasChange, saveAsMap); string errMsg = createEbom(topBean, true, hasChange, saveAsMap);
printf("errMsg %s \n", errMsg.c_str());
if (errMsg.size() > 0) {
errMsg.append("没有发布!");
ifail = 109;
*((char**)returnValue) = (char*)MEM_alloc((strlen(errMsg.c_str()) + 1) * sizeof(char));
tc_strcpy(*((char**)returnValue), errMsg.c_str());
return ifail;
}
printf("topBean.ccps.size()====>%d\n", topBean.ccps.size()); printf("topBean.ccps.size()====>%d\n", topBean.ccps.size());
//没有更改直接跳过 //没有更改直接跳过
if (topBean.ccps.size() > 0 && hasChange.compare("no") != 0) { if (topBean.ccps.size() > 0 && hasChange.compare("no") != 0) {
@ -1560,8 +1593,8 @@ int DbomToEMethod(void* returnValue) {
} }
if (flagChange) { if (flagChange) {
tag_t topItem, topRev; tag_t topItem, topRev;
ITEM_ask_item_of_rev(topBean.mantr, &topItem); ITKCALL(ITEM_ask_item_of_rev(topBean.mantr, &topItem));
ITEM_ask_latest_rev(topItem, &topRev); ITKCALL(ITEM_ask_latest_rev(topItem, &topRev));
copyEBomLine(topRev, mantr); copyEBomLine(topRev, mantr);
} }
} }
@ -1583,9 +1616,9 @@ int DbomToEMethod(void* returnValue) {
return ifail; return ifail;
} }
/** /**
* DBOMEBOM BOM使 * DBOMEBOM BOM使
* DE * DE
*/ */
int DbomToEMethodUser(void* returnValue) { int DbomToEMethodUser(void* returnValue) {
int ifail = ITK_ok; int ifail = ITK_ok;
char *sql = NULL, *revUid; char *sql = NULL, *revUid;

@ -655,7 +655,7 @@ void replaceBom(EBomBean& childPm, map<string, tag_t>& map, int len, tag_t dcpro
string url = "http://10.128.20.35:9002/Post/PLM_Goods"; string url = "http://10.128.20.35:9002/Post/PLM_Goods";
string jsonUf = G2U222(jsons[i].c_str()); string jsonUf = G2U222(jsons[i].c_str());
//调用接口申请物料 //调用接口申请物料
//string msg = callHttpserver(jsonUf, url); string msg = callHttpserver(jsonUf, url);
} }
} }
} }
@ -770,7 +770,7 @@ void recyReadEBom(tag_t pLine, EBomBean parentBean, vector<EBomBean>& beans, int
int num = 0; int num = 0;
tag_t* mantrs; tag_t* mantrs;
ITKCALL(AOM_ask_value_tags(eRev, "TC_Is_Represented_By", &num, &mantrs)); ITKCALL(AOM_ask_value_tags(eRev, "TC_Is_Represented_By", &num, &mantrs));
if (num == 1) { if (num > 0) {
char* id; char* id;
AOM_ask_value_string(mantrs[0], "item_id", &id); AOM_ask_value_string(mantrs[0], "item_id", &id);
string item_id = id; string item_id = id;
@ -870,8 +870,9 @@ class E2PBean //
public: public:
string key;//wbs号+物料号组成的标识 string key;//wbs号+物料号组成的标识
tag_t pMantr=NULLTAG; // p物料 发布升版,没发布更新,取最新版本 (不带P的移除添加) tag_t pMantr=NULLTAG; // p物料 发布升版,没发布更新,取最新版本 (不带P的移除添加)
string revId = ""; string prevId = "";
tag_t eMantr; // e物料 tag_t eMantr; // e物料
string erevId = "";
public: public:
//定义成员函数 //定义成员函数
void isSameKey(string newKey) void isSameKey(string newKey)
@ -901,9 +902,9 @@ void updatePbomCycle(tag_t eLine, string &errBuff, int len, EBomUpBean &upBean)
char* ifpBom, *matnrNo, *childQty; char* ifpBom, *matnrNo, *childQty;
tag_t c_line_tag = c_line_tags[i], eRev; tag_t c_line_tag = c_line_tags[i], eRev;
ITKCALL(AOM_ask_value_tag(c_line_tag, "bl_line_object", &eRev)); ITKCALL(AOM_ask_value_tag(c_line_tag, "bl_line_object", &eRev));
AOM_ask_value_string(c_line_tag, BL_QUANTITY, &childQty); ITKCALL(AOM_ask_value_string(c_line_tag, BL_QUANTITY, &childQty));
AOM_ask_value_string(eRev, "zt2_ifpbom", &ifpBom); ITKCALL(AOM_ask_value_string(eRev, "zt2_ifpbom", &ifpBom));
AOM_ask_value_string(eRev, "zt2_MaterialNo", &matnrNo); ITKCALL(AOM_ask_value_string(eRev, "zt2_MaterialNo", &matnrNo));
EBomUpBean cBean; EBomUpBean cBean;
cBean.matnrNo = matnrNo; cBean.matnrNo = matnrNo;
@ -916,30 +917,30 @@ void updatePbomCycle(tag_t eLine, string &errBuff, int len, EBomUpBean &upBean)
ITKCALL(AOM_ask_value_tags(eRev, "TC_Is_Represented_By", &num, &mantrs)); ITKCALL(AOM_ask_value_tags(eRev, "TC_Is_Represented_By", &num, &mantrs));
if (num == 1) { if (num == 1) {
char* id; char* id;
AOM_ask_value_string(mantrs[0], "item_id", &id); ITKCALL(AOM_ask_value_string(mantrs[0], "item_id", &id));
string item_id = id; string item_id = id;
smatch result; smatch result;
bool ret = regex_match(item_id, result, qq_reg); bool ret = regex_match(item_id, result, qq_reg);
if (ret) { if (ret) {
char* zt2_ifpbom; char* zt2_ifpbom;
AOM_ask_value_string(eRev, "zt2_ifpbom", &zt2_ifpbom); ITKCALL(AOM_ask_value_string(eRev, "zt2_ifpbom", &zt2_ifpbom));
if (zt2_ifpbom != NULL && strcmp(zt2_ifpbom, "P") == 0) { if (zt2_ifpbom != NULL && strcmp(zt2_ifpbom, "P") == 0) {
continue; continue;
} }
int cc_cnt; int cc_cnt;
tag_t* cc_lines; tag_t* cc_lines;
BOM_line_ask_all_child_lines(c_line_tag, &cc_cnt, &cc_lines); ITKCALL(BOM_line_ask_all_child_lines(c_line_tag, &cc_cnt, &cc_lines));
printf("cc_cnt===> %d item_id ==> %s \n", cc_cnt, id); printf("cc_cnt===> %d item_id ==> %s \n", cc_cnt, id);
//新增逻辑 //新增逻辑
for (int tt = 0; tt < cc_cnt; tt++) { for (int tt = 0; tt < cc_cnt; tt++) {
tag_t cc_line = cc_lines[tt], c_eRev; tag_t cc_line = cc_lines[tt], c_eRev;
char* bl_quantity, *pId, *c_pId,*bl_line_name,*remark; char* bl_quantity, *pId, *c_pId,*bl_line_name,*remark;
AOM_ask_value_string(eRev, "item_id", &pId); ITKCALL(AOM_ask_value_string(eRev, "item_id", &pId));
AOM_ask_value_string(cc_line, "bl_quantity", &bl_quantity); ITKCALL(AOM_ask_value_string(cc_line, "bl_quantity", &bl_quantity));
ITKCALL(AOM_ask_value_tag(cc_line, "bl_line_object", &c_eRev)); ITKCALL(AOM_ask_value_tag(cc_line, "bl_line_object", &c_eRev));
AOM_ask_value_string(cc_line, "bl_line_name", &bl_line_name); ITKCALL(AOM_ask_value_string(cc_line, "bl_line_name", &bl_line_name));
AOM_ask_value_string(c_eRev, "item_id", &c_pId); ITKCALL(AOM_ask_value_string(c_eRev, "item_id", &c_pId));
AOM_ask_value_string(cc_line, "ZT2_Remark", &remark); ITKCALL(AOM_ask_value_string(cc_line, "ZT2_Remark", &remark));
printf("c_pId===> %s bl_quantity ==> %s len==> %d \n", c_pId, bl_quantity, len); printf("c_pId===> %s bl_quantity ==> %s len==> %d \n", c_pId, bl_quantity, len);
if (strcmp("bl_quantity", "") == 0) { if (strcmp("bl_quantity", "") == 0) {
errBuff.append("P类物料:").append(pId).append("下子件").append(c_pId) errBuff.append("P类物料:").append(pId).append("下子件").append(c_pId)
@ -1195,7 +1196,7 @@ void createAXxq(tag_t eRev, tag_t pRev, int len, tag_t dcproxy) {
printf("jsons ===> %s \n", jsons[i].c_str()); printf("jsons ===> %s \n", jsons[i].c_str());
string url = "http://10.128.20.35:9002/Post/PLM_Goods"; string url = "http://10.128.20.35:9002/Post/PLM_Goods";
string jsonUf = G2U222(jsons[i].c_str()); string jsonUf = G2U222(jsons[i].c_str());
//string msg = callHttpserver(jsonUf, url); string msg = callHttpserver(jsonUf, url);
} }
} }
} }
@ -1205,27 +1206,28 @@ void addToAmatnrUp(vector<EBomUpBean> vecs, int len, tag_t newPAmatnr, boolean l
tag_t mantr = newPAmatnr, ebom_window, bom_line; tag_t mantr = newPAmatnr, ebom_window, bom_line;
tag_t* bvr_list = NULL; tag_t* bvr_list = NULL;
int bvr_count; int bvr_count;
POM_AM__set_application_bypass(true);
ITKCALL(ITEM_rev_list_bom_view_revs(mantr, &bvr_count, &bvr_list)); ITKCALL(ITEM_rev_list_bom_view_revs(mantr, &bvr_count, &bvr_list));
if (bvr_count == 0) { if (bvr_count == 0) {
tag_t newView, newViewBvr, pitem; tag_t newView, newViewBvr, pitem;
ITEM_ask_item_of_rev(mantr, &pitem); ITKCALL(ITEM_ask_item_of_rev(mantr, &pitem));
ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView)); ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView));
AOM_save(newView); ITKCALL(AOM_save(newView));
ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, mantr, &newViewBvr)); ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, mantr, &newViewBvr));
AOM_save(newViewBvr); ITKCALL(AOM_save(newViewBvr));
AOM_save(mantr); ITKCALL(AOM_save(mantr));
} }
ITKCALL(BOM_create_window(&ebom_window)); ITKCALL(BOM_create_window(&ebom_window));
ITKCALL(BOM_set_window_top_line(ebom_window, NULL, mantr, NULLTAG, &bom_line)); ITKCALL(BOM_set_window_top_line(ebom_window, NULL, mantr, NULLTAG, &bom_line));
char *name; char *name;
AOM_ask_value_string(mantr, "object_name", &name); ITKCALL(AOM_ask_value_string(mantr, "object_name", &name));
string xqType = getXqName(name); //ABCDE string xqType = getXqName(name); //ABCDE
for (int i = 0; i < vecs.size(); i++) { for (int i = 0; i < vecs.size(); i++) {
tag_t newChild; tag_t newChild = NULLTAG;
tag_t cline = vecs[i].bomline; tag_t cline = vecs[i].bomline;
char* oldQty, *seqNo, *remark,*bl_line_name; char* oldQty, *seqNo, *remark,*bl_line_name;
AOM_ask_value_string(cline, "ZT2_Remark", &remark); ITKCALL(AOM_ask_value_string(cline, "ZT2_Remark", &remark));
string msg = getRemarkMsg(remark, len); string msg = getRemarkMsg(remark, len);
int xqLen = len; int xqLen = len;
if (msg.length() > 0) { if (msg.length() > 0) {
@ -1235,30 +1237,33 @@ void addToAmatnrUp(vector<EBomUpBean> vecs, int len, tag_t newPAmatnr, boolean l
} }
} }
ITKCALL(BOM_line_copy(bom_line, cline, NULLTAG, &newChild)); ITKCALL(BOM_line_copy(bom_line, cline, NULLTAG, &newChild));
AOM_ask_value_string(cline, "bl_quantity", &oldQty); if (newChild == NULLTAG) {
AOM_ask_value_string(cline, "bl_sequence_no", &seqNo); continue;
AOM_ask_value_string(cline, "bl_line_name", &bl_line_name); }
ITKCALL(AOM_ask_value_string(cline, "bl_quantity", &oldQty));
ITKCALL(AOM_ask_value_string(cline, "bl_sequence_no", &seqNo));
ITKCALL(AOM_ask_value_string(cline, "bl_line_name", &bl_line_name));
if (lastFlag && strstr(bl_line_name,"线")!=NULL) { if (lastFlag && strstr(bl_line_name,"线")!=NULL) {
double blQty = atof(oldQty); double blQty = atof(oldQty);
int num = blQty / xqLen; int num = blQty / xqLen;
double fmodVal = fmod(blQty, xqLen); double fmodVal = fmod(blQty, xqLen);
double lastVal = num + fmodVal; double lastVal = num + fmodVal;
string numNew = to_string(lastVal); string numNew = to_string(lastVal);
AOM_lock(newChild); ITKCALL(AOM_lock(newChild));
AOM_set_value_string(newChild, "bl_quantity", numNew.c_str()); ITKCALL(AOM_set_value_string(newChild, "bl_quantity", numNew.c_str()));
AOM_set_value_string(newChild, "bl_sequence_no", seqNo); ITKCALL(AOM_set_value_string(newChild, "bl_sequence_no", seqNo));
AOM_save(newChild); ITKCALL(AOM_save(newChild));
AOM_unlock(newChild); ITKCALL(AOM_unlock(newChild));
} }
else { else {
int blQty = atoi(oldQty); int blQty = atoi(oldQty);
int num = blQty / len; int num = blQty / len;
string numNew = to_string(num); string numNew = to_string(num);
AOM_lock(newChild); ITKCALL(AOM_lock(newChild));
AOM_set_value_string(newChild, "bl_quantity", numNew.c_str()); ITKCALL(AOM_set_value_string(newChild, "bl_quantity", numNew.c_str()));
AOM_set_value_string(newChild, "bl_sequence_no", seqNo); ITKCALL(AOM_set_value_string(newChild, "bl_sequence_no", seqNo));
AOM_save(newChild); ITKCALL(AOM_save(newChild));
AOM_unlock(newChild); ITKCALL(AOM_unlock(newChild));
} }
} }
@ -1305,10 +1310,10 @@ void getPBomMsg(tag_t bom_line, map<string, double>& bomMsgMap) {
tag_t c_Rev; tag_t c_Rev;
char *matnrNo, *cnt, *objName; char *matnrNo, *cnt, *objName;
ITKCALL(AOM_ask_value_tag(c_line_tags[t], BL_LINE_OBJECT, &c_Rev)); ITKCALL(AOM_ask_value_tag(c_line_tags[t], BL_LINE_OBJECT, &c_Rev));
AOM_ask_value_string(c_Rev, MATERIALNO, &matnrNo); ITKCALL(AOM_ask_value_string(c_Rev, MATERIALNO, &matnrNo));
printf("zt2_MaterialNo===>%s\n", matnrNo); printf("zt2_MaterialNo===>%s\n", matnrNo);
double qtyPXn = 1; double qtyPXn = 1;
AOM_ask_value_string(c_line_tags[t], BL_QUANTITY, &cnt); ITKCALL(AOM_ask_value_string(c_line_tags[t], BL_QUANTITY, &cnt));
if (strcmp(cnt, "") != 0) { if (strcmp(cnt, "") != 0) {
qtyPXn = atof(cnt); qtyPXn = atof(cnt);
} }
@ -1347,11 +1352,11 @@ map<string, double> getPBomMsg(tag_t mantrRev, bool& flag, vector<tag_t>& termCo
tag_t c_Rev; tag_t c_Rev;
char *matnrNo, *cnt, *objName; char *matnrNo, *cnt, *objName;
ITKCALL(AOM_ask_value_tag(c_line_tags[t], "bl_line_object", &c_Rev)); ITKCALL(AOM_ask_value_tag(c_line_tags[t], "bl_line_object", &c_Rev));
AOM_ask_value_string(c_Rev, "zt2_MaterialNo", &matnrNo); ITKCALL(AOM_ask_value_string(c_Rev, "zt2_MaterialNo", &matnrNo));
double qtyPXn = 1; double qtyPXn = 1;
AOM_ask_value_string(c_line_tags[t], "bl_quantity", &cnt); ITKCALL(AOM_ask_value_string(c_line_tags[t], "bl_quantity", &cnt));
AOM_ask_value_string(c_Rev, OBJECT_NAME, &objName); ITKCALL(AOM_ask_value_string(c_Rev, OBJECT_NAME, &objName));
printf("zt2_MaterialNo===>%s objName ===> %s\n", matnrNo, objName); printf("zt2_MaterialNo===>%s objName ===> %s\n", matnrNo, objName);
if (checkName(objName)) { if (checkName(objName)) {
termCoils.push_back(c_Rev); termCoils.push_back(c_Rev);
@ -1368,7 +1373,7 @@ map<string, double> getPBomMsg(tag_t mantrRev, bool& flag, vector<tag_t>& termCo
bomMsgMap[matnrNo] = qtyPXn; bomMsgMap[matnrNo] = qtyPXn;
} }
} }
BOM_close_window(ebom_window); ITKCALL(BOM_close_window(ebom_window));
return bomMsgMap; return bomMsgMap;
} }
/** /**
@ -1448,6 +1453,8 @@ tag_t saveAsMaterial(EBomUpBean topBean, boolean isTop,
printf("=======TEST====== %d \n", termCoils.size()); printf("=======TEST====== %d \n", termCoils.size());
//升版并发布 没发布的产成品直接更新 //升版并发布 没发布的产成品直接更新
if (isTcm(pMaterial) && isBomViewTcm(pMaterial)) { if (isTcm(pMaterial) && isBomViewTcm(pMaterial)) {
printf("ITEM_copy_rev::%s\n", oldUid);
POM_AM__set_application_bypass(true);
ITKCALL(ITEM_copy_rev(pMaterial, NULL, &pMaterial)); ITKCALL(ITEM_copy_rev(pMaterial, NULL, &pMaterial));
TCMAndOwner(pMaterial); TCMAndOwner(pMaterial);
if (isTop) { if (isTop) {
@ -1461,6 +1468,7 @@ tag_t saveAsMaterial(EBomUpBean topBean, boolean isTop,
printf("=======itemId====== %s \n", itemId); printf("=======itemId====== %s \n", itemId);
if (isTcm(termCoils[i]) && isBomViewTcm(termCoils[i])) { if (isTcm(termCoils[i]) && isBomViewTcm(termCoils[i])) {
tag_t newPMantr; tag_t newPMantr;
POM_AM__set_application_bypass(true);
ITKCALL(ITEM_copy_rev(termCoils[i], NULL, &newPMantr)); ITKCALL(ITEM_copy_rev(termCoils[i], NULL, &newPMantr));
changeCoilOwner(newPMantr, termCoils[i]); changeCoilOwner(newPMantr, termCoils[i]);
//TCMAndOwner(newPMantr); //TCMAndOwner(newPMantr);
@ -1482,6 +1490,7 @@ tag_t saveAsMaterial(EBomUpBean topBean, boolean isTop,
void startUpdate(EBomUpBean upBean, tag_t pBomTag, int len, tag_t dcproxy, void startUpdate(EBomUpBean upBean, tag_t pBomTag, int len, tag_t dcproxy,
boolean isTop, string &hasChange, map<string, tag_t>& saveAsMap) { boolean isTop, string &hasChange, map<string, tag_t>& saveAsMap) {
//记录的EBOM下面的子件 //记录的EBOM下面的子件
printf("startUpdate===>%s\n", upBean.matnrNo.c_str());
vector<EBomUpBean> vecs = upBean.parentBean; vector<EBomUpBean> vecs = upBean.parentBean;
int c_line_count = 0; int c_line_count = 0;
tag_t* c_line_tags; tag_t* c_line_tags;
@ -1495,12 +1504,13 @@ void startUpdate(EBomUpBean upBean, tag_t pBomTag, int len, tag_t dcproxy,
tag_t ebom_window2, *bvr_list2, bom_line; tag_t ebom_window2, *bvr_list2, bom_line;
int bvr_count2 = 0; int bvr_count2 = 0;
char* pBomUid; char* pBomUid;
(BOM_create_window(&ebom_window2)); ITKCALL(BOM_create_window(&ebom_window2));
ITK__convert_tag_to_uid(pBomTop, &pBomUid); ITK__convert_tag_to_uid(pBomTop, &pBomUid);
(ITEM_rev_list_bom_view_revs(pBomTop, &bvr_count2, &bvr_list2)); ITKCALL(ITEM_rev_list_bom_view_revs(pBomTop, &bvr_count2, &bvr_list2));
printf(" pBomUid ===>%s \n", pBomUid);
if (bvr_count2 == 0) { if (bvr_count2 == 0) {
//errBuff.append("²»´æÔÚEBOMÇë¼ì²é\n"); printf("不存在EBOM请检查\n");
//原来没有PBOM //原来没有PBOM
return; return;
} }
@ -1510,9 +1520,9 @@ void startUpdate(EBomUpBean upBean, tag_t pBomTag, int len, tag_t dcproxy,
char* ifpBom, *matnrNo, *name; char* ifpBom, *matnrNo, *name;
tag_t c_line_tag = c_line_tags[i], eRev; tag_t c_line_tag = c_line_tags[i], eRev;
ITKCALL(AOM_ask_value_tag(c_line_tag, "bl_line_object", &eRev)); ITKCALL(AOM_ask_value_tag(c_line_tag, "bl_line_object", &eRev));
AOM_ask_value_string(eRev, "zt2_ifpbom", &ifpBom); ITKCALL(AOM_ask_value_string(eRev, "zt2_ifpbom", &ifpBom));
AOM_ask_value_string(eRev, "zt2_MaterialNo", &matnrNo); ITKCALL(AOM_ask_value_string(eRev, "zt2_MaterialNo", &matnrNo));
AOM_ask_value_string(eRev, "object_name", &name); ITKCALL(AOM_ask_value_string(eRev, "object_name", &name));
//移除PBOM //移除PBOM
printf("zt2_MaterialNo ===>%s ifpBom==>%s\n", matnrNo, ifpBom); printf("zt2_MaterialNo ===>%s ifpBom==>%s\n", matnrNo, ifpBom);
if (strcmp(ifpBom, "P") == 0) { if (strcmp(ifpBom, "P") == 0) {
@ -1522,7 +1532,7 @@ void startUpdate(EBomUpBean upBean, tag_t pBomTag, int len, tag_t dcproxy,
//BOM_line_cut(c_line_tag); //BOM_line_cut(c_line_tag);
} }
else if (!checkName(name)) { else if (!checkName(name)) {
BOM_line_cut(c_line_tag);//pBomMap[matnrNo] = c_line_tag; ITKCALL(BOM_line_cut(c_line_tag));//pBomMap[matnrNo] = c_line_tag;
} }
else if (checkName(name)) { else if (checkName(name)) {
xqTagVec.push_back(c_line_tag); xqTagVec.push_back(c_line_tag);
@ -1530,6 +1540,7 @@ void startUpdate(EBomUpBean upBean, tag_t pBomTag, int len, tag_t dcproxy,
} }
//移除所有非P 再从EBOM复制 //移除所有非P 再从EBOM复制
printf("xqTagVec===>%d\n", xqTagVec.size()); printf("xqTagVec===>%d\n", xqTagVec.size());
POM_AM__set_application_bypass(true);
for (int i = 0; i < xqTagVec.size(); i++) { for (int i = 0; i < xqTagVec.size(); i++) {
tag_t xqLine = xqTagVec[i],*c_xqLine_tags, newPAmatnr; tag_t xqLine = xqTagVec[i],*c_xqLine_tags, newPAmatnr;
int c_line_countXq = 0; int c_line_countXq = 0;
@ -1537,7 +1548,7 @@ void startUpdate(EBomUpBean upBean, tag_t pBomTag, int len, tag_t dcproxy,
printf("c_line_countXq===>%d\n", c_line_countXq); printf("c_line_countXq===>%d\n", c_line_countXq);
//移除原来的 -> 进行对比是否有修改 //移除原来的 -> 进行对比是否有修改
for (int j = 0; j < c_line_countXq; j++) { for (int j = 0; j < c_line_countXq; j++) {
BOM_line_cut(c_xqLine_tags[j]); ITKCALL(BOM_line_cut(c_xqLine_tags[j]));
} }
ITKCALL(AOM_ask_value_tag(xqLine, "bl_line_object", &newPAmatnr)); ITKCALL(AOM_ask_value_tag(xqLine, "bl_line_object", &newPAmatnr));
//添加线圈下的东西 //添加线圈下的东西
@ -1549,29 +1560,30 @@ void startUpdate(EBomUpBean upBean, tag_t pBomTag, int len, tag_t dcproxy,
} }
if (xqTagVec.size() == 0) { if (xqTagVec.size() == 0) {
//不是线圈 移除后复制 //不是线圈 移除后复制
printf("vecs===>%d\n", vecs.size()); printf("vecs===>%zd\n", vecs.size());
for (int i = 0; i < vecs.size(); i++) { for (int i = 0; i < vecs.size(); i++) {
printf("i===>%d\n", i);
EBomUpBean cupBean = vecs[i]; EBomUpBean cupBean = vecs[i];
//重新复制 //重新复制
if (std::find(matnrVec.begin(), matnrVec.end(), cupBean.matnrNo) != matnrVec.end()) { if (std::find(matnrVec.begin(), matnrVec.end(), cupBean.matnrNo) != matnrVec.end()) {
printf("matnrVec ===>%s\n", cupBean.matnrNo.c_str());
tag_t c_line_tag = pBomMap[cupBean.matnrNo]; tag_t c_line_tag = pBomMap[cupBean.matnrNo];
tag_t c_Rev, bomView = NULLTAG; tag_t c_Rev, bomView = NULLTAG;
ITKCALL(AOM_ask_value_tag(c_line_tag, "bl_line_object", &c_Rev)); ITKCALL(AOM_ask_value_tag(c_line_tag, "bl_line_object", &c_Rev));
boolean flagAs = false; boolean flagAs = false;
tag_t childPTag; tag_t childPTag;
printf("matnrVec ===>%s\n", cupBean.matnrNo.c_str());
ITKCALL(AOM_ask_value_tag(c_line_tag, BL_LINE_OBJECT, &childPTag)); ITKCALL(AOM_ask_value_tag(c_line_tag, BL_LINE_OBJECT, &childPTag));
startUpdate(cupBean, childPTag, len, dcproxy, isTop, hasChange, saveAsMap); startUpdate(cupBean, childPTag, len, dcproxy, isTop, hasChange, saveAsMap);
if (bomView != NULLTAG && flagAs) { if (bomView != NULLTAG && flagAs) {
BOM_save_window(bomView); ITKCALL(BOM_save_window(bomView));
BOM_close_window(bomView); ITKCALL(BOM_close_window(bomView));
} }
printf("i2===>%d\n", i);
} }
else { else {
boolean flagLc = false; boolean flagLc = false;
char* seq; char* seq;
printf(" pBomUid ===>%s \n", pBomUid);
printf("matnrVecNotP===>%s\n", cupBean.matnrNo.c_str()); printf("matnrVecNotP===>%s\n", cupBean.matnrNo.c_str());
tag_t cline = cupBean.bomline; tag_t cline = cupBean.bomline;
tag_t newChild; tag_t newChild;
@ -1580,11 +1592,11 @@ void startUpdate(EBomUpBean upBean, tag_t pBomTag, int len, tag_t dcproxy,
printf(" newChild === NULLTAG 没有权限修改BOM视图 \n"); printf(" newChild === NULLTAG 没有权限修改BOM视图 \n");
continue; continue;
} }
AOM_ask_value_string(cline, "bl_sequence_no", &seq); ITKCALL(AOM_ask_value_string(cline, "bl_sequence_no", &seq));
AOM_lock(newChild); ITKCALL(AOM_lock(newChild));
AOM_set_value_string(newChild, "bl_sequence_no", seq); ITKCALL(AOM_set_value_string(newChild, "bl_sequence_no", seq));
AOM_save(newChild); ITKCALL(AOM_save(newChild));
AOM_unlock(newChild); ITKCALL(AOM_unlock(newChild));
tag_t c_Rev; tag_t c_Rev;
ITKCALL(AOM_ask_value_tag(cline, "bl_line_object", &c_Rev)); ITKCALL(AOM_ask_value_tag(cline, "bl_line_object", &c_Rev));
@ -1611,6 +1623,7 @@ void startUpdate(EBomUpBean upBean, tag_t pBomTag, int len, tag_t dcproxy,
ITKCALL(BOM_save_window(ebom_window2)); ITKCALL(BOM_save_window(ebom_window2));
ITKCALL(BOM_close_window(ebom_window2)); ITKCALL(BOM_close_window(ebom_window2));
printf("startUpdate end===>%s\n", upBean.matnrNo.c_str());
} }
/** /**
* BOM * BOM
@ -1620,11 +1633,15 @@ void startUpdate(EBomUpBean upBean, tag_t pBomTag, int len, tag_t dcproxy,
void copyBomLine(tag_t matnrTop, tag_t otherPbom) { void copyBomLine(tag_t matnrTop, tag_t otherPbom) {
tag_t ebom_window, ebom_window2, *bvr_list, *bvr_list2, bom_line, bom_line2, *c_line_tags, *c_line_tags2; tag_t ebom_window, ebom_window2, *bvr_list, *bvr_list2, bom_line, bom_line2, *c_line_tags, *c_line_tags2;
int bvr_count = 0, bvr_count2 = 0, c_line_count, c_line_count2; int bvr_count = 0, bvr_count2 = 0, c_line_count, c_line_count2;
(BOM_create_window(&ebom_window)); ITKCALL(BOM_create_window(&ebom_window));
(ITEM_rev_list_bom_view_revs(matnrTop, &bvr_count, &bvr_list)); ITKCALL(ITEM_rev_list_bom_view_revs(matnrTop, &bvr_count, &bvr_list));
printf("bvr_count=%d \n", bvr_count); printf("bvr_count=%d \n", bvr_count);
if (bvr_count == 0) { if (bvr_count == 0) {
//errBuff.append("不存在EBOM请检查\n"); //errBuff.append("不存在EBOM请检查\n");
char* os = NULL;
ITKCALL(AOM_ask_value_string(matnrTop, "object_string", &os));
printf("%sBOM数量为0\n", os);
return;
} }
ITKCALL(BOM_set_window_top_line_bvr(ebom_window, bvr_list[0], &bom_line)); //顶层bom获取 ITKCALL(BOM_set_window_top_line_bvr(ebom_window, bvr_list[0], &bom_line)); //顶层bom获取
printf("顶层bom获取\n"); printf("顶层bom获取\n");
@ -1632,20 +1649,20 @@ void copyBomLine(tag_t matnrTop, tag_t otherPbom) {
ITKCALL(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags)); ITKCALL(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags));
(ITEM_rev_list_bom_view_revs(otherPbom, &bvr_count2, &bvr_list2)); ITKCALL(ITEM_rev_list_bom_view_revs(otherPbom, &bvr_count2, &bvr_list2));
if (bvr_count2 == 0) { if (bvr_count2 == 0) {
tag_t newView, newViewBvr, pitem; tag_t newView, newViewBvr, pitem;
ITEM_ask_item_of_rev(otherPbom, &pitem); ITKCALL(ITEM_ask_item_of_rev(otherPbom, &pitem));
ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView)); ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView));
AOM_save(newView); ITKCALL(AOM_save(newView));
ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, otherPbom, &newViewBvr)); ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, otherPbom, &newViewBvr));
AOM_save(newViewBvr); ITKCALL(AOM_save(newViewBvr));
AOM_save(otherPbom); ITKCALL(AOM_save(otherPbom));
//return; //return;
(ITEM_rev_list_bom_view_revs(otherPbom, &bvr_count2, &bvr_list2)); ITKCALL(ITEM_rev_list_bom_view_revs(otherPbom, &bvr_count2, &bvr_list2));
} }
(BOM_create_window(&ebom_window2)); ITKCALL(BOM_create_window(&ebom_window2));
(BOM_set_window_top_line_bvr(ebom_window2, bvr_list2[0], &bom_line2)); //¶¥²ãbom»ñÈ¡ ITKCALL(BOM_set_window_top_line_bvr(ebom_window2, bvr_list2[0], &bom_line2)); //顶层bom获取
ITKCALL(BOM_line_ask_all_child_lines(bom_line2, &c_line_count2, &c_line_tags2)); ITKCALL(BOM_line_ask_all_child_lines(bom_line2, &c_line_count2, &c_line_tags2));
for (int i = 0; i < c_line_count2; i++) { for (int i = 0; i < c_line_count2; i++) {
BOM_line_cut(c_line_tags2[i]); BOM_line_cut(c_line_tags2[i]);
@ -1654,10 +1671,10 @@ void copyBomLine(tag_t matnrTop, tag_t otherPbom) {
tag_t newChild; tag_t newChild;
char *bl_seqNo; char *bl_seqNo;
ITKCALL(BOM_line_copy(bom_line2, c_line_tags[i], NULLTAG, &newChild)); ITKCALL(BOM_line_copy(bom_line2, c_line_tags[i], NULLTAG, &newChild));
AOM_ask_value_string(c_line_tags[i], "bl_sequence_no", &bl_seqNo); ITKCALL(AOM_ask_value_string(c_line_tags[i], "bl_sequence_no", &bl_seqNo));
AOM_lock(newChild); ITKCALL(AOM_lock(newChild));
AOM_set_value_string(newChild, "bl_sequence_no", bl_seqNo); ITKCALL(AOM_set_value_string(newChild, "bl_sequence_no", bl_seqNo));
AOM_save(newChild); ITKCALL(AOM_save(newChild));
//最后unlock //最后unlock
AOM_unlock(newChild); AOM_unlock(newChild);
} }
@ -1665,8 +1682,8 @@ void copyBomLine(tag_t matnrTop, tag_t otherPbom) {
//ITKCALL(BOM_line_copy(bom_line2, c_line_tags[i], NULLTAG, &newChild)); //ITKCALL(BOM_line_copy(bom_line2, c_line_tags[i], NULLTAG, &newChild));
ITKCALL(BOM_save_window(ebom_window2)); ITKCALL(BOM_save_window(ebom_window2));
BOM_close_window(ebom_window2); ITKCALL(BOM_close_window(ebom_window2));
BOM_close_window(ebom_window); ITKCALL(BOM_close_window(ebom_window));
} }
//EBOM转PBOM //EBOM转PBOM
@ -1734,10 +1751,10 @@ int EbomToPMethod(void* returnValue) {
//找到图纸获取下面所有符合条件的E物料和P物料已有就更新 //找到图纸获取下面所有符合条件的E物料和P物料已有就更新
designRev = mantrs[0]; designRev = mantrs[0];
tag_t designItem; tag_t designItem;
ITEM_ask_item_of_rev(designRev,&designItem); ITKCALL(ITEM_ask_item_of_rev(designRev,&designItem));
ITEM_ask_latest_rev(designItem,&designRev); ITKCALL(ITEM_ask_latest_rev(designItem,&designRev));
char* itemId; char* itemId;
AOM_ask_value_string(designRev, "item_id", &itemId); ITKCALL(AOM_ask_value_string(designRev, "item_id", &itemId));
vector<string> vec2; vector<string> vec2;
Split(itemId, "-", vec2); Split(itemId, "-", vec2);
string idTop = "1ZDB300000P"; string idTop = "1ZDB300000P";
@ -1745,8 +1762,8 @@ int EbomToPMethod(void* returnValue) {
idTop = idTop.append("-").append(vec2[1]); idTop = idTop.append("-").append(vec2[1]);
} }
tag_t topItem, topDesginRev; tag_t topItem, topDesginRev;
ITEM_find_item(idTop.c_str(), &topItem); ITKCALL(ITEM_find_item(idTop.c_str(), &topItem));
ITEM_ask_latest_rev(topItem, &topDesginRev); ITKCALL(ITEM_ask_latest_rev(topItem, &topDesginRev));
len = getClassVal2(topItem, errBuff); len = getClassVal2(topItem, errBuff);
printf("len%d\n", len); printf("len%d\n", len);
if (len > 0) { if (len > 0) {
@ -1760,39 +1777,48 @@ int EbomToPMethod(void* returnValue) {
//遍历变压器图纸获取最新版本的E和P对象 //遍历变压器图纸获取最新版本的E和P对象
for (int t = 0; t < num2; t++) { for (int t = 0; t < num2; t++) {
char* isPm, *zt2_MaterialNo, *zt2_WBSNo; char* isPm, *zt2_MaterialNo, *zt2_WBSNo;
AOM_ask_value_string(topMatnrs[t], "zt2_WBSNo", &zt2_WBSNo); ITKCALL(AOM_ask_value_string(topMatnrs[t], "zt2_WBSNo", &zt2_WBSNo));
AOM_ask_value_string(topMatnrs[t], "zt2_MaterialNo", &zt2_MaterialNo); ITKCALL(AOM_ask_value_string(topMatnrs[t], "zt2_MaterialNo", &zt2_MaterialNo));
AOM_ask_value_string(topMatnrs[t], "zt2_ifpbom", &isPm); ITKCALL(AOM_ask_value_string(topMatnrs[t], "zt2_ifpbom", &isPm));
string key = ""; string key = "";
key.append(zt2_WBSNo).append(zt2_MaterialNo); key.append(zt2_WBSNo).append(zt2_MaterialNo);
printf("key===>%d\n", key.c_str());
if (wlbmMap.count(key) > 0) { if (wlbmMap.count(key) > 0) {
E2PBean &bean = wlbmMap[key]; E2PBean &bean = wlbmMap[key];
if (strcmp(isPm, "P") == 0) {
char* revId; char* revId;
//获取最新的版本 //获取最新的版本
AOM_ask_value_string(topMatnrs[t], "item_revision_id", &revId); ITKCALL(AOM_ask_value_string(topMatnrs[t], "item_revision_id", &revId));
if (strcmp(revId, bean.revId.c_str()) > 0) { //if (strcmp(revId, bean.revId.c_str()) > 0) {}
if (strcmp(isPm, "P") == 0) {
if (strcmp(revId, bean.prevId.c_str()) > 0) {
printf("3\n");
bean.pMantr = topMatnrs[t]; bean.pMantr = topMatnrs[t];
bean.revId = revId; bean.prevId = revId;
} }
} }
else { else {
if (strcmp(revId, bean.erevId.c_str()) > 0) {
printf("4\n");
bean.eMantr = topMatnrs[t]; bean.eMantr = topMatnrs[t];
bean.erevId = revId;
}
} }
} }
else { else {
E2PBean bean; E2PBean bean;
bean.key = key; bean.key = key;
if (strcmp(isPm, "P") == 0) {
char* revId; char* revId;
AOM_ask_value_string(topMatnrs[t], "item_revision_id", &revId); ITKCALL(AOM_ask_value_string(topMatnrs[t], "item_revision_id", &revId));
if (strcmp(isPm, "P") == 0) {
printf("1\n");
bean.pMantr = topMatnrs[t]; bean.pMantr = topMatnrs[t];
bean.revId = revId; bean.prevId = revId;
} }
else { else {
printf("2\n"); printf("2\n");
bean.eMantr = topMatnrs[t]; bean.eMantr = topMatnrs[t];
bean.erevId = revId;
} }
wlbmMap[key] = bean; wlbmMap[key] = bean;
} }
@ -1823,8 +1849,8 @@ int EbomToPMethod(void* returnValue) {
ITK__convert_tag_to_uid(matnrTop, &uida); ITK__convert_tag_to_uid(matnrTop, &uida);
printf("uida=%s \n", uida); printf("uida=%s \n", uida);
//只有E物料新建的逻辑 //只有E物料新建的逻辑
(BOM_create_window(&ebom_window)); ITKCALL(BOM_create_window(&ebom_window));
(ITEM_rev_list_bom_view_revs(matnrTop, &bvr_count, &bvr_list)); ITKCALL(ITEM_rev_list_bom_view_revs(matnrTop, &bvr_count, &bvr_list));
printf("bvr_count=%d \n", bvr_count); printf("bvr_count=%d \n", bvr_count);
if (bvr_count == 0) { if (bvr_count == 0) {
errBuff.append("不存在EBOM请检查\n"); errBuff.append("不存在EBOM请检查\n");
@ -1850,7 +1876,7 @@ int EbomToPMethod(void* returnValue) {
int url_num = 0; int url_num = 0;
char** url_vals = NULL; char** url_vals = NULL;
PREF_ask_char_values("database_tc", &url_num, &url_vals); ITKCALL(PREF_ask_char_values("database_tc", &url_num, &url_vals));
string url = url_vals[0]; string url = url_vals[0];
url.append("/").append(url_vals[2]); url.append("/").append(url_vals[2]);
printf("url ==> %s \n", url.c_str()); printf("url ==> %s \n", url.c_str());
@ -1873,7 +1899,7 @@ int EbomToPMethod(void* returnValue) {
char* newid = NULL; char* newid = NULL;
logical isModified = FALSE; logical isModified = FALSE;
tag_t item_type_tag, newRev, newItem; tag_t item_type_tag, newRev, newItem;
TCTYPE_ask_type("Item", &item_type_tag); ITKCALL(TCTYPE_ask_type("Item", &item_type_tag));
ITKCALL(USER_new_item_id(NULLTAG, item_type_tag, &isModified, &newid)); ITKCALL(USER_new_item_id(NULLTAG, item_type_tag, &isModified, &newid));
/*ITKCALL(NR_next_value("MEProcess", "item_id", NULLTAG, "", "", "", /*ITKCALL(NR_next_value("MEProcess", "item_id", NULLTAG, "", "", "",
NULLTAG, "", "", &next_id));*/ NULLTAG, "", "", &next_id));*/
@ -1881,20 +1907,20 @@ int EbomToPMethod(void* returnValue) {
ITKCALL(ITEM_copy_item(eMantr, newid, NULL, &newItem, &newRev)); ITKCALL(ITEM_copy_item(eMantr, newid, NULL, &newItem, &newRev));
//ITKCALL(AOM_set_value_string(newRev, "zt2_PMaterial", "PBOM")); //ITKCALL(AOM_set_value_string(newRev, "zt2_PMaterial", "PBOM"));
char* matnrNo; char* matnrNo;
AOM_ask_value_string(eMantr, "zt2_MaterialNo", &matnrNo); ITKCALL(AOM_ask_value_string(eMantr, "zt2_MaterialNo", &matnrNo));
AOM_lock(newRev); ITKCALL(AOM_lock(newRev));
AOM_set_value_string(newRev, "zt2_ifpbom", "P"); ITKCALL(AOM_set_value_string(newRev, "zt2_ifpbom", "P"));
AOM_set_value_string(newRev, "zt2_MaterialNo", matnrNo); ITKCALL(AOM_set_value_string(newRev, "zt2_MaterialNo", matnrNo));
AOM_save(newRev); ITKCALL(AOM_save(newRev));
AOM_unlock(newRev); ITKCALL(AOM_unlock(newRev));
tag_t *structure_revisions,* bom_view_tags, dsuser; tag_t *structure_revisions,* bom_view_tags, dsuser;
int revNum = 0, tagNum=0; int revNum = 0, tagNum=0;
AOM_ask_value_tags(eMantr, "TC_Is_Represented_By", &num, &mantrs); ITKCALL(AOM_ask_value_tags(eMantr, "TC_Is_Represented_By", &num, &mantrs));
//该权限 //该权限
if (num > 0) { if (num > 0) {
AOM_ask_value_tags(newRev, "structure_revisions", &revNum, &structure_revisions); ITKCALL(AOM_ask_value_tags(newRev, "structure_revisions", &revNum, &structure_revisions));
AOM_ask_value_tags(newRev, "bom_view_tags", &tagNum, &bom_view_tags); ITKCALL(AOM_ask_value_tags(newRev, "bom_view_tags", &tagNum, &bom_view_tags));
AOM_ask_value_tag(mantrs[0], "owning_user", &dsuser); ITKCALL(AOM_ask_value_tag(mantrs[0], "owning_user", &dsuser));
tag_t defGroup; tag_t defGroup;
ITKCALL(AOM_ask_value_tag(dsuser, "default_group", &defGroup)); ITKCALL(AOM_ask_value_tag(dsuser, "default_group", &defGroup));
ITKCALL(AOM_set_ownership(newItem, dsuser, defGroup)); ITKCALL(AOM_set_ownership(newItem, dsuser, defGroup));
@ -1928,8 +1954,8 @@ int EbomToPMethod(void* returnValue) {
//判断版本视图是否发布,如果发布了,升版 //判断版本视图是否发布,如果发布了,升版
break; break;
} }
(BOM_create_window(&ebom_window)); ITKCALL(BOM_create_window(&ebom_window));
(ITEM_rev_list_bom_view_revs(matnrTop, &bvr_count, &bvr_list)); ITKCALL(ITEM_rev_list_bom_view_revs(matnrTop, &bvr_count, &bvr_list));
printf("bvr_count=%d \n", bvr_count); printf("bvr_count=%d \n", bvr_count);
if (bvr_count == 0) { if (bvr_count == 0) {
errBuff.append("不存在EBOM请检查\n"); errBuff.append("不存在EBOM请检查\n");
@ -1944,7 +1970,7 @@ int EbomToPMethod(void* returnValue) {
//ITKCALL(BOM_set_window_top_line_bvr(ebom_window2, bvr_list2[0], &bom_line2)); //顶层bom获取 //ITKCALL(BOM_set_window_top_line_bvr(ebom_window2, bvr_list2[0], &bom_line2)); //顶层bom获取
int url_num = 0; int url_num = 0;
char** url_vals = NULL; char** url_vals = NULL;
PREF_ask_char_values("database_tc", &url_num, &url_vals); ITKCALL(PREF_ask_char_values("database_tc", &url_num, &url_vals));
string url = url_vals[0]; string url = url_vals[0];
url.append("/").append(url_vals[2]); url.append("/").append(url_vals[2]);
printf("url ==> %s \n", url.c_str()); printf("url ==> %s \n", url.c_str());
@ -1974,23 +2000,23 @@ int EbomToPMethod(void* returnValue) {
continue; continue;
} }
tag_t newRev = tagBean.pMantr; tag_t newRev = tagBean.pMantr;
printf("newRev===>%s\n", tagBean.revId.c_str()); //printf("newRev===>%s\n", tagBean.revId.c_str());
int structs = 0, statusNum = 0; int structs = 0, statusNum = 0;
tag_t* structure_revisions, *release_status_list; tag_t* structure_revisions, *release_status_list;
AOM_ask_value_tags(newRev, "structure_revisions", &structs, &structure_revisions); ITKCALL(AOM_ask_value_tags(newRev, "structure_revisions", &structs, &structure_revisions));
if (structs > 0 && hasChange.compare("true") != 0) { if (structs > 0 && hasChange.compare("true") != 0) {
AOM_ask_value_tags(structure_revisions[0], "release_status_list", &statusNum, &release_status_list); ITKCALL(AOM_ask_value_tags(structure_revisions[0], "release_status_list", &statusNum, &release_status_list));
if (statusNum > 0) { if (statusNum > 0) {
int revNum = 0; int revNum = 0;
tag_t *mantrsAs, dsuser; tag_t *mantrsAs, dsuser;
ITKCALL(ITEM_copy_rev(newRev, NULL, &newRev)); ITKCALL(ITEM_copy_rev(newRev, NULL, &newRev));
AOM_ask_value_tags(matnrTop, "TC_Is_Represented_By", &num, &mantrsAs); ITKCALL(AOM_ask_value_tags(matnrTop, "TC_Is_Represented_By", &num, &mantrsAs));
AOM_ask_value_tag(mantrsAs[0], "owning_user", &dsuser); ITKCALL(AOM_ask_value_tag(mantrsAs[0], "owning_user", &dsuser));
tag_t defGroup; tag_t defGroup;
ITKCALL(AOM_ask_value_tag(dsuser, "default_group", &defGroup)); ITKCALL(AOM_ask_value_tag(dsuser, "default_group", &defGroup));
ITKCALL(AOM_set_ownership(newRev, dsuser, defGroup)); ITKCALL(AOM_set_ownership(newRev, dsuser, defGroup));
if (num > 0) { if (num > 0) {
AOM_ask_value_tags(newRev, "structure_revisions", &revNum, &structure_revisions); ITKCALL(AOM_ask_value_tags(newRev, "structure_revisions", &revNum, &structure_revisions));
if (revNum > 0) { if (revNum > 0) {
ITKCALL(AOM_set_ownership(structure_revisions[0], dsuser, defGroup)); ITKCALL(AOM_set_ownership(structure_revisions[0], dsuser, defGroup));
} }

@ -0,0 +1,239 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{69AF44E1-87DF-4DE6-B996-699B397016E8}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>General</RootNamespace>
<ProjectName>General</ProjectName>
<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>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<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>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;GENERAL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;GENERAL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;GENERAL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_USRDLL;_CONSOLE;IPLIB=none;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>false</SDLCheck>
<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>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>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="ado.h" />
<ClInclude Include="CheckList.h" />
<ClInclude Include="chint_Handler.h" />
<ClInclude Include="cJSON.h" />
<ClInclude Include="common_itk_util.h" />
<ClInclude Include="CRUL_server_call_httpserver.h" />
<ClInclude Include="epm_handler_common.h" />
<ClInclude Include="epm_register_handler.h" />
<ClInclude Include="error_handling.h" />
<ClInclude Include="ocilib.h" />
<ClInclude Include="Remove_release_Status.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="string_utils.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="tc_log.h" />
<ClInclude Include="tc_util.h" />
<ClInclude Include="tinyxml2.h" />
<ClInclude Include="util.h" />
<ClInclude Include="w2_Clear_Form_PropValue.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="AddReleaseStatus.cpp" />
<ClCompile Include="AddTime.cpp" />
<ClCompile Include="ado.cxx" />
<ClCompile Include="ApplyMatnrCode.cpp" />
<ClCompile Include="AutoFeeding.cpp" />
<ClCompile Include="AutomaticRelease.cpp" />
<ClCompile Include="CheckList.cpp" />
<ClCompile Include="Check_range.cpp" />
<ClCompile Include="chintProperty.cpp" />
<ClCompile Include="ChintSendMessage.cpp" />
<ClCompile Include="chintSignChange.cpp" />
<ClCompile Include="chint_add_to_workflow.cpp" />
<ClCompile Include="chint_check_exist_ebom.cpp" />
<ClCompile Include="CHINT_cossheet_upgrade.cpp" />
<ClCompile Include="CHINT_Ecn_SendOA.cxx" />
<ClCompile Include="CHINT_GetFrock.cpp" />
<ClCompile Include="CHINT_SendOAMaterial.cpp" />
<ClCompile Include="chint_set_prop.cpp" />
<ClCompile Include="chint_signoff_dataset.cpp" />
<ClCompile Include="cJSON.c" />
<ClCompile Include="CloneProcess.cpp" />
<ClCompile Include="common_itk_util.c" />
<ClCompile Include="connor_sign_pdf.cpp" />
<ClCompile Include="CRUL_server_call_httpserver.cpp" />
<ClCompile Include="dllmain.cpp">
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="DtoEBOM2.cpp" />
<ClCompile Include="EbomToPMethod.cpp" />
<ClCompile Include="epm_register_handler.cpp" />
<ClCompile Include="General.cpp" />
<ClCompile Include="HXC_create_item_post.cpp" />
<ClCompile Include="libGeneral_custom_main.cpp" />
<ClCompile Include="Modify_Attributes.cpp" />
<ClCompile Include="chintP.cpp" />
<ClCompile Include="ocilib.cpp" />
<ClCompile Include="ProjectSavePost.cxx" />
<ClCompile Include="Remove_Release_Status.cpp" />
<ClCompile Include="SendToPi.cpp" />
<ClCompile Include="string_utils.cxx" />
<ClCompile Include="tc_util.cpp" />
<ClCompile Include="tinyxml2.cpp" />
<ClCompile Include="UpdateEtoP.cpp" />
<ClCompile Include="UpdateWorkTime.cpp" />
<ClCompile Include="w2_Clear_Form_PropValue.cpp" />
<ClCompile Include="WX_Check_Property.cxx" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

@ -23,7 +23,7 @@
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>General</RootNamespace> <RootNamespace>General</RootNamespace>
<ProjectName>General</ProjectName> <ProjectName>General</ProjectName>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@ -41,14 +41,14 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset> <PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset> <PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
@ -184,6 +184,7 @@
<ClCompile Include="chint_check_exist_ebom.cpp" /> <ClCompile Include="chint_check_exist_ebom.cpp" />
<ClCompile Include="CHINT_cossheet_upgrade.cpp" /> <ClCompile Include="CHINT_cossheet_upgrade.cpp" />
<ClCompile Include="CHINT_Ecn_SendOA.cxx" /> <ClCompile Include="CHINT_Ecn_SendOA.cxx" />
<ClCompile Include="chint_ecn_signoff.cxx" />
<ClCompile Include="CHINT_GetFrock.cpp" /> <ClCompile Include="CHINT_GetFrock.cpp" />
<ClCompile Include="CHINT_SendOAMaterial.cpp" /> <ClCompile Include="CHINT_SendOAMaterial.cpp" />
<ClCompile Include="chint_set_prop.cpp" /> <ClCompile Include="chint_set_prop.cpp" />

@ -218,5 +218,8 @@
<ClCompile Include="ProjectSavePost.cxx"> <ClCompile Include="ProjectSavePost.cxx">
<Filter>源文件</Filter> <Filter>源文件</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="chint_ecn_signoff.cxx">
<Filter>epm-handler</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -195,33 +195,58 @@ int CHINT_Assignment(EPM_action_message_t msg) {
} }
void addToFlow(tag_t bom_line,tag_t rootTask_tag, map<string, string> &uidMap) { void addToFlow(tag_t bom_line,tag_t rootTask_tag, map<string, string> &uidMap) {
int structs=0; int structs = 0;
tag_t rev, *structure_revisions; tag_t rev = NULLTAG, *structure_revisions = NULL;
ITKCALL(AOM_ask_value_tag(bom_line, "bl_line_object", &rev)); ITKCALL(AOM_ask_value_tag(bom_line, "bl_line_object", &rev));
int attachment_types = EPM_reference_attachment; int reference = EPM_reference_attachment;
int attachment_types2 = EPM_target_attachment; int target = EPM_target_attachment;
//版本有BOM视图且发布 //版本有BOM视图且发布
AOM_ask_value_tags(rev,"structure_revisions", &structs,&structure_revisions); ITKCALL(AOM_ask_value_tags(rev, "structure_revisions", &structs, &structure_revisions));
if (structs > 0) { if (structs > 0) {
int statusNum = 0, statusNum2=0; int statusNum = 0, statusNum2=0;
char *revUid; char *revUid = NULL, *bomUid = NULL;
tag_t *release_status_list,*release_status_list2; tag_t *release_status_list, *release_status_list2;
tag_t struct_revision = structure_revisions[0]; ITK__convert_tag_to_uid(rev, &revUid);
AOM_ask_value_tags(struct_revision,"release_status_list",&statusNum,&release_status_list); //printf("revUid:%s\n", revUid);
ITK__convert_tag_to_uid(rev,&revUid); if (uidMap.count(revUid) == 0) {
printf("revUid%s\n", revUid);
if (statusNum==0 && uidMap.count(revUid)==0) {
uidMap[revUid] = "1"; uidMap[revUid] = "1";
ITKCALL(AOM_ask_value_tags(rev, "release_status_list", &statusNum, &release_status_list2));
if (statusNum > 0) {
//已发布的版本放在引用关系
ITKCALL(EPM_add_attachments(rootTask_tag, 1, &rev, &reference));
}
else {
tag_t *stageTags;
int stageNum = 0;
ITKCALL(AOM_ask_value_tags(rev, "process_stage_list", &stageNum, &stageTags));
if (stageNum > 0) {
//已有流程的版本放在引用关系
ITKCALL(EPM_add_attachments(rootTask_tag, 1, &rev, &reference));
}
else {
//否则放在目标关系
ITKCALL(EPM_add_attachments(rootTask_tag, 1, &rev, &target));
}
}
}
tag_t struct_revision = structure_revisions[0];
ITK__convert_tag_to_uid(struct_revision, &bomUid);
//printf("bomUid:%s\n", bomUid);
statusNum = 0;
ITKCALL(AOM_ask_value_tags(struct_revision, "release_status_list", &statusNum, &release_status_list));
if (statusNum==0 && uidMap.count(bomUid)==0) {
uidMap[bomUid] = "1";
tag_t *stageTags; tag_t *stageTags;
int stageNum = 0; int stageNum = 0;
AOM_ask_value_tags(struct_revision, "process_stage_list", &stageNum, &stageTags); ITKCALL(AOM_ask_value_tags(struct_revision, "process_stage_list", &stageNum, &stageTags));
if (stageNum > 0) { if (stageNum > 0) {
EPM_add_attachments(rootTask_tag, 1, &struct_revision, &attachment_types); ITKCALL(EPM_add_attachments(rootTask_tag, 1, &struct_revision, &reference));
} }
else { else {
EPM_add_attachments(rootTask_tag, 1, &struct_revision, &attachment_types2); ITKCALL(EPM_add_attachments(rootTask_tag, 1, &struct_revision, &target));
} }
EPM_add_attachments(rootTask_tag, 1, &rev, &attachment_types); //ITKCALL(EPM_add_attachments(rootTask_tag, 1, &rev, &attachment_types));
} }
} }
@ -755,9 +780,9 @@ int chint_add_to_workflow(EPM_action_message_t msg) {
ECHO("chint_add_to_workflow 开始执行\n"); ECHO("chint_add_to_workflow 开始执行\n");
ECHO("=========================================================\n"); ECHO("=========================================================\n");
EPM_ask_root_task(msg.task, &root_task); ITKCALL(EPM_ask_root_task(msg.task, &root_task));
EPM_ask_sub_tasks(root_task, &sub_task_count, &sub_tasks); ITKCALL(EPM_ask_sub_tasks(root_task, &sub_task_count, &sub_tasks));
EPM_ask_attachments(root_task, EPM_target_attachment, &occur_of_counts, &taskAttches); ITKCALL(EPM_ask_attachments(root_task, EPM_target_attachment, &occur_of_counts, &taskAttches));
map<string, tag_t> itemMap; map<string, tag_t> itemMap;
map<string, string> uidMap; map<string, string> uidMap;
for (int count = 0; count < occur_of_counts; count++) for (int count = 0; count < occur_of_counts; count++)
@ -773,29 +798,29 @@ int chint_add_to_workflow(EPM_action_message_t msg) {
//ITKCALL(TCTYPE_ask_object_type(taskAttches[count], &type_tag)); //ITKCALL(TCTYPE_ask_object_type(taskAttches[count], &type_tag));
char *type; char *type;
tag_t taskTag = taskAttches[count]; tag_t taskTag = taskAttches[count];
AOM_ask_value_string(taskTag, "object_type", &type); ITKCALL(AOM_ask_value_string(taskTag, "object_type", &type));
if (strcmp(type, "Part Revision") == 0) { if (strcmp(type, "Part Revision") == 0) {
tag_t itemTag; tag_t itemTag;
char *itemId; char *itemId;
AOM_ask_value_string(taskTag, "item_id", &itemId); ITKCALL(AOM_ask_value_string(taskTag, "item_id", &itemId));
ITEM_ask_item_of_rev(taskTag, &itemTag); ITKCALL(ITEM_ask_item_of_rev(taskTag, &itemTag));
itemMap[itemId] = itemTag; itemMap[itemId] = itemTag;
break; break;
} }
else if (strcmp(type, "ZT2_Design3DRevision") == 0) { else if (strcmp(type, "ZT2_Design3DRevision") == 0) {
tag_t* comps; tag_t* comps;
int cnt; int cnt;
AOM_ask_value_tags(taskTag, "representation_for", &cnt, &comps); ITKCALL(AOM_ask_value_tags(taskTag, "representation_for", &cnt, &comps));
for (int i = 0; i < cnt; i++) { for (int i = 0; i < cnt; i++) {
tag_t comp = comps[i]; tag_t comp = comps[i];
char *partType,*zt2_ifpbom; char *partType,*zt2_ifpbom;
AOM_ask_value_string(comp, "object_type", &partType); ITKCALL(AOM_ask_value_string(comp, "object_type", &partType));
AOM_ask_value_string(comp, "zt2_ifpbom", &zt2_ifpbom); ITKCALL(AOM_ask_value_string(comp, "zt2_ifpbom", &zt2_ifpbom));
if (strcmp(partType, "Part Revision") == 0 && strcmp(zt2_ifpbom,"P")!=0) { if (strcmp(partType, "Part Revision") == 0 && strcmp(zt2_ifpbom,"P")!=0) {
char *itemId; char *itemId;
tag_t itemTag; tag_t itemTag;
AOM_ask_value_string(comp, "item_id", &itemId); ITKCALL(AOM_ask_value_string(comp, "item_id", &itemId));
ITEM_ask_item_of_rev(comp, &itemTag); ITKCALL(ITEM_ask_item_of_rev(comp, &itemTag));
if (itemMap.count(itemId) == 0) { if (itemMap.count(itemId) == 0) {
itemMap[itemId] = itemTag; itemMap[itemId] = itemTag;
} }
@ -810,14 +835,14 @@ int chint_add_to_workflow(EPM_action_message_t msg) {
tag_t part = itemMap[s]; tag_t part = itemMap[s];
//遍历BOM获取所有要投料的 //遍历BOM获取所有要投料的
tag_t* bvr_list = NULL, ebom_window, bom_line, partRev; tag_t* bvr_list = NULL, ebom_window = NULL, bom_line = NULL, partRev = NULL;
int bvr_count; int bvr_count = 0;
ITEM_ask_latest_rev(part, &partRev); ITKCALL(ITEM_ask_latest_rev(part, &partRev));
ITKCALL(ITEM_rev_list_bom_view_revs(partRev, &bvr_count, &bvr_list)); ITKCALL(ITEM_rev_list_bom_view_revs(partRev, &bvr_count, &bvr_list));
ITKCALL(BOM_create_window(&ebom_window)); ITKCALL(BOM_create_window(&ebom_window));
ITKCALL(BOM_set_window_top_line(ebom_window, NULL, partRev, NULLTAG, &bom_line)); ITKCALL(BOM_set_window_top_line(ebom_window, NULL, partRev, NULLTAG, &bom_line));
addToFlow(bom_line,root_task, uidMap); addToFlow(bom_line, root_task, uidMap);
ITKCALL(BOM_close_window(ebom_window)); ITKCALL(BOM_close_window(ebom_window));
} }
@ -836,23 +861,22 @@ int chint_remove_other_deisgndata(EPM_action_message_t msg) {
ECHO("=========================================================\n"); ECHO("=========================================================\n");
ECHO("chint_remove_other_deisgndata 开始执行\n"); ECHO("chint_remove_other_deisgndata 开始执行\n");
ECHO("=========================================================\n"); ECHO("=========================================================\n");
EPM_ask_root_task(msg.task, &root_task); ITKCALL(EPM_ask_root_task(msg.task, &root_task));
EPM_ask_sub_tasks(root_task, &sub_task_count, &sub_tasks); ITKCALL(EPM_ask_sub_tasks(root_task, &sub_task_count, &sub_tasks));
EPM_ask_attachments(root_task, EPM_target_attachment, &occur_of_counts, &taskAttches); ITKCALL(EPM_ask_attachments(root_task, EPM_target_attachment, &occur_of_counts, &taskAttches));
EPM_ask_attachments(root_task, EPM_reference_attachment, &occur_of_counts2, &taskAttches2); ITKCALL(EPM_ask_attachments(root_task, EPM_reference_attachment, &occur_of_counts2, &taskAttches2));
AOM_ask_value_tag(root_task, "owning_user", &owning_user); ITKCALL(AOM_ask_value_tag(root_task, "owning_user", &owning_user));
char *userId; char *userId = NULL;
AOM_ask_value_string(owning_user,"user_id",&userId); ITKCALL(AOM_ask_value_string(owning_user,"user_id",&userId));
for (int count = 0; count < occur_of_counts2; count++) for (int count = 0; count < occur_of_counts2; count++)
{ {
//ITKCALL(TCTYPE_ask_object_type(taskAttches[count], &type_tag)); //ITKCALL(TCTYPE_ask_object_type(taskAttches[count], &type_tag));
char *type, *tagId; char *type = NULL, *tagId = NULL, *os = NULL;
tag_t taskTag = taskAttches2[count], tagUser; tag_t taskTag = taskAttches2[count], tagUser;
AOM_ask_value_string(taskTag, "object_type", &type); ITKCALL(AOM_ask_value_string(taskTag, "object_type", &type));
printf("type===>%s\n", type); ITKCALL(AOM_ask_value_tag(taskTag, "owning_user", &tagUser));
AOM_ask_value_tag(taskTag, "owning_user", &tagUser); ITKCALL(AOM_ask_value_string(tagUser, "user_id", &tagId));
AOM_ask_value_string(tagUser, "user_id", &tagId);
if (strcmp(tagId, userId) != 0) { if (strcmp(tagId, userId) != 0) {
ITKCALL(EPM_remove_attachments(root_task, 1, &taskTag)); ITKCALL(EPM_remove_attachments(root_task, 1, &taskTag));
/*if (strcmp(type, "ZT2_Design3DRevision") == 0) { /*if (strcmp(type, "ZT2_Design3DRevision") == 0) {
@ -866,13 +890,69 @@ int chint_remove_other_deisgndata(EPM_action_message_t msg) {
for (int count = 0; count < occur_of_counts; count++) for (int count = 0; count < occur_of_counts; count++)
{ {
//ITKCALL(TCTYPE_ask_object_type(taskAttches[count], &type_tag)); //ITKCALL(TCTYPE_ask_object_type(taskAttches[count], &type_tag));
char *type,*tagId; char *type = NULL, *tagId = NULL, *os = NULL;
tag_t taskTag = taskAttches[count],tagUser; tag_t taskTag = taskAttches[count], tagUser = NULLTAG;
AOM_ask_value_string(taskTag, "object_type", &type); ITKCALL(AOM_ask_value_string(taskTag, "object_type", &type));
printf("type===>%s\n", type); ITKCALL(AOM_ask_value_string(taskTag, "object_string", &os));
AOM_ask_value_tag(taskTag, "owning_user", &tagUser); printf("taskTag:%s===>%s\n", os, type);
AOM_ask_value_string(tagUser, "user_id", &tagId); //物料版本和物料视图版本的权限由物料所关联的图纸的所有权进行判断
if (strcmp(tagId, userId)!=0) { //如果物料版本所关联的图纸itemid是1ZDB开头是当前流程发起人那么此物料版本不需要移除反之需要移除如果物料关联的2ZD开头的图纸那么也是不需要移除的
if (strcmp(type, "Part Revision") == 0) {
tag_t* comps = NULL;
int cnt = 0;
ITKCALL(AOM_ask_value_tags(taskTag, "TC_Is_Represented_By", &cnt, &comps));
if (cnt > 0) {
char *id = NULL;
ITKCALL(AOM_ask_value_string(comps[0], "item_id", &id));
printf("id===>%s\n", id);
if (id[0] == '2') {
continue;
}
ITKCALL(AOM_ask_value_tag(comps[0], "owning_user", &tagUser));
}
else {
continue;
}
}
else if (strcmp(type, "BOMView Revision") == 0) {
int refCnt = 0, *levels = NULL;
tag_t *refs = NULL;
char **rels = NULL;
ITKCALL(WSOM_where_referenced2(taskTag, 1, &refCnt, &levels, &refs, &rels));
for (int i = 0; i < refCnt; i++) {
printf("rels===>%s\n", rels[i]);
if (tc_strcmp(rels[i], "") == 0) {//structure_revisions
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) {
ITKCALL(AOM_ask_value_tag(taskTag, "owning_user", &tagUser));
break;
}
tag_t* comps = NULL;
int cnt = 0;
ITKCALL(AOM_ask_value_tags(refs[i], "TC_Is_Represented_By", &cnt, &comps));
if (cnt > 0) {
char *id = NULL;
ITKCALL(AOM_ask_value_string(comps[0], "item_id", &id));
printf("id===>%s\n", id);
if (id[0] == '2') {
continue;
}
ITKCALL(AOM_ask_value_tag(comps[0], "owning_user", &tagUser));
}
break;
}
}
if (tagUser == NULLTAG)
continue;
}
else {
ITKCALL(AOM_ask_value_tag(taskTag, "owning_user", &tagUser));
}
ITKCALL(AOM_ask_value_string(tagUser, "user_id", &tagId));
printf("tagId===>%s\n", tagId);
if (strcmp(tagId, userId) != 0) {
ITKCALL(EPM_remove_attachments(root_task, 1, &taskTag)); ITKCALL(EPM_remove_attachments(root_task, 1, &taskTag));
/*if (strcmp(type, "ZT2_Design3DRevision") == 0) { /*if (strcmp(type, "ZT2_Design3DRevision") == 0) {
ITKCALL(EPM_remove_attachments(root_task, 1, &taskTag)); ITKCALL(EPM_remove_attachments(root_task, 1, &taskTag));

@ -0,0 +1,402 @@
#include <tc/preferences.h>
#include <epm/epm.h>
#include <tccore\aom_prop.h>
#include <time.h>
#include "string_utils.h"
#include "ocilib.h"
#include "chint_Handler.h"
#include "epm_handler_common.h"
#include "CRUL_server_call_httpserver.h"
void get_now_str(char *date_time)
{
time_t the_time;
struct tm *time_ptr;
char *time_format = "%Y-%m-%d";
the_time = time((time_t *)0);
time_ptr = localtime(&the_time);
strftime(date_time, 128, time_format, time_ptr);
}
int create_data_file(char *file_content, char *item_id, char **file_name) {
time_t now;
struct tm *p;
FILE *filePtr = NULL;
char *temp_dir = getenv("TEMP");
char local_path[MAX_PATH] = "";
time(&now);
p = localtime(&now);
if (temp_dir[strlen(temp_dir) - 1] == '\\')
{
sprintf_s(local_path, "%s%s-%d-%d-%d-%d-%d-%d.dat", temp_dir, item_id,
1900 + p->tm_year, p->tm_mon + 1, p->tm_mday + 1, p->tm_hour, p->tm_min, p->tm_sec);
}
else
{
sprintf_s(local_path, "%s\\%s-%d-%d-%d-%d-%d-%d.dat", temp_dir, item_id,
1900 + p->tm_year, p->tm_mon + 1, p->tm_mday + 1, p->tm_hour, p->tm_min, p->tm_sec);
}
if ((filePtr = fopen(local_path, "wt")) == NULL)
{
printf("Can not create the temp dat file!\n");
return -1;
}
*file_name = (char *)MEM_alloc(sizeof(char) * 512);
strcpy((*file_name), local_path);
fwrite(file_content, sizeof(char), strlen(file_content), filePtr);
fclose(filePtr);
return ITK_ok;
}
int signoff(tag_t dataset, char *dat_file, char *ext) {
tag_t spec_dataset_rev = NULLTAG, ref_object = NULLTAG;
AE_reference_type_t reference_type;
char ref_name[WSO_name_size_c + 1] = "excel";
ITKCALL(AE_ask_dataset_latest_rev(dataset, &spec_dataset_rev));
ITKCALL(AE_ask_dataset_named_ref(spec_dataset_rev, ref_name, &reference_type, &ref_object));
if (reference_type == AE_PART_OF)
{
char pathname[SS_MAXPATHLEN] = "";
ITKCALL(IMF_ask_file_pathname(ref_object, SS_WNT_MACHINE, pathname));
char origin_file_name[IMF_filename_size_c + 1] = "";
ITKCALL(IMF_ask_original_file_name(ref_object, origin_file_name));
char new_ds_name[WSO_name_size_c + 1] = "";
char *new_file_name = USER_new_file_name(new_ds_name, ref_name, ext, 0);
char *temp_dir = getenv("temp");
temp_dir = "D:\\TEMP";
char temp_file[SS_MAXPATHLEN] = "";
strcpy(temp_file, temp_dir);
strcat(temp_file, "\\");
strcat(temp_file, new_file_name);
ITKCALL(IMF_export_file(ref_object, temp_file));
char cmd[256] = "";
strcpy(cmd, "SubstMacros-MSExcel.wsf");
strcat(cmd, " \"");
strcat(cmd, temp_file);
strcat(cmd, "\" \"");
strcat(cmd, dat_file);
strcat(cmd, "\"");
printf("cmd ==>%s\n", cmd);
system(cmd);
//strcpy(user_lib_env, local_path);
POM_AM__set_application_bypass(true);
tag_t new_file_tag = NULLTAG;
IMF_file_t file_descriptor;
ITKCALL(IMF_import_file(temp_file, new_file_name, SS_BINARY, &new_file_tag, &file_descriptor));
ITKCALL(IMF_set_original_file_name(new_file_tag, origin_file_name));
ITKCALL(IMF_close_file(file_descriptor));
ITKCALL(AOM_save(new_file_tag));
ITKCALL(AOM_unlock(new_file_tag));
ITKCALL(AOM_lock(spec_dataset_rev));
ITKCALL(AE_remove_dataset_named_ref_by_tag(spec_dataset_rev, ref_name, ref_object));
ITKCALL(AE_add_dataset_named_ref(spec_dataset_rev, ref_name, AE_PART_OF, new_file_tag));
ITKCALL(AOM_save(spec_dataset_rev));
ITKCALL(AOM_unlock(spec_dataset_rev));
POM_AM__set_application_bypass(false);
}
return ITK_ok;
}
int chint_ecn_signoff(EPM_action_message_t msg) {
printf("=========================================================\n");
printf("chint_ecn_signoff 开始执行\n");
printf("=========================================================\n");
int ifail = ITK_ok, occur_of_counts = 0, url_num = 0;
char** url_vals = NULL, *task_name = NULL;
tag_t root_task = NULLTAG, *targets = NULL;
map<string, string> sign_map;
sign_map.insert(pair<string, string>("编制", "zt2_Design"));
sign_map.insert(pair<string, string>("校对", "zt2_Proofread"));
sign_map.insert(pair<string, string>("审定", "zt2_Review"));
sign_map.insert(pair<string, string>("标准化", "zt2_Normalization"));
//sign_map.insert(pair<string, string>("会签", "zt2_Countersign"));
sign_map.insert(pair<string, string>("批准", "zt2_Approve"));
ITKCALL(EPM_ask_name2(msg.task, &task_name));
printf("task_name ==>%s\n", task_name);
//if (tc_strcmp(task_name, "会签") == 0) {
//}
ITKCALL(PREF_ask_char_values("database_tc", &url_num, &url_vals));
string url = url_vals[0];
url.append("/").append(url_vals[2]);
printf("url ==>%s\n", url.c_str());
if (ConnServer(url_vals[3], url_vals[4], (char*)url.c_str()) == -1) {
printf("中间数据表访问失败\n");
ifail = 919050;
EMH_store_error(EMH_severity_error, ifail);
return ifail;
}
ITKCALL(EPM_ask_root_task(msg.task, &root_task));
ITKCALL(EPM_ask_attachments(root_task, EPM_target_attachment, &occur_of_counts, &targets));
for (int t = 0; t < occur_of_counts; t++) {
char* type = NULL;
ITKCALL(WSOM_ask_object_type2(targets[t], &type));
if (tc_strcmp(type, "ZT2_Change") != 0) {
continue;
}
char* id = NULL;
ITKCALL(AOM_ask_value_string(targets[t], "item_id", &id));
printf("id ===>%s\n", id);
/*if (tc_strcmp(task_name, "会签") == 0) {
ITKCALL(AOM_set_value_string(targets[t], "zt2_Countersign", name.c_str()));
char now_date_str[128 + 1] = { "\0" };
get_now_str(now_date_str);
//date_t now;
//ITKCALL(ITK_string_to_date(current_date_time_str, &now));
printf("now_date_str ===>%s\n", now_date_str);
ITKCALL(AOM_set_value_string(targets[t], "zt2_CountersignTime", now_date_str));
}*/
string sql = "select \"principal\" FROM CHINT_ECN_NOTIFICATION where \"result\"='是' and \"ecncode\"='";
sql.append(id).append("'");
int outputColumn1 = 0, outputValueCount1 = 0;
char*** outputValue1 = NULL;
printf("sql ===>%s\n", sql.c_str());
QuerySQLNoInputParam((char*)sql.c_str(), &outputColumn1, &outputValueCount1, &outputValue1);
vector<string> name_vec;
for (int i = 0; i < outputValueCount1; i++) {
vector<string> names;
if (tc_strstr(outputValue1[i][0], ":") == NULL) {
Split(outputValue1[i][0], ";", names);
}
else {
Split(outputValue1[i][0], ":", names);
}
if (find(name_vec.begin(), name_vec.end(), names[0]) == name_vec.end())
name_vec.push_back(names[0]);
}
string name = "";
for (int i = 0; i < name_vec.size(); i++) {
if (name.size() > 0)
name.append(" ");
name.append(name_vec[i]);
}
printf("name ===>%s\n", name.c_str());
tag_t *datasets = NULL;
int cnt = 0;
ITKCALL(AOM_ask_value_tags(targets[t], "IMAN_reference", &cnt, &datasets));
if (cnt < 1) {
printf("未找到excel数据集\n");
continue;
}
string info = "";
map<string, string>::iterator it;
for (it = sign_map.begin(); it != sign_map.end(); it++) {
string prop = it->second.c_str();
prop.append("Time");
char *name_val = NULL, *date_val = NULL;
ITKCALL(AOM_ask_value_string(targets[t], it->second.c_str(), &name_val));
ITKCALL(AOM_ask_value_string(targets[t], prop.c_str(), &date_val));
info.append(it->first);
info.append("=");
info.append(name_val);
info.append(" ");
info.append(date_val);
info.append("|");
}
info.append("会签");
info.append("=");
info.append(name);
info.append("|");
char *data_file = NULL;
create_data_file((char*)info.c_str(), id, &data_file);
printf("data_file ==>%s\n", data_file);
for (int i = 0; i < cnt; i++) {
char* ref_type = NULL;
ITKCALL(WSOM_ask_object_type2(datasets[i], &ref_type));
if (tc_strcmp(ref_type, "MSExcelX") == 0) {
signoff(datasets[i], data_file, "xlsx");
break;
}
}
}
//if (tc_strcmp(task_name, "会签") == 0) {
//}
DisConnServer();
printf("=========================================================\n");
printf("chint_ecn_signoff 执行结束\n");
printf("=========================================================\n");
return ifail;
}
int chint_ecn_assign(EPM_action_message_t msg) {
printf("=========================================================\n");
printf("chint_ecn_assign 开始执行\n");
printf("=========================================================\n");
int ifail = ITK_ok, occur_of_counts = 0, url_num = 0;
char** url_vals = NULL, *task_name = NULL;
tag_t root_task = NULLTAG, *targets = NULL;
tag_t query_tag = NULLTAG;
ITKCALL(QRY_find2("管理 - 员工信息", &query_tag));
if (query_tag == NULL)
{
printf("未找到查询:管理 - 员工信息\n");
ifail = 919051;
EMH_store_error(EMH_severity_error, ifail);
return ifail;
}
ITKCALL(PREF_ask_char_values("database_tc", &url_num, &url_vals));
string url = url_vals[0];
url.append("/").append(url_vals[2]);
printf("url ==>%s\n", url.c_str());
if (ConnServer(url_vals[3], url_vals[4], (char*)url.c_str()) == -1) {
printf("中间数据表访问失败\n");
ifail = 919050;
ITKCALL(EMH_store_error_s1(EMH_severity_error, ifail, "database_tc"));
return ifail;
}
ITKCALL(EPM_ask_root_task(msg.task, &root_task));
ITKCALL(EPM_ask_attachments(root_task, EPM_target_attachment, &occur_of_counts, &targets));
for (int t = 0; t < occur_of_counts; t++) {
char* type = NULL;
ITKCALL(WSOM_ask_object_type2(targets[t], &type));
if (tc_strcmp(type, "ZT2_Change") != 0) {
continue;
}
char* id = NULL;
ITKCALL(AOM_ask_value_string(targets[t], "item_id", &id));
printf("id ===>%s\n", id);
string sql = "select \"principal\",\"section\" FROM CHINT_ECN_NOTIFICATION where \"result\"='是' and \"ecncode\"='";
sql.append(id).append("'");
int outputColumn1 = 0, outputValueCount1 = 0;
char*** outputValue1 = NULL;
printf("sql ===>%s\n", sql.c_str());
QuerySQLNoInputParam((char*)sql.c_str(), &outputColumn1, &outputValueCount1, &outputValue1);
printf("outputValueCount1 ===>%d\n", outputValueCount1);
//如果section列获取的数据中包含非技术部、工艺部的人员当前节点无需指派人员
boolean pro = false;
for (int i = 0; i < outputValueCount1; i++) {
if (tc_strcmp(outputValue1[i][1], "技术部") != 0 && tc_strcmp(outputValue1[i][1], "工艺部") != 0) {
pro = true;
break;
}
}
if (pro) {
continue;
}
vector<string> name_vec;
for (int i = 0; i < outputValueCount1; i++) {
printf("i ===>%d\n", i);
if (name_vec.size() > 0 && find(name_vec.begin(), name_vec.end(), outputValue1[i][0]) != name_vec.end())
continue;
name_vec.push_back(outputValue1[i][0]);
vector<string> names, names2;
Split(outputValue1[i][0], ";", names);
printf("names ===>%zd\n", names.size());
if (tc_strcmp(names[0].c_str(), "null") == 0) {
continue;
}
Split(names[0], ":", names2);
printf("names2 ===>%zd\n", names2.size());
if (find(name_vec.begin(), name_vec.end(), names2[0]) != name_vec.end())
continue;
name_vec.push_back(names2[0]);
string id = "";
if (names2.size() > 1) {
id = names2[1];
}
else {
//使用分号后的内容调用OA接口获取用户id
char *url = NULL;
ITKCALL(PREF_ask_char_value("CHINT_OA_GetUserItems", 0, &url));
if (url == NULL) {
printf("CHINT_OA_GetUserItems首选项配置不正确\n");
DisConnServer();
ifail = 919052;
EMH_store_error_s1(EMH_severity_error, ifail, "CHINT_OA_GetUserItems");
return ifail;
}
printf("url ===>%s\n", url);
string userXML = getUserIdOAUUID(names[1], url);
//printf("userXML ===>%s\n", userXML.c_str());
id = readXmlEmailId(userXML);
if (tc_strcmp(id.c_str(), "Fault") == 0) {
printf("OA获取用户ID失败\n");
id = "";
//DisConnServer();
//ifail = 919052;
//EMH_store_error_s1(EMH_severity_error, ifail, userXML.c_str());
//return ifail;
}
else {
vector<string> emailId;
Split(id, "@", emailId);
id = emailId[0];
}
}
printf("id ===>%s\n", id.c_str());
if (id.size() == 0) {
printf("未找到用户id%s\n", outputValue1[i][0]);
continue;
}
char **qkey = NULL, **qvalue = NULL, *userid = (char *)id.c_str();
int num_found = 0;
tag_t *qresult = NULL;
const char *cpxh = "用户 ID";//GbkToUtf8("产品型号").c_str();
qkey = (char **)MEM_alloc(1 * sizeof(char*));
qvalue = (char **)MEM_alloc(1 * sizeof(char*));
qkey[0] = (char *)MEM_alloc((tc_strlen(cpxh) + 1) * sizeof(char));
qvalue[0] = (char *)MEM_alloc((tc_strlen(userid) + 1) * sizeof(char));
tc_strcpy(qkey[0], cpxh);
tc_strcpy(qvalue[0], userid);
ITKCALL(QRY_execute(query_tag, 1, qkey, qvalue, &num_found, &qresult));
if (num_found == 0) {
printf("未找到用户:%s\n", userid);
DisConnServer();
ifail = 919052;
EMH_store_error_s1(EMH_severity_error, ifail, userid);
return ifail;
}
//移除当前节点指派的dcproxy账户
int signoff_count = 0;
tag_t *signoffs = NULL, parent = NULLTAG;
ITKCALL(EPM_ask_parent_task(msg.task, &parent));
ITKCALL(EPM_ask_attachments(msg.task, EPM_signoff_attachment, &signoff_count, &signoffs));
for (int i = 0; i < signoff_count; i++) {
tag_t member = NULLTAG;
SIGNOFF_TYPE_t stype;
char *name = NULL, *os = NULL, *type = NULL;
ITKCALL(EPM_ask_signoff_member(signoffs[i], &member, &stype));
ITKCALL(AOM_ask_value_string(member, "object_string", &os));
printf("member = %s\n", os);
if (tc_strstr(os, "dcproxy") != NULL) {
ITKCALL(EPM_remove_signoffs(parent, 1, &member));
}
}
//将人员指派至当前节点
int signoff_cnt = 0;
tag_t *signoff_tags = NULLTAG;
ITKCALL(EPM_create_adhoc_signoff(msg.task, qresult[0], &signoff_cnt, &signoff_tags));
}
}
DisConnServer();
POM_AM__set_application_bypass(true);
ITKCALL(EPM_promote_task(msg.task, ""));
POM_AM__set_application_bypass(false);
printf("=========================================================\n");
printf("chint_ecn_assign 执行结束\n");
printf("=========================================================\n");
return ifail;
}

@ -58,6 +58,9 @@ bool isBomViewTcm(tag_t mantr);
void TCMAndOwner(tag_t matnrTop); void TCMAndOwner(tag_t matnrTop);
int CHINT_yptask_complete(EPM_action_message_t msg); int CHINT_yptask_complete(EPM_action_message_t msg);
int chint_ecn_signoff(EPM_action_message_t msg);
int chint_ecn_assign(EPM_action_message_t msg);
//user service end //user service end
#ifdef __cplusplus #ifdef __cplusplus
} }

@ -278,6 +278,22 @@ extern DLLAPI int USERSERVICE_custom_register_handlers(int *decision, va_list ar
else { else {
printf("Registering action handler CHINT_Assignment failed %d\n", ifail); printf("Registering action handler CHINT_Assignment failed %d\n", ifail);
} }
//更改通知单新版excel文件签名
ifail = EPM_register_action_handler("chint_ecn_signoff", "chint_ecn_signoff", (EPM_action_handler_t)chint_ecn_signoff);
if (ifail == 0) {
printf("Registering action handler chint_ecn_signoff successful\n");
}
else {
printf("Registering action handler chint_ecn_signoff failed %d\n", ifail);
}
//指派变更会签节点
ifail = EPM_register_action_handler("chint_ecn_assign", "chint_ecn_assign", (EPM_action_handler_t)chint_ecn_assign);
if (ifail == 0) {
printf("Registering action handler chint_ecn_assign successful\n");
}
else {
printf("Registering action handler chint_ecn_assign failed %d\n", ifail);
}
return ifail; return ifail;
@ -307,11 +323,11 @@ extern DLLAPI int USERSERVICE_custom_register_methods(int *decision, va_list arg
int status = USERSERVICE_register_method("DbomToEMethod", functionPtr, numberOfArguments, argumentList, returnValueType); int status = USERSERVICE_register_method("DbomToEMethod", functionPtr, numberOfArguments, argumentList, returnValueType);
if (status == ITK_ok) if (status == ITK_ok)
{ {
fprintf(stdout, "Registering DbomToEMethod finished\n"); printf("Registering DbomToEMethod finished\n");
} }
else else
{ {
fprintf(stdout, "Registering DbomToEMethod failed %d\n", status); printf("Registering DbomToEMethod failed %d\n", status);
} }
MEM_free(argumentList); MEM_free(argumentList);
} }
@ -327,11 +343,11 @@ extern DLLAPI int USERSERVICE_custom_register_methods(int *decision, va_list arg
int status = USERSERVICE_register_method("DbomToEMethodUser", functionPtr, numberOfArguments, argumentList, returnValueType); int status = USERSERVICE_register_method("DbomToEMethodUser", functionPtr, numberOfArguments, argumentList, returnValueType);
if (status == ITK_ok) if (status == ITK_ok)
{ {
fprintf(stdout, "Registering DbomToEMethodUser finished\n"); printf("Registering DbomToEMethodUser finished\n");
} }
else else
{ {
fprintf(stdout, "Registering DbomToEMethodUser failed %d\n", status); printf("Registering DbomToEMethodUser failed %d\n", status);
} }
MEM_free(argumentList); MEM_free(argumentList);
} }
@ -348,11 +364,11 @@ extern DLLAPI int USERSERVICE_custom_register_methods(int *decision, va_list arg
numberOfArguments, argumentList, returnValueType); numberOfArguments, argumentList, returnValueType);
if (status == ITK_ok) if (status == ITK_ok)
{ {
fprintf(stdout, "Registering EbomToPMethod finished\n"); printf("Registering EbomToPMethod finished\n");
} }
else else
{ {
fprintf(stdout, "Registering EbomToPMethod failed %d\n", status); printf("Registering EbomToPMethod failed %d\n", status);
} }
MEM_free(argumentList); MEM_free(argumentList);
} }
@ -369,11 +385,11 @@ extern DLLAPI int USERSERVICE_custom_register_methods(int *decision, va_list arg
numberOfArguments, argumentList, returnValueType); numberOfArguments, argumentList, returnValueType);
if (status == ITK_ok) if (status == ITK_ok)
{ {
fprintf(stdout, "Registering CloneTempProcess finished\n"); printf("Registering CloneTempProcess finished\n");
} }
else else
{ {
fprintf(stdout, "Registering CloneTempProcess failed %d\n", status); printf("Registering CloneTempProcess failed %d\n", status);
} }
MEM_free(argumentList); MEM_free(argumentList);
} }
@ -390,11 +406,11 @@ extern DLLAPI int USERSERVICE_custom_register_methods(int *decision, va_list arg
numberOfArguments, argumentList, returnValueType); numberOfArguments, argumentList, returnValueType);
if (status == ITK_ok) if (status == ITK_ok)
{ {
fprintf(stdout, "Registering UpdateWorkTime finished\n"); printf("Registering UpdateWorkTime finished\n");
} }
else else
{ {
fprintf(stdout, "Registering UpdateWorkTime failed %d\n", status); printf("Registering UpdateWorkTime failed %d\n", status);
} }
MEM_free(argumentList); MEM_free(argumentList);
} }
@ -411,11 +427,11 @@ extern DLLAPI int USERSERVICE_custom_register_methods(int *decision, va_list arg
numberOfArguments, argumentList, returnValueType); numberOfArguments, argumentList, returnValueType);
if (status == ITK_ok) if (status == ITK_ok)
{ {
fprintf(stdout, "Registering AutoFeeding finished\n"); printf("Registering AutoFeeding finished\n");
} }
else else
{ {
fprintf(stdout, "Registering AutoFeeding failed %d\n", status); printf("Registering AutoFeeding failed %d\n", status);
} }
MEM_free(argumentList); MEM_free(argumentList);
} }

@ -20,7 +20,7 @@
extern "C" { extern "C" {
#endif #endif
extern DLLAPI int USERSERVICE_custom_register_handlers(int *, va_list); extern DLLAPI int USERSERVICE_custom_register_handlers(int* decision, va_list args);
extern DLLAPI int USERSERVICE_custom_register_methods(int *decision, va_list args); extern DLLAPI int USERSERVICE_custom_register_methods(int *decision, va_list args);
extern int Register_revise_msg( void ); extern int Register_revise_msg( void );

@ -23,9 +23,9 @@ extern "C" {
DLLAPI int General_register_callbacks()//注意此处的General即dll的名称若是写错注册会失败 DLLAPI int General_register_callbacks()//注意此处的General即dll的名称若是写错注册会失败
{ {
int ifail = ITK_ok; int ifail = ITK_ok;
TC_write_syslog("*******************************************************************************\n"); printf("*******************************************************************************\n");
TC_write_syslog("* General_register_callbacks is starting *\n"); printf("* General_register_callbacks is starting *\n");
TC_write_syslog("*******************************************************************************\n"); printf("*******************************************************************************\n");
@ -40,13 +40,13 @@ extern "C" {
//USERSERVICE_custom_register_handlers是具体的注册handler的文件 //USERSERVICE_custom_register_handlers是具体的注册handler的文件
ITKCALL( ifail = CUSTOM_register_exit("General","USER_gs_shell_init_module",//注意此处的General即dll的名称若是写错注册会失败 ITKCALL( ifail = CUSTOM_register_exit("General","USER_gs_shell_init_module",//注意此处的General即dll的名称若是写错注册会失败
(CUSTOM_EXIT_ftn_t)USERSERVICE_custom_register_handlers) ); (CUSTOM_EXIT_ftn_t)USERSERVICE_custom_register_handlers) );
fprintf( stdout, "\n General registering USERSERVICE_custom_register_handlers completed!\n" ); printf( "\n General registering USERSERVICE_custom_register_handlers completed!\n" );
ITKCALL(ifail = CUSTOM_register_exit("General", "USERSERVICE_register_methods", (CUSTOM_EXIT_ftn_t)USERSERVICE_custom_register_methods)); ITKCALL(ifail = CUSTOM_register_exit("General", "USERSERVICE_register_methods", (CUSTOM_EXIT_ftn_t)USERSERVICE_custom_register_methods));
if (ifail == ITK_ok) { if (ifail == ITK_ok) {
fprintf(stdout, "USERSERVICE_register_methods ×¢²á³É¹¦£¡\n"); printf("General_register_callbacks 注册成功!\n");
} }
else { else {
fprintf(stdout, "USERSERVICE_register_methods ×¢²áʧ°Ü£¡\n"); printf("General_register_callbacks 注册失败:%d\n", ifail);
} }

@ -78,6 +78,10 @@ void Split(string strArg, string spliter, vector<string>& ans)
strArg = strArg.substr(index0 + spliter.size()); strArg = strArg.substr(index0 + spliter.size());
ans.push_back(one_arg); ans.push_back(one_arg);
} }
if (strArg.size() < 1) {
ans.push_back(strArg);
break;
}
} }
else else
{ {

Loading…
Cancel
Save