|
|
|
@ -33,6 +33,7 @@
|
|
|
|
|
#include <ss/ss_errors.h>
|
|
|
|
|
#include <ae/datasettype.h>
|
|
|
|
|
// #include "hx_custom.h"
|
|
|
|
|
#include <chrono>
|
|
|
|
|
#include <regex>
|
|
|
|
|
#include "tc_log.h"
|
|
|
|
|
// #include "jk_custom.h"
|
|
|
|
@ -53,6 +54,7 @@ struct NodeBean
|
|
|
|
|
vector<tag_t> ccps;//产成品
|
|
|
|
|
int xnNum = 1;//虚拟件数量累乘
|
|
|
|
|
boolean isOutBuy = false;//记录是否外购、或者权限不是自己的
|
|
|
|
|
string remark; //备注
|
|
|
|
|
};
|
|
|
|
|
bool isTcm(tag_t mantr) {
|
|
|
|
|
int releaseCount = 0;
|
|
|
|
@ -116,8 +118,8 @@ tag_t getSapPart(tag_t designRevLine, tag_t designRev, string& errBuff, NodeBean
|
|
|
|
|
int num = 0;
|
|
|
|
|
tag_t* mantrs;
|
|
|
|
|
char *type, *item_id;
|
|
|
|
|
AOM_ask_value_string(designRev, "object_type", &type);
|
|
|
|
|
AOM_ask_value_string(designRev, "item_id", &item_id);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(designRev, "object_type", &type));
|
|
|
|
|
ITKCALL(AOM_ask_value_string(designRev, "item_id", &item_id));
|
|
|
|
|
if (strcmp(type, "Part Revision") == 0) {
|
|
|
|
|
return designRev;
|
|
|
|
|
}
|
|
|
|
@ -128,12 +130,12 @@ tag_t getSapPart(tag_t designRevLine, tag_t designRev, string& errBuff, NodeBean
|
|
|
|
|
map<string, tag_t> partsCcp;
|
|
|
|
|
for (int i = 0; i < num; i++) {
|
|
|
|
|
char* type, *zt2_ifpbom, *itemId;
|
|
|
|
|
AOM_ask_value_string(mantrs[i], "object_type", &type);
|
|
|
|
|
AOM_ask_value_string(mantrs[i], "zt2_ifpbom", &zt2_ifpbom);
|
|
|
|
|
AOM_ask_value_string(mantrs[i], "item_id", &itemId);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(mantrs[i], "object_type", &type));
|
|
|
|
|
ITKCALL(AOM_ask_value_string(mantrs[i], "zt2_ifpbom", &zt2_ifpbom));
|
|
|
|
|
ITKCALL(AOM_ask_value_string(mantrs[i], "item_id", &itemId));
|
|
|
|
|
if (strstr(type, "Part") != NULL && strcmp(zt2_ifpbom, "P") != 0) { //
|
|
|
|
|
tag_t matnrItem;
|
|
|
|
|
ITEM_ask_item_of_rev(mantrs[i], &matnrItem);
|
|
|
|
|
ITKCALL(ITEM_ask_item_of_rev(mantrs[i], &matnrItem));
|
|
|
|
|
partsCcp[itemId] = matnrItem;
|
|
|
|
|
//partsCcp.push_back();
|
|
|
|
|
/*if (parts.size()==0) {
|
|
|
|
@ -149,7 +151,7 @@ tag_t getSapPart(tag_t designRevLine, tag_t designRev, string& errBuff, NodeBean
|
|
|
|
|
for (it = partsCcp.begin(); it != partsCcp.end(); it++) {
|
|
|
|
|
string s = it->first;
|
|
|
|
|
tag_t partLast = partsCcp[s], partRevLast;
|
|
|
|
|
ITEM_ask_latest_rev(partLast, &partRevLast);
|
|
|
|
|
ITKCALL(ITEM_ask_latest_rev(partLast, &partRevLast));
|
|
|
|
|
if (parts.size() == 0) {
|
|
|
|
|
parts.push_back(partRevLast);
|
|
|
|
|
}
|
|
|
|
@ -163,12 +165,12 @@ tag_t getSapPart(tag_t designRevLine, tag_t designRev, string& errBuff, NodeBean
|
|
|
|
|
map<string, tag_t> partsCcp;
|
|
|
|
|
for (int i = 0; i < num; i++) {
|
|
|
|
|
char* type, *zt2_ifpbom, *itemId;
|
|
|
|
|
AOM_ask_value_string(mantrs[i], "object_type", &type);
|
|
|
|
|
AOM_ask_value_string(mantrs[i], "zt2_ifpbom", &zt2_ifpbom);
|
|
|
|
|
AOM_ask_value_string(mantrs[i], "item_id", &itemId);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(mantrs[i], "object_type", &type));
|
|
|
|
|
ITKCALL(AOM_ask_value_string(mantrs[i], "zt2_ifpbom", &zt2_ifpbom));
|
|
|
|
|
ITKCALL(AOM_ask_value_string(mantrs[i], "item_id", &itemId));
|
|
|
|
|
if (strstr(type, "Part") != NULL && strcmp(zt2_ifpbom, "P") != 0) { //
|
|
|
|
|
tag_t matnrItem;
|
|
|
|
|
ITEM_ask_item_of_rev(mantrs[i], &matnrItem);
|
|
|
|
|
ITKCALL(ITEM_ask_item_of_rev(mantrs[i], &matnrItem));
|
|
|
|
|
partsCcp[itemId] = matnrItem;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -176,7 +178,7 @@ tag_t getSapPart(tag_t designRevLine, tag_t designRev, string& errBuff, NodeBean
|
|
|
|
|
for (it = partsCcp.begin(); it != partsCcp.end(); it++) {
|
|
|
|
|
string s = it->first;
|
|
|
|
|
tag_t partLast = partsCcp[s], partRevLast;
|
|
|
|
|
ITEM_ask_latest_rev(partLast, &partRevLast);
|
|
|
|
|
ITKCALL(ITEM_ask_latest_rev(partLast, &partRevLast));
|
|
|
|
|
//if (parts.size() == 0) {
|
|
|
|
|
//}
|
|
|
|
|
parts.push_back(partRevLast);
|
|
|
|
@ -259,7 +261,7 @@ tag_t getSapPart(tag_t designRevLine, tag_t designRev, string& errBuff, NodeBean
|
|
|
|
|
for (int i = 0; i < parts.size(); i++) {
|
|
|
|
|
tag_t part = parts[i];
|
|
|
|
|
char* specPart;
|
|
|
|
|
AOM_ask_value_string(part, "zt2_Specifications", &specPart);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(part, "zt2_Specifications", &specPart));
|
|
|
|
|
if (strcmp(specPart, spec) == 0) {
|
|
|
|
|
return part;
|
|
|
|
|
}
|
|
|
|
@ -285,6 +287,84 @@ tag_t getSapPart(tag_t designRevLine, tag_t designRev, string& errBuff, NodeBean
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 检查part子项
|
|
|
|
|
* @param bom_line part的BOM
|
|
|
|
|
* @param errBuff 记录错误信息
|
|
|
|
|
*/
|
|
|
|
|
void checkPart(tag_t bom_line, string& errBuff) {
|
|
|
|
|
tag_t part = NULLTAG;
|
|
|
|
|
ITKCALL(AOM_ask_value_tag(bom_line, "bl_line_object", &part));
|
|
|
|
|
char* name, *partId, **sealeds, **factorys, *matnr, **procureType;
|
|
|
|
|
ITKCALL(AOM_refresh(part, false));
|
|
|
|
|
ITKCALL(AOM_ask_value_string(part, "object_name", &name));
|
|
|
|
|
//printf("name%s\n", name);
|
|
|
|
|
int cnt2, numFac, cnt3;
|
|
|
|
|
//检查物料是否可用
|
|
|
|
|
ITKCALL(AOM_ask_value_string(part, "item_id", &partId));
|
|
|
|
|
ITKCALL(AOM_ask_value_string(part, "zt2_MaterialNo", &matnr));
|
|
|
|
|
if (strcmp(matnr, "") == 0) {
|
|
|
|
|
string buffErr = "";
|
|
|
|
|
buffErr.append("物料:").append(partId).append("/").append(name).append("没有物料编码.\n");
|
|
|
|
|
size_t found = errBuff.find(buffErr);
|
|
|
|
|
if (found == std::string::npos) {
|
|
|
|
|
errBuff.append(buffErr);
|
|
|
|
|
}
|
|
|
|
|
//errBuff.append("物料:").append(partId).append("/").append(name).append("没有物料编码.\n");
|
|
|
|
|
//return;
|
|
|
|
|
}
|
|
|
|
|
boolean numFlag = true;
|
|
|
|
|
ITKCALL(AOM_ask_value_strings(part, "zt2_SZSealedornot", &cnt2, &sealeds));
|
|
|
|
|
ITKCALL(AOM_ask_value_strings(part, "zt2_SZFactory", &numFac, &factorys));
|
|
|
|
|
ITKCALL(AOM_ask_value_strings(part, "zt2_SZProcuretype", &cnt3, &procureType)); //包含自制
|
|
|
|
|
for (int i = 0; i < numFac; i++) {
|
|
|
|
|
if (strcmp(factorys[i], "M060") == 0) {
|
|
|
|
|
numFlag = false;
|
|
|
|
|
}
|
|
|
|
|
if (strcmp(factorys[i], "M060") == 0 && cnt2 > i) {
|
|
|
|
|
if (strcmp(sealeds[i], "Y") == 0) {
|
|
|
|
|
//errBuff.append("物料:").append(partId).append("/").append(name).append("已封存无法转换EBOM.\n");
|
|
|
|
|
string buffErr = "";
|
|
|
|
|
buffErr.append("物料:").append(partId).append("/").append(name).append("已封存无法转换EBOM.\n");
|
|
|
|
|
size_t found = errBuff.find(buffErr);
|
|
|
|
|
if (found == std::string::npos) {
|
|
|
|
|
errBuff.append(buffErr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//if (cnt3 > i && strstr(procureType[i], "自制") != NULL) {
|
|
|
|
|
// flagMat = true;
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
char*objName;
|
|
|
|
|
ITKCALL(AOM_ask_value_string(part, OBJECT_NAME, &objName));
|
|
|
|
|
if (numFlag && strstr(objName, CCP_NAME) == NULL) {// || (strstr(partId,"2ZD")!=NULL|| strstr(partId, "4ZD") != NULL)
|
|
|
|
|
string buffErr = "";
|
|
|
|
|
buffErr.append("物料:").append(partId).append("/").append(name).append("物料视图没有维护,请检查.\n");
|
|
|
|
|
size_t found = errBuff.find(buffErr);
|
|
|
|
|
if (found == std::string::npos) {
|
|
|
|
|
errBuff.append(buffErr);
|
|
|
|
|
}
|
|
|
|
|
//errBuff.append("物料:").append(partId).append("/").append(name).append("物料视图没有维护,请检查.\n");
|
|
|
|
|
}
|
|
|
|
|
char *sffc = NULL;
|
|
|
|
|
ITKCALL(AOM_ask_value_string(part, "zt2_State", &sffc));
|
|
|
|
|
if (strcmp(sffc, "D1") == 0 || strcmp(sffc, "封存") == 0) {
|
|
|
|
|
string buffErr = "";
|
|
|
|
|
buffErr.append("物料:").append(partId).append("/").append(name).append("已封存无法转换EBOM.\n");
|
|
|
|
|
size_t found = errBuff.find(buffErr);
|
|
|
|
|
if (found == std::string::npos) {
|
|
|
|
|
errBuff.append(buffErr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
int c_line_count = 0;
|
|
|
|
|
tag_t *c_line_tags = NULL;
|
|
|
|
|
ITKCALL(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags));
|
|
|
|
|
for (int i = 0; i < c_line_count; i++) {
|
|
|
|
|
checkPart(c_line_tags[i], errBuff);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 遍历DBOM
|
|
|
|
|
* @param bom_line DBOM的父级
|
|
|
|
@ -293,6 +373,7 @@ tag_t getSapPart(tag_t designRevLine, tag_t designRev, string& errBuff, NodeBean
|
|
|
|
|
* @param designRev 图纸版本
|
|
|
|
|
* @param 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;
|
|
|
|
|
ITKCALL(AOM_ask_value_string(bom_line, "bl_sequence_no", &bl_sequence_no));
|
|
|
|
@ -324,7 +405,7 @@ void askLineVal(NodeBean& bean, tag_t bom_line, tag_t designRev, string& errBuff
|
|
|
|
|
char* name, *partId, **sealeds, **factorys, *matnr, **procureType;
|
|
|
|
|
ITKCALL(AOM_refresh(part, false));
|
|
|
|
|
ITKCALL(AOM_ask_value_string(part, "object_name", &name));
|
|
|
|
|
printf("name%s\n", name);
|
|
|
|
|
//printf("name%s\n", name);
|
|
|
|
|
int cnt2, numFac, cnt3;
|
|
|
|
|
//检查物料是否可用
|
|
|
|
|
ITKCALL(AOM_ask_value_string(part, "item_id", &partId));
|
|
|
|
@ -363,7 +444,7 @@ void askLineVal(NodeBean& bean, tag_t bom_line, tag_t designRev, string& errBuff
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
char*objName;
|
|
|
|
|
AOM_ask_value_string(part, OBJECT_NAME, &objName);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(part, OBJECT_NAME, &objName));
|
|
|
|
|
if (numFlag && strstr(objName, CCP_NAME) == NULL) {// || (strstr(partId,"2ZD")!=NULL|| strstr(partId, "4ZD") != NULL)
|
|
|
|
|
string buffErr = "";
|
|
|
|
|
buffErr.append("物料:").append(partId).append("/").append(name).append("物料视图没有维护,请检查.\n");
|
|
|
|
@ -383,11 +464,21 @@ void askLineVal(NodeBean& bean, tag_t bom_line, tag_t designRev, string& errBuff
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bean.mantr = part;
|
|
|
|
|
/*
|
|
|
|
|
tag_t ebom_window = NULLTAG, line = NULLTAG;
|
|
|
|
|
ITKCALL(BOM_create_window(&ebom_window));
|
|
|
|
|
ITKCALL(BOM_set_window_top_line(ebom_window, NULL, part, NULLTAG, &line));
|
|
|
|
|
int c_line_count = 0;
|
|
|
|
|
tag_t *c_line_tags = NULL;
|
|
|
|
|
ITKCALL(BOM_line_ask_all_child_lines(line, &c_line_count, &c_line_tags));
|
|
|
|
|
for (int i = 0; i < c_line_count; i++) {
|
|
|
|
|
checkPart(c_line_tags[i], errBuff);
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
char *partId, *name;
|
|
|
|
|
AOM_ask_value_string(designRev, "item_id", &partId);
|
|
|
|
|
AOM_ask_value_string(designRev, "object_name", &name);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(designRev, "item_id", &partId));
|
|
|
|
|
ITKCALL(AOM_ask_value_string(designRev, "object_name", &name));
|
|
|
|
|
|
|
|
|
|
string buffErr = "";
|
|
|
|
|
buffErr.append("图纸:").append(partId).append("/").append(name).append("下未找到物料对象.\n");
|
|
|
|
@ -407,8 +498,8 @@ void askLineVal(NodeBean& bean, tag_t bom_line, tag_t designRev, string& errBuff
|
|
|
|
|
*/
|
|
|
|
|
string getTyjZl(tag_t bom_line, string materialutilization, tag_t desginRev, string &errMessage) {
|
|
|
|
|
char *ZT2_TYSpecifications, *ZT2_TYWeight, *item_id;
|
|
|
|
|
AOM_ask_value_string(bom_line, "item_id", &item_id);
|
|
|
|
|
AOM_ask_value_string(bom_line, "ZT2_TYSpecifications", &ZT2_TYSpecifications);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(bom_line, "bl_item_item_id", &item_id));
|
|
|
|
|
ITKCALL(AOM_ask_value_string(bom_line, "ZT2_TYSpecifications", &ZT2_TYSpecifications));
|
|
|
|
|
double lyl = 0.85;
|
|
|
|
|
char strff[21];
|
|
|
|
|
if (!materialutilization.empty()) {
|
|
|
|
@ -416,7 +507,7 @@ string getTyjZl(tag_t bom_line, string materialutilization, tag_t desginRev, str
|
|
|
|
|
}
|
|
|
|
|
if (strcmp(ZT2_TYSpecifications, "") == 0) {
|
|
|
|
|
double weight = 0;
|
|
|
|
|
AOM_ask_value_double(desginRev, "zt2_DesignWeight", &weight);
|
|
|
|
|
ITKCALL(AOM_ask_value_double(desginRev, "zt2_DesignWeight", &weight));
|
|
|
|
|
if (weight == 0) {
|
|
|
|
|
errMessage.append(item_id).append("未填写设计重量;\n");
|
|
|
|
|
return "0";
|
|
|
|
@ -425,7 +516,7 @@ string getTyjZl(tag_t bom_line, string materialutilization, tag_t desginRev, str
|
|
|
|
|
sprintf(strff, "%.3f", two);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
AOM_ask_value_string(bom_line, "ZT2_TYWeight", &ZT2_TYWeight);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(bom_line, "ZT2_TYWeight", &ZT2_TYWeight));
|
|
|
|
|
if (strcmp(ZT2_TYWeight, "") == 0) {
|
|
|
|
|
errMessage.append(item_id).append("未填写通用件重量;\n");
|
|
|
|
|
return "0";
|
|
|
|
@ -541,16 +632,15 @@ void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 i = 0; i < c_line_count; i++) {
|
|
|
|
|
logical flag;
|
|
|
|
|
BOM_line_is_packed(c_line_tags[i], &flag);
|
|
|
|
|
ITKCALL(BOM_line_is_packed(c_line_tags[i], &flag));
|
|
|
|
|
if (flag) {
|
|
|
|
|
BOM_line_unpack(c_line_tags[i]);
|
|
|
|
|
ITKCALL(BOM_line_unpack(c_line_tags[i]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
AOM_refresh(bom_line, FALSE);
|
|
|
|
|
AOM_refresh(bom_line, FALSE);*/
|
|
|
|
|
ITKCALL(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags));
|
|
|
|
|
//转换时原材料展开逻辑
|
|
|
|
|
if (c_line_count == 0 && !dbName.empty() && (strstr(itemId, "1ZD") != NULL ||
|
|
|
|
@ -590,6 +680,7 @@ void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName
|
|
|
|
|
cBean.bl_sequence_no = "10";
|
|
|
|
|
cBean.bl_plmxml_occ_xform = "";
|
|
|
|
|
cBean.mantr = materialRev;
|
|
|
|
|
cBean.remark = "";
|
|
|
|
|
pBean.childs.push_back(cBean);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -600,45 +691,62 @@ void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName
|
|
|
|
|
//检查是否线圈
|
|
|
|
|
regex qq_reg2("^1ZDB5.*\\d{1,}1000X.*");
|
|
|
|
|
bool ret = regex_match(item_id, result, qq_reg2);
|
|
|
|
|
vector<string> uidVec;
|
|
|
|
|
for (int i = 0; i < c_line_count; i++) {
|
|
|
|
|
logical suppressed;
|
|
|
|
|
ITKCALL(AOM_ask_value_logical(c_line_tags[i], "bl_is_occ_suppressed", &suppressed));
|
|
|
|
|
if (suppressed) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
char* os = NULL;
|
|
|
|
|
ITKCALL(AOM_ask_value_string(c_line_tags[i], "object_string", &os));
|
|
|
|
|
//修改过之后之前已经是解包的状态了
|
|
|
|
|
logical flag;
|
|
|
|
|
char *remark;
|
|
|
|
|
ITKCALL(BOM_line_is_packed(c_line_tags[i], &flag));
|
|
|
|
|
//printf("flag===>%d\n", flag);
|
|
|
|
|
printf("flag1=%d==>%s\n", flag, os);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(c_line_tags[i], "ZT2_Remark", &remark));
|
|
|
|
|
//printf("recyReadBom:%s\n", remark);
|
|
|
|
|
if (flag) {
|
|
|
|
|
int count = 0;
|
|
|
|
|
char *topNum;
|
|
|
|
|
ITKCALL(AOM_ask_value_string(c_line_tags[i], "bl_quantity", &topNum));
|
|
|
|
|
tag_t* packLines;
|
|
|
|
|
ITKCALL(BOM_line_ask_packed_lines(c_line_tags[i], &count, &packLines));
|
|
|
|
|
for (int t = 0; t < count; t++) {
|
|
|
|
|
printf("packLines:%d\n", count);
|
|
|
|
|
/*for (int t = 0; t < count; t++) {
|
|
|
|
|
tag_t c_Rev;
|
|
|
|
|
ITKCALL(AOM_ask_value_tag(packLines[t], "bl_line_object", &c_Rev));
|
|
|
|
|
char* cUid;
|
|
|
|
|
ITK__convert_tag_to_uid(c_Rev, &cUid);
|
|
|
|
|
//if (find(uidVec.begin(), uidVec.end(), cUid) != uidVec.end()) {
|
|
|
|
|
// continue;
|
|
|
|
|
//}
|
|
|
|
|
//uidVec.push_back(cUid);
|
|
|
|
|
NodeBean cBean;
|
|
|
|
|
cBean.revUid = cUid;
|
|
|
|
|
cBean.designRev = c_Rev;
|
|
|
|
|
cBean.packNum = count + 1;
|
|
|
|
|
cBean.topNum = atoi(topNum);
|
|
|
|
|
cBean.remark = remark;
|
|
|
|
|
recyReadBom(c_line_tags[i], cBean, errBuff, dbName, loginUserId);
|
|
|
|
|
pBean.childs.push_back(cBean);
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
AOM_refresh(c_line_tags[i], FALSE);
|
|
|
|
|
tag_t c_Rev;
|
|
|
|
|
ITKCALL(AOM_ask_value_tag(c_line_tags[i], "bl_line_object", &c_Rev));
|
|
|
|
|
char* cUid;
|
|
|
|
|
ITK__convert_tag_to_uid(c_Rev, &cUid);
|
|
|
|
|
/*if (find(uidVec.begin(), uidVec.end(), cUid) != uidVec.end()) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
uidVec.push_back(cUid);*/
|
|
|
|
|
NodeBean cBean;
|
|
|
|
|
cBean.revUid = cUid;
|
|
|
|
|
cBean.designRev = c_Rev;
|
|
|
|
|
cBean.packNum = count + 1;
|
|
|
|
|
cBean.topNum = atoi(topNum);
|
|
|
|
|
cBean.remark = remark;
|
|
|
|
|
recyReadBom(c_line_tags[i], cBean, errBuff, dbName, loginUserId);
|
|
|
|
|
pBean.childs.push_back(cBean);
|
|
|
|
|
|
|
|
|
@ -646,30 +754,34 @@ void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName
|
|
|
|
|
else {
|
|
|
|
|
//检查E转P时的拆分逻辑
|
|
|
|
|
tag_t c_Rev;
|
|
|
|
|
char *seqNo, *c_type, *remark, *bl_quantity, *bl_line_name;
|
|
|
|
|
char *seqNo, *c_type, *bl_quantity, *bl_line_name;
|
|
|
|
|
ITKCALL(AOM_ask_value_tag(c_line_tags[i], "bl_line_object", &c_Rev));
|
|
|
|
|
char* id;
|
|
|
|
|
AOM_ask_value_string(c_Rev, "item_id", &id);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(c_Rev, "item_id", &id));
|
|
|
|
|
//获取BOM行的REMARK
|
|
|
|
|
if (ret) {
|
|
|
|
|
AOM_ask_value_string(c_line_tags[i], "ZT2_Remark", &remark);
|
|
|
|
|
AOM_ask_value_string(c_line_tags[i], "bl_quantity", &bl_quantity);
|
|
|
|
|
AOM_ask_value_string(c_line_tags[i], "bl_line_name", &bl_line_name);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(c_line_tags[i], "bl_quantity", &bl_quantity));
|
|
|
|
|
ITKCALL(AOM_ask_value_string(c_line_tags[i], "bl_line_name", &bl_line_name));
|
|
|
|
|
getRemarkMsg(remark, xsLen, errBuff, bl_quantity, itemId, id, bl_line_name);
|
|
|
|
|
}
|
|
|
|
|
//新增逻辑 当前对象类型为ZT2_XNZJB 虚拟组件包时 进行削层处理 数量*虚拟层数量
|
|
|
|
|
AOM_ask_value_string(c_Rev, "object_type", &c_type);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(c_Rev, "object_type", &c_type));
|
|
|
|
|
if (strcmp(c_type, "ZT2_XNZJBRevision") == 0) {
|
|
|
|
|
xnzjbVec.push_back(c_line_tags[i]);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
AOM_ask_value_string(c_line_tags[i], "bl_sequence_no", &seqNo);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(c_line_tags[i], "bl_sequence_no", &seqNo));
|
|
|
|
|
maxSeqNo = seqNo;
|
|
|
|
|
char* cUid;
|
|
|
|
|
ITK__convert_tag_to_uid(c_Rev, &cUid);
|
|
|
|
|
/*if (find(uidVec.begin(), uidVec.end(), cUid) != uidVec.end()) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
uidVec.push_back(cUid);*/
|
|
|
|
|
NodeBean cBean;
|
|
|
|
|
cBean.revUid = cUid;
|
|
|
|
|
cBean.designRev = c_Rev;
|
|
|
|
|
cBean.remark = remark;
|
|
|
|
|
recyReadBom(c_line_tags[i], cBean, errBuff, dbName, loginUserId);
|
|
|
|
|
pBean.childs.push_back(cBean);
|
|
|
|
|
}
|
|
|
|
@ -705,7 +817,7 @@ void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName
|
|
|
|
|
ITKCALL(AOM_ask_value_string(designRev, "object_name", &object_name));
|
|
|
|
|
//printf("type===>%s\n", type);
|
|
|
|
|
if (strcmp(type, "ZT2_Design3DRevision") == 0) {
|
|
|
|
|
AOM_ask_value_string(designRev, "zt2_Diagram", &zt2_Diagram);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(designRev, "zt2_Diagram", &zt2_Diagram));
|
|
|
|
|
if (strcmp(zt2_Diagram, "Y") == 0 || strcmp(zt2_Diagram, "是") == 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -740,28 +852,28 @@ void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (strstr(itemId, "1ZD") != NULL) {
|
|
|
|
|
AOM_ask_value_string(designRev, "zt2_Source", &source);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(designRev, "zt2_Source", &source));
|
|
|
|
|
if (strcmp(source, "S2") == 0 || strcmp(source, "外购") == 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 i = 0; i < c_line_count; i++) {
|
|
|
|
|
logical flag;
|
|
|
|
|
BOM_line_is_packed(c_line_tags[i], &flag);
|
|
|
|
|
ITKCALL(BOM_line_is_packed(c_line_tags[i], &flag));
|
|
|
|
|
if (flag) {
|
|
|
|
|
BOM_line_unpack(c_line_tags[i]);
|
|
|
|
|
ITKCALL(BOM_line_unpack(c_line_tags[i]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
AOM_refresh(bom_line, FALSE);
|
|
|
|
|
(AOM_refresh(bom_line, FALSE));*/
|
|
|
|
|
ITKCALL(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags));
|
|
|
|
|
//转换时原材料展开逻辑
|
|
|
|
|
if (c_line_count == 0 && !dbName.empty() && (strstr(itemId, "1ZD") != NULL ||
|
|
|
|
|
strstr(itemId, "2ZD") != NULL || strstr(itemId, "4ZD") != NULL)) {
|
|
|
|
|
//原材料展开
|
|
|
|
|
char *zt2_MaterialMark;
|
|
|
|
|
AOM_ask_value_string(designRev, "zt2_MaterialMark", &zt2_MaterialMark);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(designRev, "zt2_MaterialMark", &zt2_MaterialMark));
|
|
|
|
|
//String zt2_MaterialMark = rev.getProperty("zt2_MaterialMark")
|
|
|
|
|
string sql = "select materialno, materialutilization, materialunit FROM %s where materialmark = '%s'";
|
|
|
|
|
char selectRxfs[500];
|
|
|
|
@ -785,8 +897,8 @@ void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName
|
|
|
|
|
string materialutilization = outputValue1[t][1];
|
|
|
|
|
string materialunit = outputValue1[t][2];
|
|
|
|
|
tag_t material, materialRev;
|
|
|
|
|
ITEM_find_item(materialno.c_str(), &material);
|
|
|
|
|
ITEM_ask_latest_rev(material, &materialRev);
|
|
|
|
|
ITKCALL(ITEM_find_item(materialno.c_str(), &material));
|
|
|
|
|
ITKCALL(ITEM_ask_latest_rev(material, &materialRev));
|
|
|
|
|
string bl_qty = getTyjZl(bom_line, materialutilization, designRev, errBuff);
|
|
|
|
|
printf("bl_qty%s\n", bl_qty.c_str());
|
|
|
|
|
NodeBean cBean;
|
|
|
|
@ -794,50 +906,67 @@ void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName
|
|
|
|
|
cBean.bl_sequence_no = "10";
|
|
|
|
|
cBean.bl_plmxml_occ_xform = "";
|
|
|
|
|
cBean.mantr = materialRev;
|
|
|
|
|
cBean.remark = "";
|
|
|
|
|
pBean.childs.push_back(cBean);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
string maxSeqNo;
|
|
|
|
|
vector<tag_t> xnzjbVec;
|
|
|
|
|
vector<string> uidVec;
|
|
|
|
|
for (int i = 0; i < c_line_count; i++) {
|
|
|
|
|
logical suppressed;
|
|
|
|
|
AOM_ask_value_logical(c_line_tags[i], "bl_is_occ_suppressed", &suppressed);
|
|
|
|
|
char *remark;
|
|
|
|
|
ITKCALL(AOM_ask_value_string(c_line_tags[i], "ZT2_Remark", &remark));
|
|
|
|
|
//printf("recyReadBom2:%s\n", remark);
|
|
|
|
|
ITKCALL(AOM_ask_value_logical(c_line_tags[i], "bl_is_occ_suppressed", &suppressed));
|
|
|
|
|
if (suppressed) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
//修改过之后之前已经是解包的状态了
|
|
|
|
|
logical flag;
|
|
|
|
|
BOM_line_is_packed(c_line_tags[i], &flag);
|
|
|
|
|
//printf("flag===>%d\n", flag);
|
|
|
|
|
ITKCALL(BOM_line_is_packed(c_line_tags[i], &flag));
|
|
|
|
|
printf("flag2===>%d\n", flag);
|
|
|
|
|
if (flag) {
|
|
|
|
|
int count = 0;
|
|
|
|
|
char *topNum;
|
|
|
|
|
AOM_ask_value_string(c_line_tags[i], "bl_quantity", &topNum);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(c_line_tags[i], "bl_quantity", &topNum));
|
|
|
|
|
tag_t* packLines;
|
|
|
|
|
BOM_line_ask_packed_lines(c_line_tags[i], &count, &packLines);
|
|
|
|
|
for (int t = 0; t < count; t++) {
|
|
|
|
|
ITKCALL(BOM_line_ask_packed_lines(c_line_tags[i], &count, &packLines));
|
|
|
|
|
printf("packLines:%d\n", count);
|
|
|
|
|
/*for (int t = 0; t < count; t++) {
|
|
|
|
|
tag_t c_Rev;
|
|
|
|
|
ITKCALL(AOM_ask_value_tag(packLines[t], "bl_line_object", &c_Rev));
|
|
|
|
|
char* cUid;
|
|
|
|
|
ITK__convert_tag_to_uid(c_Rev, &cUid);
|
|
|
|
|
//打包
|
|
|
|
|
//if (find(uidVec.begin(), uidVec.end(), cUid) != uidVec.end()) {
|
|
|
|
|
// continue;
|
|
|
|
|
//}
|
|
|
|
|
//uidVec.push_back(cUid);
|
|
|
|
|
NodeBean cBean;
|
|
|
|
|
cBean.revUid = cUid;
|
|
|
|
|
cBean.designRev = c_Rev;
|
|
|
|
|
cBean.packNum = count + 1;
|
|
|
|
|
cBean.topNum = atoi(topNum);
|
|
|
|
|
cBean.remark = remark;
|
|
|
|
|
recyReadBom(c_line_tags[i], cBean, errBuff, dbName, idVector);
|
|
|
|
|
pBean.childs.push_back(cBean);
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
AOM_refresh(c_line_tags[i], FALSE);
|
|
|
|
|
tag_t c_Rev;
|
|
|
|
|
ITKCALL(AOM_ask_value_tag(c_line_tags[i], "bl_line_object", &c_Rev));
|
|
|
|
|
char* cUid;
|
|
|
|
|
ITK__convert_tag_to_uid(c_Rev, &cUid);
|
|
|
|
|
/*if (find(uidVec.begin(), uidVec.end(), cUid) != uidVec.end()) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
uidVec.push_back(cUid);*/
|
|
|
|
|
NodeBean cBean;
|
|
|
|
|
cBean.revUid = cUid;
|
|
|
|
|
cBean.designRev = c_Rev;
|
|
|
|
|
cBean.packNum = count + 1;
|
|
|
|
|
cBean.topNum = atoi(topNum);
|
|
|
|
|
cBean.remark = remark;
|
|
|
|
|
recyReadBom(c_line_tags[i], cBean, errBuff, dbName, idVector);
|
|
|
|
|
pBean.childs.push_back(cBean);
|
|
|
|
|
|
|
|
|
@ -847,18 +976,23 @@ void recyReadBom(tag_t bom_line, NodeBean& pBean, string& errBuff, string dbName
|
|
|
|
|
char *seqNo, *c_type;
|
|
|
|
|
ITKCALL(AOM_ask_value_tag(c_line_tags[i], "bl_line_object", &c_Rev));
|
|
|
|
|
//新增逻辑 当前对象类型为ZT2_XNZJB 虚拟组件包时 进行削层处理 数量*虚拟层数量
|
|
|
|
|
AOM_ask_value_string(c_Rev, "object_type", &c_type);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(c_Rev, "object_type", &c_type));
|
|
|
|
|
if (strcmp(c_type, "ZT2_XNZJBRevision") == 0) {
|
|
|
|
|
xnzjbVec.push_back(c_line_tags[i]);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
AOM_ask_value_string(c_line_tags[i], "bl_sequence_no", &seqNo);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(c_line_tags[i], "bl_sequence_no", &seqNo));
|
|
|
|
|
maxSeqNo = seqNo;
|
|
|
|
|
char* cUid;
|
|
|
|
|
ITK__convert_tag_to_uid(c_Rev, &cUid);
|
|
|
|
|
/*if (find(uidVec.begin(), uidVec.end(), cUid) != uidVec.end()) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
uidVec.push_back(cUid);*/
|
|
|
|
|
NodeBean cBean;
|
|
|
|
|
cBean.revUid = cUid;
|
|
|
|
|
cBean.designRev = c_Rev;
|
|
|
|
|
cBean.remark = remark;
|
|
|
|
|
recyReadBom(c_line_tags[i], cBean, errBuff, dbName, idVector);
|
|
|
|
|
pBean.childs.push_back(cBean);
|
|
|
|
|
}
|
|
|
|
@ -889,7 +1023,7 @@ void getAllXnj(vector<tag_t> xnzjbVec, int maxNum, int &xxt,
|
|
|
|
|
ITKCALL(BOM_line_ask_all_child_lines(c_line_tag, &cc_line_count, &cc_line_tags));
|
|
|
|
|
char *cnt, *c_type;
|
|
|
|
|
int qtyPXn = 1;
|
|
|
|
|
AOM_ask_value_string(c_line_tag, "bl_quantity", &cnt);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(c_line_tag, "bl_quantity", &cnt));
|
|
|
|
|
if (strcmp(cnt, "") != 0) {
|
|
|
|
|
qtyPXn = atoi(cnt);
|
|
|
|
|
}
|
|
|
|
@ -897,11 +1031,13 @@ void getAllXnj(vector<tag_t> xnzjbVec, int maxNum, int &xxt,
|
|
|
|
|
vector<tag_t> xnzjbVec2;
|
|
|
|
|
for (int j = 0; j < cc_line_count; j++) {
|
|
|
|
|
tag_t c_Rev;
|
|
|
|
|
char *itemId, *object_name;
|
|
|
|
|
char *itemId, *object_name, *remark;
|
|
|
|
|
ITKCALL(AOM_ask_value_tag(cc_line_tags[j], "bl_line_object", &c_Rev));
|
|
|
|
|
AOM_ask_value_string(c_Rev, "object_type", &c_type);
|
|
|
|
|
AOM_ask_value_string(c_Rev, "item_id", &itemId);
|
|
|
|
|
AOM_ask_value_string(c_Rev, "object_name", &object_name);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(c_Rev, "object_type", &c_type));
|
|
|
|
|
ITKCALL(AOM_ask_value_string(c_Rev, "item_id", &itemId));
|
|
|
|
|
ITKCALL(AOM_ask_value_string(c_Rev, "object_name", &object_name));
|
|
|
|
|
ITKCALL(AOM_ask_value_string(cc_line_tags[j], "ZT2_Remark", &remark));
|
|
|
|
|
//printf("getAllXnj:%s\n", remark);
|
|
|
|
|
if (strcmp(c_type, "ZT2_XNZJBRevision") == 0) {
|
|
|
|
|
printf("itemId===>%s\n", itemId);
|
|
|
|
|
xnzjbVec2.push_back(cc_line_tags[j]);
|
|
|
|
@ -927,6 +1063,7 @@ void getAllXnj(vector<tag_t> xnzjbVec, int maxNum, int &xxt,
|
|
|
|
|
string lastnum = to_string(srqNum);
|
|
|
|
|
xxt = xxt + 1;
|
|
|
|
|
cBean.bl_sequence_no = lastnum;
|
|
|
|
|
cBean.remark = remark;
|
|
|
|
|
recyReadBom(cc_line_tags[j], cBean, errBuff, dbName, idVector);
|
|
|
|
|
pBean.childs.push_back(cBean);
|
|
|
|
|
}
|
|
|
|
@ -955,7 +1092,7 @@ void getAllXnj(vector<tag_t> xnzjbVec, int maxNum, int &xxt,
|
|
|
|
|
ITKCALL(BOM_line_ask_all_child_lines(c_line_tag, &cc_line_count, &cc_line_tags));
|
|
|
|
|
char *cnt, *c_type;
|
|
|
|
|
int qtyPXn = 1;
|
|
|
|
|
AOM_ask_value_string(c_line_tag, "bl_quantity", &cnt);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(c_line_tag, "bl_quantity", &cnt));
|
|
|
|
|
if (strcmp(cnt, "") != 0) {
|
|
|
|
|
//虚拟件的BOM数量
|
|
|
|
|
qtyPXn = atoi(cnt);
|
|
|
|
@ -964,11 +1101,13 @@ void getAllXnj(vector<tag_t> xnzjbVec, int maxNum, int &xxt,
|
|
|
|
|
vector<tag_t> xnzjbVec2;
|
|
|
|
|
for (int j = 0; j < cc_line_count; j++) {
|
|
|
|
|
tag_t c_Rev;
|
|
|
|
|
char *itemId, *object_name;
|
|
|
|
|
char *itemId, *object_name, *remark;
|
|
|
|
|
ITKCALL(AOM_ask_value_tag(cc_line_tags[j], "bl_line_object", &c_Rev));
|
|
|
|
|
AOM_ask_value_string(c_Rev, "object_type", &c_type);
|
|
|
|
|
AOM_ask_value_string(c_Rev, "item_id", &itemId);
|
|
|
|
|
AOM_ask_value_string(c_Rev, "object_name", &object_name);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(c_Rev, "object_type", &c_type));
|
|
|
|
|
ITKCALL(AOM_ask_value_string(c_Rev, "item_id", &itemId));
|
|
|
|
|
ITKCALL(AOM_ask_value_string(c_Rev, "object_name", &object_name));
|
|
|
|
|
ITKCALL(AOM_ask_value_string(cc_line_tags[j], "ZT2_Remark", &remark));
|
|
|
|
|
//printf("getAllXnj2:%s\n", remark);
|
|
|
|
|
if (strcmp(c_type, "ZT2_XNZJBRevision") == 0) {
|
|
|
|
|
printf("itemId===>%s\n", itemId);
|
|
|
|
|
xnzjbVec2.push_back(cc_line_tags[j]);
|
|
|
|
@ -994,6 +1133,7 @@ void getAllXnj(vector<tag_t> xnzjbVec, int maxNum, int &xxt,
|
|
|
|
|
string lastnum = to_string(srqNum);
|
|
|
|
|
xxt = xxt + 1;
|
|
|
|
|
cBean.bl_sequence_no = lastnum;
|
|
|
|
|
cBean.remark = remark;
|
|
|
|
|
//非虚拟件的继续原逻辑展开
|
|
|
|
|
recyReadBom(cc_line_tags[j], cBean, errBuff, dbName, loginUserId);
|
|
|
|
|
pBean.childs.push_back(cBean);
|
|
|
|
@ -1025,13 +1165,13 @@ string GBKToUTF8(const std::string& strGBK)
|
|
|
|
|
string proProcessCreate(tag_t rev, string process_name)
|
|
|
|
|
{
|
|
|
|
|
tag_t template_tag = NULLTAG;
|
|
|
|
|
EPM_find_template2(process_name.c_str(), PROCESS_TEMPLATE, &template_tag);
|
|
|
|
|
ITKCALL(EPM_find_template2(process_name.c_str(), PROCESS_TEMPLATE, &template_tag));
|
|
|
|
|
tag_t new_process = NULLTAG;
|
|
|
|
|
int *tagType = (int *)MEM_alloc(1024 * sizeof(int));//EPM_reference_attachment
|
|
|
|
|
tag_t * itemTag = (tag_t *)MEM_alloc(1024 * sizeof(tag_t));
|
|
|
|
|
tagType[0] = EPM_target_attachment;
|
|
|
|
|
itemTag[0] = rev;
|
|
|
|
|
EPM_create_process("¿ìËÙ·¢²¼", "", template_tag, 1, itemTag, tagType, &new_process);
|
|
|
|
|
ITKCALL(EPM_create_process("快速发布", "", template_tag, 1, itemTag, tagType, &new_process));
|
|
|
|
|
return "1";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1039,11 +1179,11 @@ boolean firstRevision(tag_t designRev, tag_t mantr) {
|
|
|
|
|
char *revId;
|
|
|
|
|
int revNum = 0, statusNum = 0;
|
|
|
|
|
tag_t *structure_revisions;
|
|
|
|
|
AOM_ask_value_string(designRev, "item_revision_id", &revId);
|
|
|
|
|
AOM_ask_value_tags(mantr, "structure_revisions", &revNum, &structure_revisions);
|
|
|
|
|
ITKCALL(AOM_ask_value_string(designRev, "item_revision_id", &revId));
|
|
|
|
|
ITKCALL(AOM_ask_value_tags(mantr, "structure_revisions", &revNum, &structure_revisions));
|
|
|
|
|
if (revNum > 0) {
|
|
|
|
|
tag_t struct_revision = structure_revisions[0], *release_status_list;
|
|
|
|
|
AOM_ask_value_tags(struct_revision, "release_status_list", &statusNum, &release_status_list);
|
|
|
|
|
ITKCALL(AOM_ask_value_tags(struct_revision, "release_status_list", &statusNum, &release_status_list));
|
|
|
|
|
if (statusNum == 0) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -1112,6 +1252,7 @@ map<string, int> getBomMsg(tag_t mantrRev, bool& flag) {
|
|
|
|
|
ITKCALL(AOM_ask_value_tag(c_line_tags[t], "bl_line_object", &c_Rev));
|
|
|
|
|
ITKCALL(AOM_ask_value_string(c_Rev, "zt2_MaterialNo", &matnrNo));
|
|
|
|
|
printf("zt2_MaterialNo===>%s\n", matnrNo);
|
|
|
|
|
|
|
|
|
|
int qtyPXn = 1;
|
|
|
|
|
ITKCALL(AOM_ask_value_string(c_line_tags[t], "bl_quantity", &cnt));
|
|
|
|
|
if (strcmp(cnt, "") != 0) {
|
|
|
|
@ -1240,8 +1381,11 @@ string createEbom(NodeBean topBean, boolean isTop, string &hasChange, map<string
|
|
|
|
|
ITKCALL(ITEM_rev_list_bom_view_revs(mantr, &bvr_count, &bvr_list));
|
|
|
|
|
//没有BOM视图创建
|
|
|
|
|
POM_AM__set_application_bypass(true);
|
|
|
|
|
tag_t defGroup = NULLTAG, dsuser = NULLTAG;
|
|
|
|
|
ITKCALL(AOM_ask_value_tag(desBean, "owning_user", &dsuser));
|
|
|
|
|
ITKCALL(AOM_ask_value_tag(dsuser, "default_group", &defGroup));
|
|
|
|
|
if (bvr_count == 0) {
|
|
|
|
|
tag_t newView, newViewBvr, pitem, dsuser;
|
|
|
|
|
tag_t newView = NULLTAG, newViewBvr = NULLTAG, pitem = NULLTAG;
|
|
|
|
|
ITKCALL(ITEM_ask_item_of_rev(mantr, &pitem));
|
|
|
|
|
POM_AM__set_application_bypass(true);
|
|
|
|
|
ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView));
|
|
|
|
@ -1249,9 +1393,6 @@ string createEbom(NodeBean topBean, boolean isTop, string &hasChange, map<string
|
|
|
|
|
ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, mantr, &newViewBvr));
|
|
|
|
|
ITKCALL(AOM_save(newViewBvr));
|
|
|
|
|
ITKCALL(AOM_save(mantr));
|
|
|
|
|
ITKCALL(AOM_ask_value_tag(desBean, "owning_user", &dsuser));
|
|
|
|
|
tag_t defGroup;
|
|
|
|
|
ITKCALL(AOM_ask_value_tag(dsuser, "default_group", &defGroup));
|
|
|
|
|
ITKCALL(AOM_set_ownership(newView, dsuser, defGroup));
|
|
|
|
|
ITKCALL(AOM_set_ownership(newViewBvr, dsuser, defGroup));
|
|
|
|
|
}
|
|
|
|
@ -1272,6 +1413,9 @@ string createEbom(NodeBean topBean, boolean isTop, string &hasChange, map<string
|
|
|
|
|
return errMsg;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
ITKCALL(AOM_set_ownership(bvr_list[0], dsuser, defGroup));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (flagChange) {
|
|
|
|
|
tag_t ebom_window = NULLTAG;
|
|
|
|
@ -1293,16 +1437,17 @@ string createEbom(NodeBean topBean, boolean isTop, string &hasChange, map<string
|
|
|
|
|
for (int i = 0; i < childs.size(); i++) {
|
|
|
|
|
NodeBean cBean = childs[i];
|
|
|
|
|
if (cBean.mantr != NULLTAG) {
|
|
|
|
|
tag_t cLine;
|
|
|
|
|
tag_t cLine = NULLTAG;
|
|
|
|
|
char* bom_string = NULL;
|
|
|
|
|
ITKCALL(AOM_ask_value_string(bom_line, "object_string", &bom_string));
|
|
|
|
|
ITKCALL(AOM_ask_value_string(cBean.mantr, "object_string", &bom_string));
|
|
|
|
|
printf("bom_line:%s\n", bom_string);
|
|
|
|
|
ITKCALL(BOM_line_add(bom_line, NULL, cBean.mantr, NULL, &cLine));
|
|
|
|
|
if (cLine != NULLTAG) {
|
|
|
|
|
AOM_lock(cLine);
|
|
|
|
|
if (cBean.packNum > 0) {
|
|
|
|
|
string num = cBean.bl_quantity;
|
|
|
|
|
num = to_string(cBean.topNum / cBean.packNum);
|
|
|
|
|
//string num = cBean.bl_quantity;
|
|
|
|
|
string num = to_string(cBean.topNum);//cBean.topNum / cBean.packNum
|
|
|
|
|
printf("cBean.Num:%d==%d\n", cBean.topNum, cBean.packNum);
|
|
|
|
|
ITKCALL(AOM_set_value_string(cLine, "bl_quantity", num.c_str()));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
@ -1314,6 +1459,10 @@ string createEbom(NodeBean topBean, boolean isTop, string &hasChange, map<string
|
|
|
|
|
ITKCALL(AOM_set_value_string(cLine, "bl_plmxml_occ_xform", cBean.bl_plmxml_occ_xform));
|
|
|
|
|
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转换"));
|
|
|
|
|
//char* gremark = U2G(cBean.remark.c_str());
|
|
|
|
|
//char* ugremark = G2U(cBean.remark.c_str());
|
|
|
|
|
printf("ZT2_Remark: %d %s\n", tc_strlen(cBean.remark.c_str()), cBean.remark.c_str());
|
|
|
|
|
ITKCALL(AOM_set_value_string(cLine, "ZT2_Remark", cBean.remark.c_str()));
|
|
|
|
|
(AOM_save(cLine));
|
|
|
|
|
//最后unlock
|
|
|
|
|
(AOM_unlock(cLine));
|
|
|
|
@ -1363,10 +1512,10 @@ void copyEBomLine(tag_t matnrTop, tag_t otherPbom) {
|
|
|
|
|
tag_t newView, newViewBvr, pitem;
|
|
|
|
|
ITKCALL(ITEM_ask_item_of_rev(otherPbom, &pitem));
|
|
|
|
|
ITKCALL(PS_create_bom_view(NULL, NULL, NULL, pitem, &newView));
|
|
|
|
|
ITKCALL(AOM_save(newView));
|
|
|
|
|
(AOM_save(newView));
|
|
|
|
|
ITKCALL(PS_create_bvr(newView, NULL, NULL, FALSE, otherPbom, &newViewBvr));
|
|
|
|
|
ITKCALL(AOM_save(newViewBvr));
|
|
|
|
|
ITKCALL(AOM_save(otherPbom));
|
|
|
|
|
(AOM_save(newViewBvr));
|
|
|
|
|
(AOM_save(otherPbom));
|
|
|
|
|
int num = 0;
|
|
|
|
|
tag_t dsuser, *structure_revisions, *bom_view_tags, *mantrs;
|
|
|
|
|
ITKCALL(AOM_ask_value_tags(otherPbom, "TC_Is_Represented_By", &num, &mantrs));
|
|
|
|
@ -1387,14 +1536,18 @@ void copyEBomLine(tag_t matnrTop, tag_t otherPbom) {
|
|
|
|
|
ITKCALL(BOM_line_cut(c_line_tags2[i]));
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < c_line_count; i++) {
|
|
|
|
|
tag_t newChild; char *bl_seqNo;
|
|
|
|
|
tag_t newChild = NULLTAG;
|
|
|
|
|
char *bl_seqNo = NULL, *ZT2_Remark = NULL;
|
|
|
|
|
ITKCALL(BOM_line_copy(bom_line2, c_line_tags[i], NULLTAG, &newChild));
|
|
|
|
|
ITKCALL(AOM_ask_value_string(c_line_tags[i], "bl_sequence_no", &bl_seqNo));
|
|
|
|
|
ITKCALL(AOM_lock(newChild));
|
|
|
|
|
ITKCALL(AOM_ask_value_string(c_line_tags[i], "ZT2_Remark", &ZT2_Remark));
|
|
|
|
|
printf("ZT2_Remark:%s\n", ZT2_Remark);
|
|
|
|
|
(AOM_lock(newChild));
|
|
|
|
|
ITKCALL(AOM_set_value_string(newChild, "bl_sequence_no", bl_seqNo));
|
|
|
|
|
ITKCALL(AOM_save(newChild));
|
|
|
|
|
ITKCALL(AOM_set_value_string(newChild, "ZT2_Remark", ZT2_Remark));
|
|
|
|
|
(AOM_save(newChild));
|
|
|
|
|
//最后unlock
|
|
|
|
|
ITKCALL(AOM_unlock(newChild));
|
|
|
|
|
(AOM_unlock(newChild));
|
|
|
|
|
}
|
|
|
|
|
//tag_t newChild;
|
|
|
|
|
//ITKCALL(BOM_line_copy(bom_line2, c_line_tags[i], NULLTAG, &newChild));
|
|
|
|
@ -1466,6 +1619,7 @@ int getClassValByTop(tag_t item, string& errMessage) {
|
|
|
|
|
* DBOM转EBOM
|
|
|
|
|
*/
|
|
|
|
|
int DbomToEMethod(void* returnValue) {
|
|
|
|
|
auto start = std::chrono::high_resolution_clock::now();
|
|
|
|
|
int ifail = ITK_ok;
|
|
|
|
|
char *sql = NULL, *revUid;
|
|
|
|
|
tag_t designRev, item;
|
|
|
|
@ -1511,6 +1665,9 @@ int DbomToEMethod(void* returnValue) {
|
|
|
|
|
printf("提示:中间数据表访问失败\n");
|
|
|
|
|
ifail = 1;
|
|
|
|
|
}
|
|
|
|
|
auto time1 = std::chrono::high_resolution_clock::now();
|
|
|
|
|
std::chrono::duration<double> elapsed = time1 - start;
|
|
|
|
|
printf("time1:%f\n", elapsed.count());
|
|
|
|
|
string dbName;
|
|
|
|
|
int url_num2 = 0;
|
|
|
|
|
char** url_vals2 = NULL;
|
|
|
|
@ -1529,6 +1686,9 @@ int DbomToEMethod(void* returnValue) {
|
|
|
|
|
recyReadBom(bom_line, topBean, errBuff, dbName, loginUserId);
|
|
|
|
|
DisConnServer();
|
|
|
|
|
ITKCALL(BOM_close_window(ebom_window));
|
|
|
|
|
auto time2 = std::chrono::high_resolution_clock::now();
|
|
|
|
|
elapsed = time2 - start;
|
|
|
|
|
printf("time2:%f\n", elapsed.count());
|
|
|
|
|
//搭建BOM
|
|
|
|
|
POM_AM__set_application_bypass(true);
|
|
|
|
|
printf("error %s \n", errBuff.c_str());
|
|
|
|
@ -1572,6 +1732,7 @@ int DbomToEMethod(void* returnValue) {
|
|
|
|
|
printf("dMap[%d]", dMap.size());*/
|
|
|
|
|
map<string, int> dMap = getDBomMesg(topBean);
|
|
|
|
|
for (int t = 0; t < topBean.ccps.size(); t++) {
|
|
|
|
|
auto sub = std::chrono::high_resolution_clock::now();
|
|
|
|
|
tag_t mantr = topBean.ccps[t];
|
|
|
|
|
boolean flagChange = true;
|
|
|
|
|
bool flag = false;
|
|
|
|
@ -1620,6 +1781,9 @@ int DbomToEMethod(void* returnValue) {
|
|
|
|
|
ITKCALL(ITEM_ask_latest_rev(topItem, &topRev));
|
|
|
|
|
copyEBomLine(topRev, mantr);
|
|
|
|
|
}
|
|
|
|
|
auto sub1 = std::chrono::high_resolution_clock::now();
|
|
|
|
|
elapsed = sub1 - sub;
|
|
|
|
|
printf("sub1:%f\n", elapsed.count());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
errBuff = "succ";
|
|
|
|
@ -1633,6 +1797,10 @@ int DbomToEMethod(void* returnValue) {
|
|
|
|
|
close();
|
|
|
|
|
printf("释放数据库成功\n");
|
|
|
|
|
printf("子line数量 %d \n", topBean.childs.size());
|
|
|
|
|
// 计算时间间隔
|
|
|
|
|
auto end = std::chrono::high_resolution_clock::now();
|
|
|
|
|
elapsed = end - start;
|
|
|
|
|
printf("用时:%f\n", elapsed.count());
|
|
|
|
|
string buff = errBuff;
|
|
|
|
|
*((char**)returnValue) = (char*)MEM_alloc((strlen(buff.c_str()) + 1) * sizeof(char));
|
|
|
|
|
tc_strcpy(*((char**)returnValue), buff.c_str());
|
|
|
|
@ -1643,6 +1811,7 @@ int DbomToEMethod(void* returnValue) {
|
|
|
|
|
* 区别在于需要通过首选项进行D转E,没有配置的不转换
|
|
|
|
|
*/
|
|
|
|
|
int DbomToEMethodUser(void* returnValue) {
|
|
|
|
|
auto start = std::chrono::high_resolution_clock::now();
|
|
|
|
|
int ifail = ITK_ok;
|
|
|
|
|
char *sql = NULL, *revUid;
|
|
|
|
|
tag_t designRev;
|
|
|
|
@ -1660,13 +1829,16 @@ int DbomToEMethodUser(void* returnValue) {
|
|
|
|
|
tag_t ebom_window = NULLTAG;
|
|
|
|
|
tag_t bom_line = NULLTAG;
|
|
|
|
|
tag_t item_tag = NULLTAG, *c_line_tags;
|
|
|
|
|
(BOM_create_window(&ebom_window));
|
|
|
|
|
ITKCALL(BOM_create_window(&ebom_window));
|
|
|
|
|
tag_t* bvr_list = NULL;
|
|
|
|
|
(ITEM_rev_list_bom_view_revs(designRev, &bvr_count, &bvr_list));
|
|
|
|
|
ITKCALL(ITEM_rev_list_bom_view_revs(designRev, &bvr_count, &bvr_list));
|
|
|
|
|
printf("bvr_count=%d", bvr_count);
|
|
|
|
|
|
|
|
|
|
(BOM_set_window_top_line_bvr(ebom_window, bvr_list[0], &bom_line)); //¶¥²ãbom»ñÈ¡
|
|
|
|
|
ITKCALL(BOM_set_window_top_line_bvr(ebom_window, bvr_list[0], &bom_line)); //顶层bom获取
|
|
|
|
|
printf("顶层bom获取\n");
|
|
|
|
|
auto bomtime = std::chrono::high_resolution_clock::now();
|
|
|
|
|
std::chrono::duration<double> elapsed = bomtime - start;
|
|
|
|
|
printf("bomtime:%f\n", elapsed.count());
|
|
|
|
|
|
|
|
|
|
//(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags));
|
|
|
|
|
NodeBean topBean;
|
|
|
|
@ -1675,7 +1847,7 @@ int DbomToEMethodUser(void* returnValue) {
|
|
|
|
|
|
|
|
|
|
int url_num = 0;
|
|
|
|
|
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];
|
|
|
|
|
url.append("/").append(url_vals[2]);
|
|
|
|
|
|
|
|
|
@ -1686,10 +1858,13 @@ int DbomToEMethodUser(void* returnValue) {
|
|
|
|
|
printf("提示:中间数据表访问失败\n");
|
|
|
|
|
ifail = 1;
|
|
|
|
|
}
|
|
|
|
|
auto ConnServer = std::chrono::high_resolution_clock::now();
|
|
|
|
|
elapsed = ConnServer - start;
|
|
|
|
|
printf("ConnServer:%f\n", elapsed.count());
|
|
|
|
|
string dbName;
|
|
|
|
|
int url_num2 = 0, url_num3 = 0;
|
|
|
|
|
char** url_vals2 = NULL, **url_vals3 = 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++) {
|
|
|
|
|
vector<string> vec;
|
|
|
|
|
Split(url_vals2[t], ":", vec);
|
|
|
|
@ -1698,15 +1873,21 @@ int DbomToEMethodUser(void* returnValue) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//配置哪些ID类别需要D转E
|
|
|
|
|
PREF_ask_char_values("CHINT_M060_KJTOSAP", &url_num3, &url_vals3);
|
|
|
|
|
ITKCALL(PREF_ask_char_values("CHINT_M060_KJTOSAP", &url_num3, &url_vals3));
|
|
|
|
|
vector<string> idVector;
|
|
|
|
|
if (url_num3 > 0) {
|
|
|
|
|
Split(url_vals3[0], ";", idVector);
|
|
|
|
|
}
|
|
|
|
|
auto time1 = std::chrono::high_resolution_clock::now();
|
|
|
|
|
elapsed = time1 - start;
|
|
|
|
|
printf("time1:%f\n", elapsed.count());
|
|
|
|
|
|
|
|
|
|
recyReadBom(bom_line, topBean, errBuff, dbName, idVector);
|
|
|
|
|
auto time2 = std::chrono::high_resolution_clock::now();
|
|
|
|
|
elapsed = time2 - start;
|
|
|
|
|
printf("time2:%f\n", elapsed.count());
|
|
|
|
|
DisConnServer();
|
|
|
|
|
BOM_close_window(ebom_window);
|
|
|
|
|
ITKCALL(BOM_close_window(ebom_window));
|
|
|
|
|
//搭建BOM
|
|
|
|
|
POM_AM__set_application_bypass(true);
|
|
|
|
|
printf("error %s \n", errBuff.c_str());
|
|
|
|
@ -1725,6 +1906,9 @@ int DbomToEMethodUser(void* returnValue) {
|
|
|
|
|
}
|
|
|
|
|
errBuff = "succ";
|
|
|
|
|
}
|
|
|
|
|
auto time3 = std::chrono::high_resolution_clock::now();
|
|
|
|
|
elapsed = time3 - start;
|
|
|
|
|
printf("time3:%f\n", elapsed.count());
|
|
|
|
|
|
|
|
|
|
POM_AM__set_application_bypass(false);
|
|
|
|
|
|
|
|
|
|