|
|
#include "SIO_USCOREBOM_USCOREPLM_USCOREASYNBinding.nsmap"
|
|
|
#include "soapH.h"
|
|
|
#include "soapStub.h"
|
|
|
#include "stdsoap2.h"
|
|
|
#include "ado.h"
|
|
|
#include "soapSIO_USCOREBOM_USCOREPLM_USCOREASYNBindingProxy.h"
|
|
|
#include "soapSI_USCOREFACTORY_USCORENUMBER_USCOREPLM_USCOREOUT_USCORESYNBindingProxy.h"
|
|
|
#include "soapSI_USCOREPROCESSROUTE_USCOREPLM_USCOREOUT_USCORESYNBindingProxy.h"
|
|
|
#include <ict/ict_userservice.h>
|
|
|
#include <tccore/custom.h>
|
|
|
#include <epm/epm_toolkit_tc_utils.h>
|
|
|
#include <tccore/aom.h>
|
|
|
#include <tccore/aom_prop.h>
|
|
|
#include <tccore/item.h>
|
|
|
#include <bom/bom.h>
|
|
|
#include "ps/ps.h";
|
|
|
#include "ps/vrule.h"
|
|
|
#include "sstream"
|
|
|
#include <tccore/grm.h>
|
|
|
#include "epm/epm.h"
|
|
|
#include "sa/sa.h"
|
|
|
#include "libxl.h"
|
|
|
#include <map>
|
|
|
#include "epm/signoff.h"
|
|
|
#include <ctime>
|
|
|
#include <vector>
|
|
|
#include <locale>
|
|
|
#include <codecvt>
|
|
|
#include "ae/dataset.h"
|
|
|
#include <stdlib.h>
|
|
|
#include <tccore/aom.h>
|
|
|
#include <tc/emh.h>
|
|
|
#include <ict/ict_userservice.h>
|
|
|
#include <tccore/tctype.h>
|
|
|
//#include "ado.h"
|
|
|
#include "ocilib.h"
|
|
|
#include <tc/preferences.h>
|
|
|
#include <regex>
|
|
|
#include <me/me.h>
|
|
|
#include "dfl_custom.h"
|
|
|
#include "CRUL_server_call_httpserver.h"
|
|
|
#include "util.h"
|
|
|
//#include "SendSap.h"
|
|
|
using namespace std;
|
|
|
//
|
|
|
char* getNotNullMsg(char* msg);
|
|
|
void logBomMsg(vector<_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST> lists);
|
|
|
void logProcessMsg(vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST> proclist);// vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST> proclist;
|
|
|
char* getUnti(char* unti);
|
|
|
|
|
|
FlowBean getClone(FlowBean oldBean) {
|
|
|
FlowBean newBean;
|
|
|
newBean.isMain = false;
|
|
|
newBean.flow_combine = oldBean.flow_combine;
|
|
|
newBean.flow_split = oldBean.flow_split;
|
|
|
for (int num = 0; num < oldBean.flowList.size(); num++) {
|
|
|
newBean.flowList.push_back(oldBean.flowList[num]);
|
|
|
}
|
|
|
return newBean;
|
|
|
}
|
|
|
////
|
|
|
void printfMsg(ns1__DT_USCOREPROCESSROUTE_USCORES4_USCORERSP ns1Rsp, string& sendMsg) {
|
|
|
/*_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCORERSP_RSP_USCOREBASEINFO info = ns1Rsp.RSP_USCOREBASEINFO;
|
|
|
char* id = info.REQ_USCORETRACE_USCOREID;
|
|
|
log("id:[%s]", id);*/
|
|
|
_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCORERSP_ZTABLE_USCORERETURN* returnTable = ns1Rsp.ZTABLE_USCORERETURN;
|
|
|
int num = ns1Rsp.__sizeZTABLE_USCORERETURN;
|
|
|
log("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD>RETURN:%d", num);/**/
|
|
|
for (int i = 0; i < num; i++) {
|
|
|
_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCORERSP_ZTABLE_USCORERETURN returnMsg = returnTable[i];
|
|
|
//System.out.println(z.getSERNR() + "|" + z.getTYPE() + "|" + z.getMESSAGE());
|
|
|
string logMsg = "";
|
|
|
char* msg = getNotNullMsg(returnMsg.MESSAGE);
|
|
|
msg = U2G(msg);
|
|
|
printf("printfMsg2.5:%s\n", msg);
|
|
|
printf("printfMsg2.5:%s==%s\n", returnMsg.MATNR, returnMsg.TYPE);
|
|
|
char matnr[128] = "";
|
|
|
if (returnMsg.MATNR) {
|
|
|
tc_strcpy(matnr, returnMsg.MATNR);
|
|
|
}
|
|
|
logMsg.append(matnr).append("|")
|
|
|
.append(returnMsg.TYPE).append("|").append(msg);
|
|
|
if (tc_strcmp(returnMsg.TYPE, "E") == 0) {
|
|
|
sendMsg.append("\n").append(matnr).append(": ").append(msg);
|
|
|
}
|
|
|
//log(logMsg.c_str());
|
|
|
log2(logMsg);
|
|
|
}
|
|
|
}
|
|
|
void printfMsg(ns1__DT_USCOREFACTORY_USCORENUMBER_USCORERSP ns1Rsp) {
|
|
|
int num = ns1Rsp.__sizeZTABLE_USCORERETURN;
|
|
|
//_ns1__DT_USCOREFACTORY_USCORENUMBER_USCORERSP_RSP_USCOREBASEINFO *info = ns1Rsp.RSP_USCOREBASEINFO;
|
|
|
//char* id = info[0].REQ_USCORETRACE_USCOREID;
|
|
|
_ns1__DT_USCOREFACTORY_USCORENUMBER_USCORERSP_ZTABLE_USCORERETURN* returnTable = ns1Rsp.ZTABLE_USCORERETURN;
|
|
|
log("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>RETURN:%d\n", num);/**/
|
|
|
for (int i = 0; i < num; i++) {
|
|
|
_ns1__DT_USCOREFACTORY_USCORENUMBER_USCORERSP_ZTABLE_USCORERETURN returnMsg = returnTable[i];
|
|
|
//System.out.println(z.getSERNR() + "|" + z.getTYPE() + "|" + z.getMESSAGE());
|
|
|
string logMsg = getNotNullMsg(returnMsg.SERNR);
|
|
|
char* msg = getNotNullMsg(returnMsg.MESSAGE);
|
|
|
msg = U2G(msg);
|
|
|
logMsg.append("|").append(getNotNullMsg(returnMsg.TYPE)).append("|").append(msg);
|
|
|
//log("{}", logMsg);
|
|
|
log2(logMsg);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void SplitStr(string strArg, string spliter, vector<string>& ans)
|
|
|
{
|
|
|
ans.clear();
|
|
|
size_t index0 = 0;
|
|
|
string one_arg;
|
|
|
if (strArg.find_first_not_of(' ') == string::npos)
|
|
|
strArg = "";
|
|
|
while (strArg.size() > 0)
|
|
|
{
|
|
|
index0 = strArg.find(spliter);
|
|
|
log(" ind %d \n", index0);
|
|
|
if (index0 > 0 && index0 != string::npos)
|
|
|
{
|
|
|
one_arg = strArg.substr(0, index0);
|
|
|
strArg = strArg.substr(index0 + 1);
|
|
|
ans.push_back(one_arg);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ans.push_back(strArg);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
void sendBom(vector<_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST> list, string batchMsg, char* url) {
|
|
|
//SIO_USCOREBOM_USCOREPLM_USCOREASYNBinding
|
|
|
SIO_USCOREBOM_USCOREPLM_USCOREASYNBindingProxy proxy;
|
|
|
ns1__DT_USCOREBOM_USCORES4_USCOREREQ ns1Req;
|
|
|
//proxy.userid = "shpodev";
|
|
|
//proxy.passwd = "sap@2019Test";
|
|
|
proxy.userid = "po_rfc";
|
|
|
proxy.passwd = "1qaz!QAZ";
|
|
|
soap_mode(&proxy, SOAP_C_UTFSTRING);
|
|
|
_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST* reqList =
|
|
|
new _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST[list.size()];
|
|
|
log("list ===> %d \n", list.size());
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST msg = list[i];
|
|
|
reqList[i] = list[i];
|
|
|
}
|
|
|
_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_BASEINFO baseInfo;
|
|
|
ns1Req.LIST = reqList;
|
|
|
ns1Req.__sizeLIST = list.size();
|
|
|
baseInfo.REQ_USCORETRACE_USCOREID = (char*)batchMsg.c_str();//batchNum;
|
|
|
ns1Req.BASEINFO = &baseInfo;
|
|
|
//ns1__DT_USCOREBOM_USCOREPLM_USCORERSP ns1Rsp;
|
|
|
int xlt = proxy.send_SIO_USCOREBOM_USCOREPLM_USCOREASYN(url, NULL, &ns1Req);
|
|
|
//log("111");
|
|
|
char* msg = proxy.buf;
|
|
|
vector<string> vecMsg;
|
|
|
//Split(msg, "?>", vecMsg);
|
|
|
//webservice<63><65><EFBFBD><EFBFBD>ͨ <20><>ʱ<EFBFBD><CAB1><EFBFBD>ֻ<EFBFBD>ȡxml<6D><6C>Ϣcurl<72><6C><EFBFBD><EFBFBD>
|
|
|
/*string lastMsg = vecMsg[vecMsg.size()-1].c_str();
|
|
|
lastMsg = lastMsg.substr(1, lastMsg.size());*/
|
|
|
//log("BOM XML MSG:{}", msg);/* xml<6D><6C>Ϣ*/
|
|
|
string logmsg = "BOM XML MSG:";
|
|
|
log2(logmsg.append(msg));
|
|
|
|
|
|
string lastMsg;
|
|
|
SplitStr(msg, "soap1.1\"", vecMsg);
|
|
|
if (vecMsg.size() > 0) {
|
|
|
lastMsg = vecMsg[1].substr(11);
|
|
|
}
|
|
|
else {
|
|
|
lastMsg = msg;
|
|
|
}
|
|
|
logmsg = "vecMsg:";
|
|
|
log2(logmsg.append(lastMsg));/* xml<6D><6C>Ϣ*/
|
|
|
string str = callHttpserver2(lastMsg, url);
|
|
|
logmsg = "return MSG :";
|
|
|
log2(logmsg.append(str));
|
|
|
soap_print_fault(&proxy, stderr);
|
|
|
log("xlt:[%d]", xlt);
|
|
|
//printfMsg(ns1Rsp, sendMsg);
|
|
|
}
|
|
|
//<2F>ж<EFBFBD><D0B6>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
|
|
|
void isMain(FlowBean& bean, vector<tag_t>& mainLines, vector<tag_t>& endLines,
|
|
|
vector<tag_t>& splits, map<tag_t, char*>& BEZFL_maps, int num2) {
|
|
|
tag_t combine = bean.flow_combine;
|
|
|
vector<tag_t> lists = bean.flowList;
|
|
|
for (int i = 0; i < lists.size(); i++) {
|
|
|
tag_t b = lists[i];
|
|
|
char* idmte;
|
|
|
tag_t gxRev;
|
|
|
ITKCALL(AOM_ask_value_tag(b, "bl_line_object", &gxRev));
|
|
|
ITKCALL(AOM_ask_value_string(gxRev, "item_id", &idmte));
|
|
|
log("=====flowList=====%s====\n", idmte);
|
|
|
}
|
|
|
vector<tag_t> lists2 = bean.flow_combine_list;
|
|
|
//char* uid;
|
|
|
//ITK__convert_tag_to_uid(combine, &uid);
|
|
|
if (combine == NULLTAG) {
|
|
|
log("<EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>:\n");
|
|
|
}
|
|
|
int len = lists.size() - 1;
|
|
|
if (len > -1) {
|
|
|
|
|
|
if (std::find(splits.begin(), splits.end(), lists[0]) == splits.end()) {
|
|
|
bean.flow_split = lists[0];
|
|
|
splits.push_back(lists[0]);
|
|
|
bean.isOther = true;
|
|
|
}
|
|
|
}
|
|
|
log("isMain1");
|
|
|
bean.BEZFL = "";
|
|
|
if (combine != NULLTAG && std::find(mainLines.begin(), mainLines.end(), combine) != mainLines.end()) {
|
|
|
bean.isMain = false;
|
|
|
int num = std::find(mainLines.begin(), mainLines.end(), combine) - mainLines.begin();
|
|
|
log("num %d\n", num);
|
|
|
vector<tag_t>::const_iterator index1 = lists.begin();
|
|
|
vector<tag_t>::const_iterator index2 = lists.begin() + num;
|
|
|
//log("num %d\n", num);
|
|
|
vector<tag_t> vec_new; // <20>µ<EFBFBD>vector<6F><72><EFBFBD><EFBFBD>
|
|
|
//log("num %d\n", num);
|
|
|
vec_new.assign(index1, index2);
|
|
|
//log("num %d\n", num);
|
|
|
bean.flowList = vec_new;
|
|
|
|
|
|
if (BEZFL_maps.count(combine) > 0) {
|
|
|
bean.BEZFL = BEZFL_maps[combine];
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
if(bean.BEZFL)
|
|
|
log("BEZFL1:%s", bean.BEZFL);
|
|
|
//log("1\n");
|
|
|
if (mainLines.size() == 0) {
|
|
|
bean.isMain = (true);
|
|
|
}
|
|
|
else {
|
|
|
bean.isMain = (false);
|
|
|
}
|
|
|
if (len > -1) {
|
|
|
tag_t end = lists[len];
|
|
|
if (combine == NULLTAG) {
|
|
|
endLines.push_back(end);
|
|
|
if (BEZFL_maps.count(end) > 0) {
|
|
|
bean.BEZFL = BEZFL_maps[end];
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
int size = lists2.size();
|
|
|
if (BEZFL_maps.count(lists2[size - 1]) > 0) {
|
|
|
bean.BEZFL = BEZFL_maps[lists2[size - 1]];
|
|
|
}
|
|
|
if (!bean.isMain) {
|
|
|
int cout = 0;
|
|
|
for (int i = 0; i < size; i++) {
|
|
|
if (std::find(mainLines.begin(), mainLines.end(), lists2[i]) != mainLines.end()) {
|
|
|
//mainLines.count(lists2[i))
|
|
|
cout = i;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
bean.flow_combine = lists2[cout];
|
|
|
}
|
|
|
endLines.push_back(combine);
|
|
|
}
|
|
|
}
|
|
|
if (bean.BEZFL)
|
|
|
log("BEZFL2:%s", bean.BEZFL);
|
|
|
for (int i = 0; i <= len; i++) {
|
|
|
|
|
|
if (std::find(mainLines.begin(), mainLines.end(), lists[i]) == mainLines.end()) {
|
|
|
//log("3\n");
|
|
|
mainLines.push_back(lists[i]);
|
|
|
char* fileDate = new char[20];
|
|
|
sprintf(fileDate, "%06d", num2);
|
|
|
BEZFL_maps[lists[i]] = fileDate;
|
|
|
//log("4\n");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
log("isMain5");
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
void sendProcess(vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST> proclist, string& sendMsg, char* url) {
|
|
|
//ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ *ns1__MT_USCOREPROCESSROUTE_USCORES4_USCOREREQ
|
|
|
SI_USCOREPROCESSROUTE_USCOREPLM_USCOREOUT_USCORESYNBindingProxy proxy;
|
|
|
soap_mode(&proxy, SOAP_C_UTFSTRING);
|
|
|
ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ ns1Req;
|
|
|
_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_BASEINFO baseInfo;
|
|
|
baseInfo.REQ_USCORETRACE_USCOREID = (char*)"123456";
|
|
|
|
|
|
ns1Req.BASEINFO = baseInfo;
|
|
|
|
|
|
_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST* LIST = new _ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST[proclist.size()];
|
|
|
for (int i = 0; i < proclist.size(); i++) {
|
|
|
_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST list = proclist[i];
|
|
|
LIST[i] = list;
|
|
|
}
|
|
|
ns1Req.__sizeLIST = proclist.size();
|
|
|
ns1Req.LIST = LIST;
|
|
|
ns1__DT_USCOREPROCESSROUTE_USCORES4_USCORERSP ns1Rsp;
|
|
|
proxy.userid = "shplm";//shplm
|
|
|
proxy.passwd = "sap@2019";
|
|
|
|
|
|
int xlt = proxy.SI_USCOREPROCESSROUTE_USCOREPLM_USCOREOUT_USCORESYN(url, NULL, &ns1Req, ns1Rsp);
|
|
|
if (xlt != 0) {
|
|
|
soap_print_fault(&proxy, stderr);
|
|
|
}
|
|
|
//log("PROCESS XML MSG:{}", U2G(proxy.buf));/* xml<6D><6C>Ϣ*/
|
|
|
log("xlt:[%d]", xlt);
|
|
|
printfMsg(ns1Rsp, sendMsg);
|
|
|
|
|
|
}
|
|
|
void sendFactoryNo(vector<_ns1__DT_USCOREFACTORY_USCORENUMBER_USCOREREQ_ITEMS_ITEM> list_Factorys, char* url) {
|
|
|
SI_USCOREFACTORY_USCORENUMBER_USCOREPLM_USCOREOUT_USCORESYNBindingProxy proxy;
|
|
|
|
|
|
//soap_set_omode(&proxy, SOAP_C_UTFSTRING);
|
|
|
/*ssoap_set_mode(&soap, SOAP_C_MBSTRING);*/
|
|
|
soap_mode(&proxy, SOAP_C_UTFSTRING);
|
|
|
proxy.userid = "shplm";
|
|
|
proxy.passwd = "sap@2019";
|
|
|
ns1__DT_USCOREFACTORY_USCORENUMBER_USCOREREQ ns1Req;
|
|
|
_ns1__DT_USCOREFACTORY_USCORENUMBER_USCOREREQ_BASEINFO info;
|
|
|
info.REQ_USCORETRACE_USCOREID = (char*)"123456";
|
|
|
ns1Req.BASEINFO = &info;
|
|
|
_ns1__DT_USCOREFACTORY_USCORENUMBER_USCOREREQ_ITEMS items;
|
|
|
|
|
|
_ns1__DT_USCOREFACTORY_USCORENUMBER_USCOREREQ_ITEMS_ITEM* item_items =
|
|
|
new _ns1__DT_USCOREFACTORY_USCORENUMBER_USCOREREQ_ITEMS_ITEM[list_Factorys.size()];
|
|
|
for (int i = 0; i < list_Factorys.size(); i++) {
|
|
|
item_items[i] = list_Factorys[i];
|
|
|
}
|
|
|
items.__sizeITEM = list_Factorys.size();
|
|
|
items.ITEM = item_items;
|
|
|
ns1Req.ITEMS = &items;
|
|
|
ns1__DT_USCOREFACTORY_USCORENUMBER_USCORERSP ns1Rsp;
|
|
|
int xlt = proxy.SI_USCOREFACTORY_USCORENUMBER_USCOREPLM_USCOREOUT_USCORESYN(url, NULL, &ns1Req, ns1Rsp);
|
|
|
log("xlt:[%d]", xlt);
|
|
|
if (xlt != 0) {
|
|
|
soap_print_fault(&proxy, stderr);
|
|
|
}
|
|
|
printfMsg(ns1Rsp);
|
|
|
}
|
|
|
|
|
|
void getFactoryNoList(char* projectNo, char* groupName, char* wbs,
|
|
|
tag_t* factoryNos, int num, tag_t ccp, vector<_ns1__DT_USCOREFACTORY_USCORENUMBER_USCOREREQ_ITEMS_ITEM>& list) {
|
|
|
char* zt2_MaterialNo, *zt2_TankNo, *zt2_Site;
|
|
|
ITKCALL(AOM_UIF_ask_value(ccp, "zt2_MaterialNo", &zt2_MaterialNo));
|
|
|
ITKCALL(AOM_UIF_ask_value(ccp, "zt2_TankNo", &zt2_TankNo));
|
|
|
ITKCALL(AOM_UIF_ask_value(ccp, "zt2_Site", &zt2_Site));
|
|
|
//_ns1__DT_USCOREFACTORY_USCORENUMBER_USCOREREQ_ITEMS_ITEM
|
|
|
for (int i = 0, len = num; i < len; i++) {
|
|
|
tag_t factoryNo = factoryNos[i];
|
|
|
char* itemId;
|
|
|
ITKCALL(AOM_ask_value_string(factoryNo, "item_id", &itemId));
|
|
|
_ns1__DT_USCOREFACTORY_USCORENUMBER_USCOREREQ_ITEMS_ITEM item_factoryNo;
|
|
|
int index = i + 1;
|
|
|
char fileDate[128] = "";
|
|
|
item_factoryNo.MATNR = zt2_MaterialNo;
|
|
|
item_factoryNo.PSPID = projectNo;
|
|
|
sprintf_s(fileDate, "%04d", index);
|
|
|
char* rspos = fileDate;
|
|
|
item_factoryNo.RSPOS = rspos;
|
|
|
item_factoryNo.SERNR = itemId;
|
|
|
item_factoryNo.WERKS = groupName;
|
|
|
item_factoryNo.ZGH = G2U(zt2_TankNo);
|
|
|
item_factoryNo.ZPSPID = wbs;
|
|
|
item_factoryNo.ZZD = zt2_Site;
|
|
|
list.push_back(item_factoryNo);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
vector<tag_t> addLastRev(map<tag_t, vector<tag_t>> items2) {
|
|
|
|
|
|
vector<tag_t> revLast;
|
|
|
map<tag_t, vector<tag_t>>::iterator it;
|
|
|
//<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>ƥ<EFBFBD><C6A5>
|
|
|
for (it = items2.begin(); it != items2.end(); it++) {
|
|
|
tag_t s = it->first;
|
|
|
vector<tag_t> rev2 = items2[s];
|
|
|
tag_t revTag = NULLTAG;
|
|
|
char* revId = (char*)"";
|
|
|
for (int j = 0; j < rev2.size(); j++) {
|
|
|
char* id2;
|
|
|
AOM_ask_value_string(rev2[j], "item_revision_id", &id2);
|
|
|
if (strcmp(id2, revId) > 0) {
|
|
|
revId = id2;
|
|
|
revTag = rev2[j];
|
|
|
}
|
|
|
}
|
|
|
revLast.push_back(revTag);
|
|
|
}
|
|
|
return revLast;
|
|
|
}
|
|
|
//
|
|
|
tag_t getProcessTag(tag_t mantr, char* groupName) {
|
|
|
int n_references = 0;
|
|
|
int* levels = 0;
|
|
|
tag_t* references_tag, processTag = NULLTAG;
|
|
|
char** relation_type_name = NULL;
|
|
|
//ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD>ù<EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
ITKCALL(WSOM_where_referenced(mantr, 1, &n_references, &levels, &references_tag, &relation_type_name));
|
|
|
for (int n = 0; n < n_references; n++) {
|
|
|
//log("relation_type_name===>%s\n", relation_type_name[n]);
|
|
|
if (strcmp(relation_type_name[n], "IMAN_METarget") == 0) {//IMAN_METarget
|
|
|
//
|
|
|
char *os = NULL;
|
|
|
ITKCALL(AOM_ask_value_string(references_tag[n], "object_string", &os));
|
|
|
tag_t group = NULLTAG;
|
|
|
char *gname = NULL;
|
|
|
ITKCALL(AOM_ask_value_tag(references_tag[n], "owning_group", &group));
|
|
|
ITKCALL(AOM_ask_value_string(group, "name", &gname));
|
|
|
log("gname:%s===>%s\n", os, gname);
|
|
|
if (tc_strcmp(gname, groupName) == 0) {
|
|
|
processTag = references_tag[n];
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return processTag;
|
|
|
}
|
|
|
boolean isTcm2(tag_t mantr) {
|
|
|
int releaseCount = 0;
|
|
|
tag_t* releaseTags = NULL;
|
|
|
//<2F>ж<EFBFBD><D0B6>Ӽ<EFBFBD><D3BC>Ƿ<C7B7>
|
|
|
ITKCALL(AOM_ask_value_tags(mantr, "release_status_list", &releaseCount, &releaseTags));
|
|
|
if (releaseCount > 0) {
|
|
|
return true;
|
|
|
}
|
|
|
else {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
vector<tag_t> getFlowStartsYH(int num, tag_t* c_line_tags) {
|
|
|
vector<tag_t> starts;
|
|
|
for (int i = 0; i < num; i++) {
|
|
|
tag_t gxLine = c_line_tags[i], *successors, *Mfg0predecessors;
|
|
|
int sucCnt = 0, preCnt = 0;
|
|
|
|
|
|
ITKCALL(AOM_ask_value_tags(gxLine, "Mfg0successors", &sucCnt, &successors));
|
|
|
ITKCALL(AOM_ask_value_tags(gxLine, "Mfg0predecessors", &preCnt, &Mfg0predecessors));
|
|
|
log("sucCnt %d preCnt%d \n", sucCnt, preCnt);
|
|
|
if (preCnt == 0 && sucCnt > 0) {
|
|
|
starts.push_back(gxLine);
|
|
|
}
|
|
|
}
|
|
|
return starts;
|
|
|
}
|
|
|
|
|
|
void readGXFlow(tag_t gxLine, vector<FlowBean>& flowBeans, FlowBean& currentFlow,
|
|
|
boolean isMainFlow, boolean top) {
|
|
|
tag_t* successors, *Mfg0predecessors;
|
|
|
int sucCnt = 0, preCnt = 0;
|
|
|
ITKCALL(AOM_ask_value_tags(gxLine, "Mfg0successors", &sucCnt, &successors));
|
|
|
ITKCALL(AOM_ask_value_tags(gxLine, "Mfg0predecessors", &preCnt, &Mfg0predecessors));
|
|
|
|
|
|
currentFlow.flowList.push_back(gxLine);
|
|
|
if (preCnt > 1) {
|
|
|
currentFlow.flow_combine_list.push_back(gxLine);
|
|
|
}
|
|
|
if (preCnt > 1 && currentFlow.flow_combine == NULLTAG) {
|
|
|
currentFlow.flow_combine = gxLine;
|
|
|
}
|
|
|
|
|
|
if (sucCnt == 0) {
|
|
|
return;
|
|
|
}
|
|
|
for (int i = 1; i < sucCnt; i++) {
|
|
|
FlowBean newFlow = getClone(currentFlow);
|
|
|
if (newFlow.flow_combine == NULLTAG)
|
|
|
{
|
|
|
log("==============");
|
|
|
}
|
|
|
newFlow.flow_split = gxLine;
|
|
|
readGXFlow(successors[i], flowBeans, newFlow, false, false);
|
|
|
flowBeans.push_back(newFlow);
|
|
|
}
|
|
|
readGXFlow(successors[0], flowBeans, currentFlow, false, false);
|
|
|
if (top) {
|
|
|
log("sucCnt %d\n", sucCnt);
|
|
|
currentFlow.isMain = isMainFlow;;
|
|
|
flowBeans.push_back(currentFlow);
|
|
|
}
|
|
|
}
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
|
|
void getSort(vector<FlowBean>& flowBeans) {
|
|
|
if (flowBeans.size() == 1 || flowBeans.size() == 0)
|
|
|
return;
|
|
|
vector<int> flowInt;
|
|
|
map<int, vector<FlowBean>> flows;
|
|
|
for (FlowBean b : flowBeans) {
|
|
|
int size = b.flowList.size();
|
|
|
if (flows.count(size) > 0) {
|
|
|
flows[size].push_back(b);
|
|
|
}
|
|
|
else {
|
|
|
vector<FlowBean> flow;
|
|
|
flow.push_back(b);
|
|
|
flowInt.push_back(size);
|
|
|
flows[size] = flow;
|
|
|
}
|
|
|
}
|
|
|
flowBeans.clear();
|
|
|
vector<tag_t> mainLines;
|
|
|
vector<tag_t> endLines;
|
|
|
vector<tag_t> splits;
|
|
|
int index = 0;
|
|
|
map<tag_t, char*> BEZFL_maps;
|
|
|
sort(flowInt.rbegin(), flowInt.rend());
|
|
|
for (vector<int>::iterator it = flowInt.begin(); it != flowInt.end(); it++) {
|
|
|
cout << *it << " ";
|
|
|
if (flows.count(*it) > 0) {
|
|
|
vector<FlowBean> beans = flows[*it];
|
|
|
for (int x = 0; x < beans.size(); x++) {
|
|
|
isMain(beans[x], mainLines, endLines, splits, BEZFL_maps, index);
|
|
|
flowBeans.push_back(beans[x]);
|
|
|
index++;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
char* getGXNR(tag_t gxLine) {
|
|
|
if (gxLine == NULLTAG) {
|
|
|
return (char*)"";
|
|
|
}
|
|
|
char* bl_sequence_no;
|
|
|
ITKCALL(AOM_ask_value_string(gxLine, "bl_sequence_no", &bl_sequence_no));
|
|
|
//String seq = gxLine.getProperty("bl_sequence_no");
|
|
|
int seqI = 0;
|
|
|
if (strcmp(bl_sequence_no, "") != 0) {
|
|
|
seqI = atoi(bl_sequence_no);
|
|
|
}
|
|
|
char* fileDate = new char[20];
|
|
|
sprintf(fileDate, "%04d", seqI);
|
|
|
return fileDate;
|
|
|
}
|
|
|
char* getBomUid(tag_t gxLine) {
|
|
|
char* gxUid;
|
|
|
tag_t gxRev;
|
|
|
if (gxLine == NULLTAG) {
|
|
|
return (char*)"";
|
|
|
}
|
|
|
ITKCALL(AOM_ask_value_tag(gxLine, "bl_line_object", &gxRev));
|
|
|
ITK__convert_tag_to_uid(gxRev, &gxUid);
|
|
|
return gxUid;
|
|
|
}
|
|
|
_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST_ITEMS_ITEM getGXInfo(FlowBean bean, int index,
|
|
|
tag_t partRev, char* p_uom, char* now) {
|
|
|
_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST_ITEMS_ITEM item;
|
|
|
item.PLNAL = (char*)("1");// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
char* fileDate = new char[20];
|
|
|
sprintf(fileDate, "%06d", index);
|
|
|
item.PLNFL = fileDate;// <20><><EFBFBD><EFBFBD>
|
|
|
item.DATUV = now;// <20><>Ч<EFBFBD><D0A7>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
|
|
boolean bx = false;
|
|
|
item.VORNR1 = (char*)("");
|
|
|
item.VORNR2 = (char*)("");
|
|
|
item.BEZFL = (char*)("");// <20>ο<EFBFBD>˳<EFBFBD><CBB3>
|
|
|
// item.setLTXA1("");//˳<><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
if (!bean.isMain) {// <20><><EFBFBD><EFBFBD>
|
|
|
// item.setBEZFL("000000");//<2F>ο<EFBFBD>˳<EFBFBD><CBB3>
|
|
|
item.BEZFL = bean.BEZFL;
|
|
|
bx = true;
|
|
|
item.FLGAT = (char*)("1");// ˳<><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
// System.out.println("ǰ<><C7B0>:"+bean.flow_split);
|
|
|
if (bean.flow_split != NULLTAG) {
|
|
|
item.VORNR1 = getGXNR(bean.flow_split);// ǰ<><C7B0>
|
|
|
}
|
|
|
else {
|
|
|
log("bean.flow_split ====== NULL");
|
|
|
}
|
|
|
if (bean.isOther)
|
|
|
bean.flow_split = NULLTAG;
|
|
|
if (bean.flow_combine != NULLTAG) {
|
|
|
item.VORNR2 = getGXNR(bean.flow_combine);// <20><><EFBFBD><EFBFBD> (SAPUtil.getGXNR(bean.flow_combine))
|
|
|
}
|
|
|
}
|
|
|
else {// <20>Dz<EFBFBD><C7B2><EFBFBD>
|
|
|
item.FLGAT = (char*)("0");// ˳<><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
}
|
|
|
int cnt = bean.flowList.size();
|
|
|
_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST_ITEMS_ITEM_SUBITEMS subitemsArr;
|
|
|
|
|
|
|
|
|
vector<_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST_ITEMS_ITEM_SUBITEMS_SUBITEM> subItems;
|
|
|
boolean inBx = bean.flow_split == NULLTAG;
|
|
|
for (int i = 0; i < cnt; i++) {
|
|
|
tag_t gxLine = bean.flowList[i];
|
|
|
char* gxUid;
|
|
|
tag_t gxRev;
|
|
|
ITKCALL(AOM_ask_value_tag(gxLine, "bl_line_object", &gxRev));
|
|
|
ITK__convert_tag_to_uid(gxRev, &gxUid);
|
|
|
if (bx) {
|
|
|
if (strcmp(getBomUid(bean.flow_combine), gxUid) == 0) { //gxLine.equals(bean.flow_combine)
|
|
|
break;
|
|
|
}
|
|
|
if (strcmp(getBomUid(bean.flow_split), gxUid) == 0) { //gxLine.equals(bean.flow_split)
|
|
|
inBx = true;
|
|
|
continue;
|
|
|
}
|
|
|
if (!inBx) {
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST_ITEMS_ITEM_SUBITEMS_SUBITEM sub;
|
|
|
char* zt2_WorkCenter, *zt2_ControlCode, *object_name, *zt2_ClassificationCode, *zt2_ArtificialTime, *zt2_MachineTime, *zt2_ReadinessTime;
|
|
|
ITKCALL(AOM_ask_value_string(gxRev, "zt2_WorkCenter", &zt2_WorkCenter));
|
|
|
ITKCALL(AOM_UIF_ask_value(gxLine, "zt2_ControlCode", &zt2_ControlCode));
|
|
|
ITKCALL(AOM_UIF_ask_value(gxRev, "object_name", &object_name));
|
|
|
ITKCALL(AOM_UIF_ask_value(gxRev, "zt2_ClassificationCode", &zt2_ClassificationCode));
|
|
|
ITKCALL(AOM_UIF_ask_value(gxLine, "zt2_ArtificialTime", &zt2_ArtificialTime));
|
|
|
ITKCALL(AOM_UIF_ask_value(gxLine, "zt2_MachineTime", &zt2_MachineTime));
|
|
|
ITKCALL(AOM_UIF_ask_value(gxLine, "zt2_ReadinessTime", &zt2_ReadinessTime));
|
|
|
sub.VORNR = getGXNR(gxLine);// <20><><EFBFBD><EFBFBD>
|
|
|
sub.ARBPL = zt2_WorkCenter;// (gxRev.getTCProperty("zt2_WorkCenter").getStringValue());// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
sub.STEUS = zt2_ControlCode;// (gxLine.getProperty("zt2_ControlCode"));// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
sub.LTXA1 = G2U(object_name);// (gxRev.getProperty("object_name"));// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
sub.USR00 = zt2_ClassificationCode;// (gxRev.getProperty("zt2_ClassificationCode"));// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
sub.BMSCH = (char*)("1");// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
sub.PLNME = p_uom;
|
|
|
sub.VGW01 = zt2_ArtificialTime;// (gxLine.getProperty("zt2_ArtificialTime"));// <20><>ֵ1
|
|
|
sub.VGE01 = (char*)("MIN");// <20><>ֵ<D7BC><D6B5>λ1
|
|
|
sub.VGW02 = zt2_MachineTime;// (gxLine.getProperty("zt2_MachineTime"));// <20><>ֵ2
|
|
|
sub.VGE02 = (char*)("MIN");// <20><>ֵ<D7BC><D6B5>λ2
|
|
|
sub.VGW05 = zt2_ReadinessTime;// (gxLine.getProperty("zt2_ReadinessTime"));// <20><>ֵ5
|
|
|
sub.VGE05 = (char*)("MIN");// <20><>ֵ<D7BC><D6B5>λ5
|
|
|
subItems.push_back(sub);
|
|
|
}
|
|
|
_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST_ITEMS_ITEM_SUBITEMS_SUBITEM* SUBITEM =
|
|
|
new _ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST_ITEMS_ITEM_SUBITEMS_SUBITEM[subItems.size()];
|
|
|
for (int i = 0; i < subItems.size(); i++) {
|
|
|
SUBITEM[i] = subItems[i];
|
|
|
}
|
|
|
subitemsArr.__sizeSUBITEM = subItems.size();
|
|
|
subitemsArr.SUBITEM = SUBITEM;
|
|
|
item.SUBITEMS = subitemsArr;
|
|
|
return item;
|
|
|
|
|
|
}
|
|
|
|
|
|
//////<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
void readBopInfo1YH(tag_t rev, tag_t partRev, boolean flag,
|
|
|
map<string, tag_t>& gy_meops, vector<tag_t>& needTCM_meops,
|
|
|
char* groupName, char* now, vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST>& proclist) {
|
|
|
//"zt2_MaterialNo", "zt2_WBSNo"
|
|
|
char* zt2_MaterialNo = NULL, *zt2_WBSNo = NULL;
|
|
|
ITKCALL(AOM_ask_value_string(partRev, "zt2_MaterialNo", &zt2_MaterialNo));
|
|
|
ITKCALL(AOM_ask_value_string(partRev, "zt2_WBSNo", &zt2_WBSNo));
|
|
|
if (isTcm2(rev) && flag)// || zt2_MaterialNo[0] == '5'
|
|
|
return;
|
|
|
if (gy_meops.count(zt2_MaterialNo) > 0)
|
|
|
return;
|
|
|
/*if (rev == null) {
|
|
|
throw new Exception("Ȩ<><EFBFBD><DEB2><EFBFBD>,<2C><EFBFBD><DEB7><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>[" + zt2_MaterialNo + "]<5D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
}*/
|
|
|
gy_meops[zt2_MaterialNo] = rev;
|
|
|
//!needTCM_meops.contains(rev)
|
|
|
if (std::find(needTCM_meops.begin(), needTCM_meops.end(), rev) == needTCM_meops.end())
|
|
|
needTCM_meops.push_back(rev);
|
|
|
tag_t ebom_window, bom_line;
|
|
|
|
|
|
ITKCALL(ME_create_bop_window(&ebom_window));
|
|
|
ITKCALL(BOM_set_window_top_line(ebom_window, NULL, rev, NULLTAG, &bom_line));
|
|
|
int c_line_count;
|
|
|
tag_t* c_line_tags;
|
|
|
ITKCALL(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags));
|
|
|
if (c_line_count == 0) {
|
|
|
return;
|
|
|
}
|
|
|
_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST proc_list;
|
|
|
_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST_HEAD head;
|
|
|
head.PSPNR = zt2_WBSNo;
|
|
|
head.MATNR = zt2_MaterialNo;
|
|
|
head.DATUV = now;// <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
|
|
head.PLNAL = (char*)"1";// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
head.STATU = (char*)"4";// ״̬
|
|
|
head.VERWE = (char*)"1";// <20><>;
|
|
|
head.WERKS = groupName;// <20><><EFBFBD><EFBFBD>
|
|
|
_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST_ITEMS items;
|
|
|
vector<FlowBean> flowBeans;
|
|
|
vector<tag_t> startLines = getFlowStartsYH(c_line_count, c_line_tags);
|
|
|
tag_t part2;
|
|
|
char* zt2_unit2;
|
|
|
ITKCALL(ITEM_ask_item_of_rev(partRev, &part2));
|
|
|
ITKCALL(AOM_ask_value_string(part2, "zt2_unit", &zt2_unit2));
|
|
|
char* unit = getUnti(zt2_unit2);
|
|
|
if (startLines.size() > 0) {
|
|
|
char* itemID;
|
|
|
//ITKCALL(AOM_ask_value_string(startLines[0], "item_id", &itemID));
|
|
|
log("<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD> :\n");
|
|
|
}
|
|
|
for (int i = 0; i < startLines.size(); i++) {
|
|
|
FlowBean firstBean;
|
|
|
log("startLines == \n");
|
|
|
char* idmte;
|
|
|
tag_t gxRev;
|
|
|
ITKCALL(AOM_ask_value_tag(startLines[i], "bl_line_object", &gxRev));
|
|
|
ITKCALL(AOM_ask_value_string(gxRev, "item_id", &idmte));
|
|
|
log("=====idmte=====%s====\n", idmte);
|
|
|
readGXFlow(startLines[i], flowBeans, firstBean, i == 0, true);
|
|
|
for (int i = 0; i < firstBean.flowList.size(); i++) {
|
|
|
tag_t b = firstBean.flowList[i];
|
|
|
char* idmte;
|
|
|
tag_t gxRev;
|
|
|
ITKCALL(AOM_ask_value_tag(b, "bl_line_object", &gxRev));
|
|
|
ITKCALL(AOM_ask_value_string(gxRev, "item_id", &idmte));
|
|
|
log("=====ffirstBean.flowList=====%s====\n", idmte);
|
|
|
}
|
|
|
}// <20><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>Ϣ
|
|
|
if (flowBeans.size() > 0) {
|
|
|
}
|
|
|
else {
|
|
|
// <20><>PERT<52><54><EFBFBD><EFBFBD>
|
|
|
log("<EFBFBD><EFBFBD>PERT<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
FlowBean bean;
|
|
|
bean.isMain = true;
|
|
|
for (int j = 0; j < c_line_count; j++) {
|
|
|
tag_t gxLine = c_line_tags[j];
|
|
|
bean.flowList.push_back(gxLine);
|
|
|
}
|
|
|
// bean.print();
|
|
|
flowBeans.push_back(bean);
|
|
|
}
|
|
|
// <20><><EFBFBD><EFBFBD>
|
|
|
getSort(flowBeans);
|
|
|
// <20><>ȡBOP<4F><50>Ϣ
|
|
|
_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST_ITEMS_ITEM* gxInfo =
|
|
|
new _ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST_ITEMS_ITEM[flowBeans.size()];
|
|
|
log("flowBeans %d \n", flowBeans.size());
|
|
|
for (int i = 0; i < flowBeans.size(); i++) {
|
|
|
FlowBean bean = flowBeans[i];
|
|
|
/*bean.print();;*/
|
|
|
gxInfo[i] = getGXInfo(bean, i, partRev, unit, now);
|
|
|
//gxInfo(getGXInfo(bean, i, partRev, p_uom, now));
|
|
|
}
|
|
|
items.__sizeITEM = flowBeans.size();
|
|
|
items.ITEM = gxInfo;
|
|
|
proc_list.HEAD = head;
|
|
|
proc_list.ITEMS = items;
|
|
|
proclist.push_back(proc_list);
|
|
|
//for (int i = 0; i < flowBeans.size(); i++) {
|
|
|
// FlowBean bean = flowBeans.get(i);
|
|
|
// bean.print();
|
|
|
// gxInfo.add(SAPUtil.getGXInfo(bean, i, partRev, p_uom, now));
|
|
|
//}
|
|
|
//proclist.add(
|
|
|
// new DT_PROCESSROUTE_S4_REQLIST(head, gxInfo.toArray(new DT_PROCESSROUTE_S4_REQLISTITEMSITEM[]{})));
|
|
|
//window.clearCache();
|
|
|
//// window.refresh();
|
|
|
//window.closeBOPWindow();
|
|
|
//System.out.println("====<3D><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>===");
|
|
|
|
|
|
ITKCALL(ME_close_bop_window(ebom_window));
|
|
|
|
|
|
}
|
|
|
char* getUnti(char* unti) {
|
|
|
char* s = _strupr(unti);
|
|
|
return s;
|
|
|
}
|
|
|
// <20><>¼<EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ڵ<EFBFBD>BOMList<String> bomISExist
|
|
|
void recurZYZZSAPYH(tag_t line, tag_t rev, vector<string>& bomISExist,
|
|
|
char* groupName, char* now, string& errMess, vector<tag_t>& set_meops,
|
|
|
map<string, tag_t>& material_revs, vector<_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST>& list,
|
|
|
map<string, tag_t>& gy_meops, vector<tag_t>& needTCM_meops,
|
|
|
vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST>& proclist) {
|
|
|
char* zt2_Diagram, *item_id, *object_name, *zt2_MaterialNo, *zt2_WBSNo;
|
|
|
//"zt2_Diagram","item_id","object_name","zt2_MaterialNo","zt2_WBSNo"
|
|
|
//ITKCALL(AOM_ask_value_string(rev, "zt2_Diagram", &zt2_Diagram));
|
|
|
ITKCALL(AOM_ask_value_string(rev, "item_id", &item_id));
|
|
|
ITKCALL(AOM_ask_value_string(rev, "object_name", &object_name));
|
|
|
ITKCALL(AOM_ask_value_string(rev, "zt2_MaterialNo", &zt2_MaterialNo));
|
|
|
ITKCALL(AOM_ask_value_string(rev, "zt2_WBSNo", &zt2_WBSNo));
|
|
|
string x = zt2_MaterialNo;
|
|
|
log("item_id = [%s] \n", item_id);
|
|
|
if (x.rfind("99", 0) == 0) {
|
|
|
tag_t meops = getProcessTag(rev, groupName);
|
|
|
if (meops != NULLTAG) {
|
|
|
if (!isTcm2(meops)) {
|
|
|
set_meops.push_back(meops);
|
|
|
}
|
|
|
readBopInfo1YH(meops, rev, true, gy_meops, needTCM_meops, groupName, now, proclist);
|
|
|
}
|
|
|
else {
|
|
|
log("item_id22 = [%s] \n", item_id);
|
|
|
}
|
|
|
}
|
|
|
int c_line_count;
|
|
|
tag_t* c_line_tags;
|
|
|
ITKCALL(BOM_line_ask_all_child_lines(line, &c_line_count, &c_line_tags));
|
|
|
log("child c_line_count %d \n", c_line_count);
|
|
|
if (c_line_count == 0) {
|
|
|
return;
|
|
|
}
|
|
|
_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_HEAD head;
|
|
|
if (std::find(bomISExist.begin(), bomISExist.end(), zt2_MaterialNo) != bomISExist.end()) {
|
|
|
return;
|
|
|
}
|
|
|
else {
|
|
|
bomISExist.push_back(zt2_MaterialNo);
|
|
|
}
|
|
|
tag_t item;
|
|
|
char* zt2_unit;
|
|
|
ITKCALL(ITEM_ask_item_of_rev(rev, &item));
|
|
|
ITKCALL(AOM_ask_value_string(item, "zt2_unit", &zt2_unit));
|
|
|
char* unit = getUnti(zt2_unit);
|
|
|
log("str = [%s] \n", unit);
|
|
|
head.PSPNR = zt2_WBSNo;
|
|
|
head.MATNR = zt2_MaterialNo;
|
|
|
head.BMEIN = unit;
|
|
|
head.STLAN = (char*)"1";
|
|
|
head.STLAL = (char*)"1";
|
|
|
head.BMENG = (char*)"1";
|
|
|
head.WERKS = groupName;
|
|
|
head.DATUV = now;
|
|
|
char* parnetUid;
|
|
|
ITK__convert_tag_to_uid(rev, &parnetUid);
|
|
|
head.STKTX = parnetUid;
|
|
|
|
|
|
_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS_ITEM* items_items =
|
|
|
new _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS_ITEM[c_line_count];
|
|
|
_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS items;
|
|
|
|
|
|
for (int i = 0; i < c_line_count; i++) {
|
|
|
string buff;
|
|
|
_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS_ITEM items_item;
|
|
|
tag_t c_line_tag = c_line_tags[i], rev2;
|
|
|
ITKCALL(AOM_ask_value_tag(c_line_tag, "bl_line_object", &rev2));
|
|
|
char* prop0, *prop1, *prop2, *prop3, *prop4, *zt2_unit2;
|
|
|
//ITKCALL(AOM_ask_value_string(rev2, "zt2_Diagram", &prop0));
|
|
|
ITKCALL(AOM_ask_value_string(rev2, "item_id", &prop1));
|
|
|
ITKCALL(AOM_ask_value_string(rev2, "object_name", &prop2));
|
|
|
//ITKCALL(AOM_ask_value_string(rev2, "zt2_SapState", &prop3));
|
|
|
ITKCALL(AOM_ask_value_string(rev2, "zt2_MaterialNo", &prop4));
|
|
|
tag_t part2;
|
|
|
ITKCALL(ITEM_ask_item_of_rev(rev2, &part2));
|
|
|
ITKCALL(AOM_ask_value_string(part2, "zt2_unit", &zt2_unit2));
|
|
|
char* unit22 = getUnti(zt2_unit2);
|
|
|
items_item.IDNRK = prop4;
|
|
|
char* unit = unit22;
|
|
|
items_item.MEINS = unit;
|
|
|
items_item.DATUV = now;
|
|
|
items_item.POSTP = (char*)"L";
|
|
|
char* bl_sequence_no, *bl_quantity, *ZT2_ClassificationNo, *ZT2_Remark;
|
|
|
//"bl_sequence_no", "bl_quantity", "ZT2_ClassificationNo", "ZT2_Remark"
|
|
|
ITKCALL(AOM_ask_value_string(c_line_tag, "bl_sequence_no", &bl_sequence_no));
|
|
|
ITKCALL(AOM_ask_value_string(c_line_tag, "bl_quantity", &bl_quantity));
|
|
|
ITKCALL(AOM_ask_value_string(c_line_tag, "ZT2_ClassificationNo", &ZT2_ClassificationNo));
|
|
|
ITKCALL(AOM_ask_value_string(c_line_tag, "ZT2_Remark", &ZT2_Remark));
|
|
|
items_item.POSNR = bl_sequence_no;
|
|
|
//string sss = bl_quantity;//line2.getProperty("bl_quantity");
|
|
|
log("bl_quantity ===== %s\n", bl_quantity);
|
|
|
if (strcmp(bl_quantity, "") == 0) {
|
|
|
buff.append("δ<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>(bl_quantity);");
|
|
|
}
|
|
|
double ddd = atof(bl_quantity);
|
|
|
char* strff = new char[21];
|
|
|
sprintf(strff, "%.3f", ddd);
|
|
|
items_item.MENGE = strff;
|
|
|
items_item.SORTF = ZT2_ClassificationNo;
|
|
|
if (strcmp(ZT2_ClassificationNo, "") == 0) {
|
|
|
buff.append("BOM<EFBFBD><EFBFBD>δ<EFBFBD>ҵ<EFBFBD>Ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ;");
|
|
|
}
|
|
|
items_item.POTX1 = ZT2_Remark;
|
|
|
items_items[i] = items_item;
|
|
|
string msg;
|
|
|
msg.append(prop1).append("-").append(prop2).append("(<28><><EFBFBD><EFBFBD>:")
|
|
|
.append(item_id).append("-").append(object_name).append("):").append(buff);
|
|
|
log("buff ===== %s\n", buff.c_str());
|
|
|
if (buff.length() > 0 && strstr(errMess.c_str(), msg.c_str()) == NULL) {
|
|
|
errMess.append("\\n").append(msg);
|
|
|
}
|
|
|
if (strcmp(prop4, "") == 0) {
|
|
|
material_revs[prop4] = rev2;
|
|
|
}
|
|
|
}
|
|
|
//items.
|
|
|
items.ITEM = items_items;
|
|
|
items.__sizeITEM = c_line_count;
|
|
|
_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST list1;
|
|
|
list1.HEAD = head;
|
|
|
log("list1.HEAD %s\n ", list1.HEAD.BMEIN);
|
|
|
list1.ITEMS = items;
|
|
|
list.push_back(list1);
|
|
|
}
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
//void removeNull(vector<_ns1__DT_USCOREBOM_USCOREPLM_USCOREREQ_LIST> list) {
|
|
|
// for (int i = list.size() - 1; i >= 0; i--) {
|
|
|
// _ns1__DT_USCOREBOM_USCOREPLM_USCOREREQ_LIST dt = list[i];
|
|
|
// _ns1__DT_USCOREBOM_USCOREPLM_USCOREREQ_LIST_ITEMS items = dt.ITEMS;
|
|
|
// for (int j = 0; j < items.__sizeITEM; j++) {
|
|
|
//
|
|
|
// }
|
|
|
// }
|
|
|
//// for (int i = list.size() - 1; i >= 0; i--) {
|
|
|
//// DT_BOM_PLM_REQLIST dt = list.get(i);
|
|
|
//// List<DT_BOM_PLM_REQLISTITEMSITEM> item_lists = new ArrayList<DT_BOM_PLM_REQLISTITEMSITEM>();
|
|
|
//// DT_BOM_PLM_REQLISTITEMSITEM items[] = dt.getITEMS();
|
|
|
//// for (DT_BOM_PLM_REQLISTITEMSITEM item : items) {
|
|
|
//// if (item != null)
|
|
|
//// item_lists.add(item);
|
|
|
//// /*
|
|
|
//// * else { //KUtil.isEmpty(item.getDATUV()) }
|
|
|
//// */
|
|
|
//// }
|
|
|
//// if (item_lists == null || item_lists.size() == 0)
|
|
|
//// list.remove(dt);
|
|
|
//// else {
|
|
|
//// DT_BOM_PLM_REQLISTITEMSITEM[] request = item_lists
|
|
|
//// .toArray(new DT_BOM_PLM_REQLISTITEMSITEM[item_lists.size()]);
|
|
|
//// dt.setITEMS(request);
|
|
|
//// }
|
|
|
//// }
|
|
|
//}
|
|
|
#define OBJECT_NAME "object_name"
|
|
|
#define MATERIAL_NO "zt2_MaterialNo"
|
|
|
void readSchemesYH(vector<tag_t> vectorRev, tag_t partRev,
|
|
|
map<tag_t, vector<_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST>>& scheme_boms,
|
|
|
vector<string>& bomISExist, map<tag_t, vector<tag_t>>& rev_meops,
|
|
|
char* groupName, char* now, string& errMess,
|
|
|
map<string, tag_t>& material_revs, map<string, tag_t>& gy_meops, vector<tag_t>& needTCM_meops,
|
|
|
map<tag_t, vector<_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST>>& process_boms, char* transfer,
|
|
|
map<string, vector<string>> &inCcpMap, char* url) {
|
|
|
vector<tag_t> set_meops;
|
|
|
tag_t ebom_window;
|
|
|
ITKCALL(BOM_create_window(&ebom_window));
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD>BOM
|
|
|
char* ccpMaterialNo;
|
|
|
ITKCALL(AOM_ask_value_string(partRev, MATERIAL_NO, &ccpMaterialNo));
|
|
|
for (int i = 0; i < vectorRev.size(); i++) {
|
|
|
tag_t rev = vectorRev[i], bom_line;
|
|
|
char* cName, *zt2_MaterialNo, *zt2_BOMScheme, *revUid;
|
|
|
ITK__convert_tag_to_uid(rev, &revUid);
|
|
|
//material_revs <20><>¼<EFBFBD><C2BC><EFBFBD>ϱ<EFBFBD><CFB1><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
|
|
|
|
|
ITKCALL(AOM_ask_value_string(rev, "object_name", &cName));
|
|
|
ITKCALL(AOM_ask_value_string(rev, "zt2_MaterialNo", &zt2_MaterialNo));
|
|
|
ITKCALL(AOM_UIF_ask_value(rev, "zt2_BOMScheme", &zt2_BOMScheme));
|
|
|
//<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ơ<EFBFBD><C6A1><EFBFBD><EFBFBD>ƿ<EFBFBD><C6BF><EFBFBD>
|
|
|
if (strstr(cName, transfer) == NULL) {
|
|
|
//<2F>ж<EFBFBD><D0B6>Dz<EFBFBD><C7B2><EFBFBD><EFBFBD>ڶ<EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
boolean pflag = false;
|
|
|
int n_references = 0;
|
|
|
int* levels = 0;
|
|
|
tag_t* references_tag;
|
|
|
char** relation_type_name = NULL;
|
|
|
//ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD>ù<EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5>ļ<EFBFBD><C4BC><EFBFBD>
|
|
|
tag_t itemTag;
|
|
|
ITKCALL(ITEM_ask_item_of_rev(rev, &itemTag));
|
|
|
ITKCALL(WSOM_where_referenced(itemTag, 1, &n_references, &levels, &references_tag, &relation_type_name));
|
|
|
for (int j = 0; j < n_references; j++) {
|
|
|
tag_t refTag = references_tag[j];
|
|
|
char* folderName;
|
|
|
ITKCALL(AOM_ask_value_string(refTag, OBJECT_NAME, &folderName));
|
|
|
if (strstr(folderName, transfer) != NULL) {
|
|
|
pflag = true;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>rev
|
|
|
if (!pflag) {
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
if (scheme_boms.count(rev) > 0) {
|
|
|
log("folderName = {} \n", zt2_MaterialNo);
|
|
|
inCcpMap[revUid].push_back(ccpMaterialNo);
|
|
|
continue;
|
|
|
}
|
|
|
vector<string> ccpMaterialMap;
|
|
|
ccpMaterialMap.push_back(ccpMaterialNo);
|
|
|
inCcpMap[revUid] = ccpMaterialMap;
|
|
|
//<2F>жϷ<D0B6><CFB7><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
//material_revs.put(zt2_MaterialNo, rev);
|
|
|
ITKCALL(BOM_set_window_top_line(ebom_window, NULL, rev, NULLTAG, &bom_line));
|
|
|
vector<_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST> list; //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BOM<4F><4D>Ϣ
|
|
|
vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST> proclist;
|
|
|
|
|
|
recurZYZZSAPYH(bom_line, rev, bomISExist, groupName, now, errMess, set_meops, material_revs,
|
|
|
list, gy_meops, needTCM_meops, proclist);
|
|
|
/*List<DT_BOM_PLM_REQLIST> list = new ArrayList<DT_BOM_PLM_REQLIST>();
|
|
|
List<DT_PROCESSROUTE_S4_REQLIST> proclist = new ArrayList<DT_PROCESSROUTE_S4_REQLIST>();*/
|
|
|
if (list.size() > 0 && strcmp(zt2_BOMScheme, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") == 0) {
|
|
|
char* zt2_Quantity;
|
|
|
ITKCALL(AOM_ask_value_string(rev, "zt2_Quantity", &zt2_Quantity));
|
|
|
if (strstr(zt2_Quantity, "") != 0) {
|
|
|
int quantity = atoi(zt2_Quantity);
|
|
|
if (quantity == 0) {
|
|
|
quantity = 1;
|
|
|
}
|
|
|
int size = list.size();
|
|
|
char* s = new char[10];
|
|
|
_itoa(quantity, s, 10);
|
|
|
list[size - 1].HEAD.BMENG = s;
|
|
|
//head.BMENG = (char*)to_string(quantity).c_str();
|
|
|
}
|
|
|
}
|
|
|
log("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>BOM<EFBFBD><EFBFBD>Ϣ");
|
|
|
logBomMsg(list);
|
|
|
if (proclist.size() > 0) {
|
|
|
logProcessMsg(proclist);
|
|
|
string sendMsg;//lidy20240828 <20><><EFBFBD>ӹ<EFBFBD><D3B9>մ<EFBFBD><D5B4><EFBFBD>
|
|
|
sendProcess(proclist, sendMsg, url);
|
|
|
}
|
|
|
scheme_boms[rev] = list;
|
|
|
process_boms[rev] = proclist;
|
|
|
}
|
|
|
ITKCALL(BOM_close_window(ebom_window));
|
|
|
|
|
|
rev_meops[partRev] = set_meops;
|
|
|
}
|
|
|
|
|
|
char* getFLMDb2(string zt2_MaterialNo2, string groupName, map<string, char*>& flmMap) {
|
|
|
vector<string> matnr;
|
|
|
split(zt2_MaterialNo2, "-", &matnr);
|
|
|
string mes = matnr[0];
|
|
|
if (flmMap.count(mes) > 0) {
|
|
|
return flmMap[mes];
|
|
|
}
|
|
|
char* sortno = (char*)"";
|
|
|
string sql = "select WLFLM from CHINT_GYGL_000 where ZZBM = '";
|
|
|
sql.append(groupName).append("' and WLMC = '/' and FABN = '").append(mes).append("'");
|
|
|
int outputColumn1 = 0, outputValueCount1 = 0;
|
|
|
char*** outputValue1 = NULL;
|
|
|
log("search3 ===> %s\n", sql.c_str());
|
|
|
QuerySQLNoInputParam((char*)sql.c_str(), &outputColumn1, &outputValueCount1, &outputValue1);
|
|
|
if (outputValueCount1 > 0) {
|
|
|
sortno = outputValue1[0][0];
|
|
|
}
|
|
|
flmMap[mes] = sortno;
|
|
|
log("sortno <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> [%s]\n", sortno);
|
|
|
return sortno;
|
|
|
// if (read.next()) {
|
|
|
// sortno = read.getString("WLFLM");
|
|
|
// System.out.println("Ͷ<>Ϸ<EFBFBD><CFB7>ࣺ" + sortno + "zt2_MaterialNo2==>" + zt2_MaterialNo2 + "groupName==>" + groupName);
|
|
|
// }
|
|
|
}
|
|
|
char* getWlflm2(string fabn, map<string, char*>& flmMap) {
|
|
|
char* wlflmMap = (char*)"";
|
|
|
|
|
|
// <20><>ѯ<EFBFBD><D1AF><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD>
|
|
|
if (flmMap.count(fabn) > 0) {
|
|
|
return flmMap[fabn];
|
|
|
}
|
|
|
string query = "select WLFLM from CHINT_GYGL_000 where zzbm = 'M040' and WLMC = '/' and FABN = '%s' ";
|
|
|
char selectRxfs[200];
|
|
|
sprintf(selectRxfs, query.c_str(), fabn.c_str());
|
|
|
int outputColumn1 = 0, outputValueCount1 = 0;
|
|
|
char*** outputValue1 = NULL;
|
|
|
log("search3 ===> %s\n", selectRxfs);
|
|
|
QuerySQLNoInputParam(selectRxfs, &outputColumn1, &outputValueCount1, &outputValue1);
|
|
|
for (int num = 0; num < outputValueCount1; num++) {
|
|
|
//TarGXCODE\", \"TarGXNAME\", \"TemGXCODE\", \"TemGXNAME
|
|
|
wlflmMap = outputValue1[num][0];
|
|
|
}
|
|
|
flmMap[fabn] = wlflmMap;
|
|
|
return wlflmMap;
|
|
|
}
|
|
|
|
|
|
//<2F><>ѹ<EFBFBD>豸ѡ<E8B1B8><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD>·<EFBFBD><C2B7>
|
|
|
tag_t getProcessTagCT(tag_t mantr, char* groupName, const char* type) {
|
|
|
log("getProcessTagCT<EFBFBD><EFBFBD>%s", type);
|
|
|
int n_references = 0;
|
|
|
int* levels = 0;
|
|
|
tag_t* references_tag, processTag = NULLTAG;
|
|
|
char** relation_type_name = NULL;
|
|
|
//ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD>ù<EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
ITKCALL(WSOM_where_referenced(mantr, 1, &n_references, &levels, &references_tag, &relation_type_name));
|
|
|
for (int n = 0; n < n_references; n++) {
|
|
|
//log("relation_type_name===>%s\n", relation_type_name[n]);
|
|
|
if (strcmp(relation_type_name[n], "IMAN_METarget") == 0) {
|
|
|
char *os = NULL, *gname = NULL, *object_name = NULL;
|
|
|
ITKCALL(AOM_ask_value_string(references_tag[n], "object_name", &object_name));
|
|
|
if (tc_strlen(type) == 0 && tc_strstr(object_name, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") != NULL) {
|
|
|
continue;
|
|
|
}
|
|
|
else if (tc_strlen(type) != 0 && tc_strstr(object_name, type) == NULL) {
|
|
|
continue;
|
|
|
}
|
|
|
ITKCALL(AOM_ask_value_string(references_tag[n], "object_string", &os));
|
|
|
tag_t group = NULLTAG;
|
|
|
ITKCALL(AOM_ask_value_tag(references_tag[n], "owning_group", &group));
|
|
|
ITKCALL(AOM_ask_value_string(group, "name", &gname));
|
|
|
log("gname:%s===>%s\n", os, gname);
|
|
|
if (tc_strcmp(gname, groupName) == 0) {
|
|
|
processTag = references_tag[n];
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return processTag;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* <20><>ȡBOM<4F><4D>ϸ<EFBFBD><CFB8>Ϣ <20><><EFBFBD><EFBFBD>Ʒ<EFBFBD>µĵ<C2B5>Ԫ<EFBFBD><D4AA>Ϣ
|
|
|
* @param ccp <20><><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|
|
* @param schemes <20><><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>Ԫ
|
|
|
* @param list <20><>¼BOM xml
|
|
|
* @param proclist <20><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>·<EFBFBD><C2B7>xml
|
|
|
* @param isSends <20><>¼<EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ݵĶ<DDB5><C4B6><EFBFBD>
|
|
|
* @param txtPath û<><C3BB><EFBFBD><EFBFBD>
|
|
|
* @param material_revs <20><>¼<EFBFBD><C2BC>Ҫ<EFBFBD><EFBFBD><DEB8><EFBFBD><EFBFBD>ԵIJ<D4B5><C4B2><EFBFBD>Ʒ<EFBFBD><C6B7>ֻ<EFBFBD><D6BB>¼<EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><DEB8>ڻش<DABB><D8B4><EFBFBD>
|
|
|
* @param groupName <20><>ID M040
|
|
|
* @param now <20><>ǰʱ<C7B0><CAB1>
|
|
|
* @param scheme_boms <20><>Ԫ <20><>Ӧ <20><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BOM
|
|
|
* @param gy_meops <20><>¼<EFBFBD><C2BC><EFBFBD>չ<EFBFBD><D5B9><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
* @param needTCM_meops <20><>¼<EFBFBD><C2BC>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD>·<EFBFBD><C2B7>
|
|
|
* @param flmMap <20><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
* @param isExistBom <20><>¼<EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD>֯<EFBFBD><D6AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
*/
|
|
|
void readBomInfoYH(tag_t ccp, vector<tag_t> schemes,
|
|
|
vector<_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST>& list,
|
|
|
vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST>& proclist,
|
|
|
vector<tag_t> isSends, string txtPath, map<string, tag_t>& material_revs,
|
|
|
char* groupName, char* now, map<tag_t, vector<_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST>> scheme_boms,
|
|
|
map<string, tag_t>& gy_meops, vector<tag_t>& needTCM_meops, map<string, char*>& flmMap,
|
|
|
map<tag_t, char*> &isExistBom, bool isDY) {
|
|
|
|
|
|
char* zt2_MaterialNo, *zt2_WBSNo, *zt2_BOMScheme, *zt2_Quantity, *zt2_unit2, *object_name;
|
|
|
_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_HEAD head;
|
|
|
ITKCALL(AOM_ask_value_string(ccp, "zt2_MaterialNo", &zt2_MaterialNo));
|
|
|
ITKCALL(AOM_ask_value_string(ccp, "zt2_WBSNo", &zt2_WBSNo));
|
|
|
ITKCALL(AOM_UIF_ask_value(ccp, "zt2_BOMScheme", &zt2_BOMScheme));
|
|
|
ITKCALL(AOM_ask_value_string(ccp, "zt2_Quantity", &zt2_Quantity));
|
|
|
tag_t part2;
|
|
|
ITKCALL(ITEM_ask_item_of_rev(ccp, &part2));
|
|
|
ITKCALL(AOM_ask_value_string(part2, "zt2_unit", &zt2_unit2));
|
|
|
ITKCALL(AOM_ask_value_string(ccp, "object_name", &object_name));
|
|
|
char* unit2 = getUnti(zt2_unit2);
|
|
|
material_revs[zt2_MaterialNo] = ccp;
|
|
|
head.PSPNR = (zt2_WBSNo);
|
|
|
head.MATNR = (zt2_MaterialNo);
|
|
|
head.STLAN = (char*)("1");
|
|
|
head.STLAL = (char*)("1");
|
|
|
head.BMENG = (char*)("1");
|
|
|
if (strcmp("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", zt2_BOMScheme) == 0) {
|
|
|
if (strstr(zt2_Quantity, "") != 0) {
|
|
|
int quantity = atoi(zt2_Quantity);
|
|
|
if (quantity == 0) {
|
|
|
quantity = 1;
|
|
|
}
|
|
|
char* s = new char[10];
|
|
|
_itoa(quantity, s, 10);
|
|
|
head.BMENG = s;
|
|
|
}
|
|
|
}
|
|
|
head.WERKS = groupName;
|
|
|
head.BMEIN = unit2;
|
|
|
head.DATUV = now;
|
|
|
char* parnetUid;
|
|
|
ITK__convert_tag_to_uid(ccp, &parnetUid);
|
|
|
head.STKTX = parnetUid;
|
|
|
|
|
|
tag_t meops = getProcessTag(ccp, groupName); //c<><63><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|
|
|
|
|
if (meops != NULLTAG) {
|
|
|
char* itemId;
|
|
|
ITKCALL(AOM_ask_value_string(meops, "item_id", &itemId));
|
|
|
log("processId %s \n", itemId);
|
|
|
readBopInfo1YH(meops, ccp, true, gy_meops, needTCM_meops, groupName, now, proclist);
|
|
|
}
|
|
|
else {
|
|
|
vector<string> vecc;
|
|
|
tag_t item, lastRev = NULLTAG;
|
|
|
split(zt2_MaterialNo, "-", &vecc);
|
|
|
ITKCALL(ITEM_find_item(vecc[0].c_str(), &item));
|
|
|
ITKCALL(ITEM_ask_latest_rev(item, &lastRev));
|
|
|
//log("vecc[0].c_str()%s\n", vecc[0].c_str());
|
|
|
if (lastRev != NULLTAG) {
|
|
|
log("1");
|
|
|
string type = "";
|
|
|
if (isDY) {
|
|
|
for (int i = 0; i < schemes.size(); i++) {
|
|
|
char *scheme_name = NULL;
|
|
|
ITKCALL(AOM_ask_value_string(schemes[i], "object_name", &scheme_name));
|
|
|
if (tc_strstr(scheme_name, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") != NULL) {
|
|
|
type.append("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
tag_t meops2 = isDY ? getProcessTagCT(lastRev, groupName, type.c_str()) : getProcessTag(lastRev, groupName);
|
|
|
readBopInfo1YH(meops2, ccp, false, gy_meops, needTCM_meops, groupName, now, proclist);
|
|
|
}
|
|
|
}
|
|
|
_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS_ITEM* items_items =
|
|
|
new _ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS_ITEM[schemes.size()];
|
|
|
for (int i = 0; i < schemes.size(); i++) {
|
|
|
tag_t rev2 = schemes[i];
|
|
|
char* prop1, *propp2;
|
|
|
ITKCALL(AOM_ask_value_string(rev2, "zt2_MaterialNo", &prop1));
|
|
|
ITKCALL(AOM_ask_value_string(rev2, "object_name", &propp2));
|
|
|
_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS_ITEM items_item;
|
|
|
char* flm = getFLMDb2(prop1, groupName, flmMap);
|
|
|
items_item.SORTF = flm;
|
|
|
items_item.DATUV = now;
|
|
|
items_item.POSTP = (char*)"L";
|
|
|
items_item.POSNR = (char*)"";
|
|
|
items_item.IDNRK = prop1;
|
|
|
items_item.MENGE = (char*)"1";
|
|
|
items_item.POTX1 = (char*)"";
|
|
|
if (strstr(prop1, "-") != NULL) {
|
|
|
vector<string> vecc;
|
|
|
split(prop1, "-", &vecc);
|
|
|
char* flm2 = getWlflm2(vecc[0], flmMap);
|
|
|
items_item.SORTF = flm2;
|
|
|
}
|
|
|
char* zt2_unit22;
|
|
|
tag_t part22;
|
|
|
ITKCALL(ITEM_ask_item_of_rev(rev2, &part22));
|
|
|
ITKCALL(AOM_ask_value_string(part22, "zt2_unit", &zt2_unit22));
|
|
|
char* unit22 = getUnti(zt2_unit22);
|
|
|
items_item.MEINS = unit22;
|
|
|
items_items[i] = items_item;
|
|
|
if (std::find(isSends.begin(), isSends.end(), rev2) != isSends.end())
|
|
|
continue;
|
|
|
else
|
|
|
isSends.push_back(rev2);
|
|
|
if (scheme_boms.count(rev2) > 0 && isExistBom.count(rev2) == 0) {
|
|
|
isExistBom[rev2] = (char*)"test";
|
|
|
vector<_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST> lists = scheme_boms[rev2];
|
|
|
for (int j = 0, len = lists.size(); j < len; j++) {
|
|
|
if (j != len - 1) {
|
|
|
list.push_back(lists[j]);
|
|
|
}
|
|
|
else {
|
|
|
_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST dt = lists[j];
|
|
|
dt.HEAD.PSPNR = zt2_WBSNo;
|
|
|
list.push_back(dt);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS items;
|
|
|
items.ITEM = items_items;
|
|
|
items.__sizeITEM = schemes.size();
|
|
|
_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST list22;
|
|
|
list22.HEAD = head;
|
|
|
list22.ITEMS = items;
|
|
|
list.push_back(list22);
|
|
|
}
|
|
|
char* getNotNullMsg(char* msg) {
|
|
|
if (msg == NULL) {
|
|
|
return (char*)"";
|
|
|
}
|
|
|
else {
|
|
|
return msg;
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
* <20><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>־
|
|
|
*/
|
|
|
void logCcbh(vector<_ns1__DT_USCOREFACTORY_USCORENUMBER_USCOREREQ_ITEMS_ITEM> list_Factorys) {
|
|
|
string msg = "";
|
|
|
for (int i = 0; i < list_Factorys.size(); i++) {
|
|
|
_ns1__DT_USCOREFACTORY_USCORENUMBER_USCOREREQ_ITEMS_ITEM list_Factory = list_Factorys[i];
|
|
|
msg.append("PSPID = ").append(getNotNullMsg(list_Factory.PSPID)).append(" ");
|
|
|
msg.append("RSPOS = ").append(getNotNullMsg(list_Factory.RSPOS)).append(" ");
|
|
|
msg.append("SERNR = ").append(getNotNullMsg(list_Factory.SERNR)).append(" ");
|
|
|
msg.append("MATNR = ").append(getNotNullMsg(list_Factory.MATNR)).append(" ");
|
|
|
msg.append("WERKS = ").append(getNotNullMsg(list_Factory.WERKS)).append(" ");
|
|
|
msg.append("ZGH = ").append(U2G(getNotNullMsg(list_Factory.ZGH))).append(" ");
|
|
|
msg.append("ZPSPID = ").append(getNotNullMsg(list_Factory.ZPSPID)).append(" ");
|
|
|
msg.append("ZZD = ").append(getNotNullMsg(list_Factory.ZZD)).append("\n");
|
|
|
}
|
|
|
log(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ:");
|
|
|
log2(msg);
|
|
|
}
|
|
|
/**
|
|
|
* <20><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>־
|
|
|
*/
|
|
|
void logProcessMsg(vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST> proclist) {
|
|
|
log("start log ProecessMSG %d \n", proclist.size());
|
|
|
string msg = "";
|
|
|
for (int i = 0; i < proclist.size(); i++) {
|
|
|
_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST list = proclist[i];
|
|
|
_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST_HEAD head = list.HEAD;
|
|
|
msg.append("MATNR= ").append(getNotNullMsg(head.MATNR)).append(" ");
|
|
|
msg.append("WERKS= ").append(getNotNullMsg(head.WERKS)).append(" ");
|
|
|
msg.append("VERWE= ").append(getNotNullMsg(head.VERWE)).append(" ");
|
|
|
msg.append("STATU= ").append(getNotNullMsg(head.STATU)).append(" ");
|
|
|
msg.append("DATUV= ").append(getNotNullMsg(head.DATUV)).append(" ");
|
|
|
msg.append("PLNAL= ").append(getNotNullMsg(head.PLNAL)).append(" ");
|
|
|
msg.append("PSPNR= ").append(getNotNullMsg(head.PSPNR)).append("\n[");
|
|
|
|
|
|
_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST_ITEMS items = list.ITEMS;
|
|
|
_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST_ITEMS_ITEM* items_item = items.ITEM;
|
|
|
for (int j = 0; j < items.__sizeITEM; j++) {
|
|
|
_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST_ITEMS_ITEM item_item = items_item[j];
|
|
|
msg.append("PLNAL= ").append(getNotNullMsg(item_item.PLNAL)).append(" ");
|
|
|
msg.append("PLNFL= ").append(getNotNullMsg(item_item.PLNFL)).append(" ");
|
|
|
msg.append("DATUV= ").append(getNotNullMsg(item_item.DATUV)).append(" ");
|
|
|
msg.append("FLGAT= ").append(getNotNullMsg(item_item.FLGAT)).append(" ");
|
|
|
msg.append("BEZFL= ").append(getNotNullMsg(item_item.BEZFL)).append(" ");
|
|
|
msg.append("LTXA1= ").append(U2G(getNotNullMsg(item_item.LTXA1))).append(" ");
|
|
|
msg.append("VORNR1= ").append(getNotNullMsg(item_item.VORNR1)).append(" ");
|
|
|
msg.append("VORNR2= ").append(getNotNullMsg(item_item.VORNR2)).append("\n");
|
|
|
_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST_ITEMS_ITEM_SUBITEMS subItems = item_item.SUBITEMS;
|
|
|
_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST_ITEMS_ITEM_SUBITEMS_SUBITEM* sbuItemSubItems = subItems.SUBITEM;
|
|
|
msg.append("[");
|
|
|
for (int x = 0; x < subItems.__sizeSUBITEM; x++) {
|
|
|
_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST_ITEMS_ITEM_SUBITEMS_SUBITEM sbuItemSubItem = sbuItemSubItems[x];
|
|
|
msg.append("VORNR= ").append(getNotNullMsg(sbuItemSubItem.VORNR)).append(" ");
|
|
|
msg.append("ARBPL= ").append(getNotNullMsg(sbuItemSubItem.ARBPL)).append(" ");
|
|
|
msg.append("STEUS= ").append(getNotNullMsg(sbuItemSubItem.STEUS)).append(" ");
|
|
|
msg.append("LTXA1= ").append(U2G(getNotNullMsg(sbuItemSubItem.LTXA1))).append(" ");
|
|
|
msg.append("USR00= ").append(getNotNullMsg(sbuItemSubItem.USR00)).append(" ");
|
|
|
msg.append("BMSCH= ").append(getNotNullMsg(sbuItemSubItem.BMSCH)).append(" ");
|
|
|
msg.append("PLNME= ").append(getNotNullMsg(sbuItemSubItem.PLNME)).append(" ");
|
|
|
msg.append("VGW01= ").append(getNotNullMsg(sbuItemSubItem.VGW01)).append(" ");
|
|
|
msg.append("VGE01= ").append(getNotNullMsg(sbuItemSubItem.VGE01)).append(" ");
|
|
|
msg.append("VGW02= ").append(getNotNullMsg(sbuItemSubItem.VGW02)).append(" ");
|
|
|
msg.append("VGE02= ").append(getNotNullMsg(sbuItemSubItem.VGE02)).append(" ");
|
|
|
msg.append("VGW05= ").append(getNotNullMsg(sbuItemSubItem.VGW05)).append(" ");
|
|
|
msg.append("VGE05= ").append(getNotNullMsg(sbuItemSubItem.VGE05)).append("\n");
|
|
|
}
|
|
|
msg.append("]\n");
|
|
|
}
|
|
|
msg.append("]\n");
|
|
|
}
|
|
|
string logmsg = " <20><>ʼ<EFBFBD><CABC>¼PROCESS<53><53>Ϣ====>";
|
|
|
//log(" <20><>ʼ<EFBFBD><CABC>¼PROCESS<53><53>Ϣ====>%s", msg.c_str());
|
|
|
log2(logmsg.append(msg));
|
|
|
}
|
|
|
/**
|
|
|
* <20><>¼BOM<4F><4D>Ϣ<EFBFBD><CFA2>־
|
|
|
*/
|
|
|
void logBomMsg(vector<_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST> lists) {
|
|
|
string msg = "";
|
|
|
for (int i = 0; i < lists.size(); i++) {
|
|
|
_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST list = lists[i];
|
|
|
_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_HEAD head = list.HEAD;
|
|
|
msg.append("PSPNR= ").append(getNotNullMsg(head.PSPNR)).append(" ");
|
|
|
msg.append("MATNR= ").append(getNotNullMsg(head.MATNR)).append(" ");
|
|
|
msg.append("WERKS= ").append(getNotNullMsg(head.WERKS)).append(" ");
|
|
|
msg.append("DATUV= ").append(getNotNullMsg(head.DATUV)).append(" ");
|
|
|
msg.append("STLAN= ").append(getNotNullMsg(head.STLAN)).append(" ");
|
|
|
msg.append("STLAL= ").append(getNotNullMsg(head.STLAL)).append(" ");
|
|
|
msg.append("BMENG= ").append(getNotNullMsg(head.BMENG)).append(" ");
|
|
|
msg.append("BMEIN= ").append(getNotNullMsg(head.BMEIN)).append(" ");
|
|
|
msg.append("STKTX= ").append(getNotNullMsg(head.STKTX)).append("\n[");
|
|
|
_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS items = list.ITEMS;
|
|
|
_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS_ITEM* items_item = items.ITEM;
|
|
|
for (int j = 0; j < items.__sizeITEM; j++) {
|
|
|
_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST_ITEMS_ITEM item_item = items_item[j];
|
|
|
msg.append("DATUV= ").append(getNotNullMsg(item_item.DATUV)).append(" ");
|
|
|
msg.append("POSTP= ").append(getNotNullMsg(item_item.POSTP)).append(" ");
|
|
|
msg.append("POSNR= ").append(getNotNullMsg(item_item.POSNR)).append(" ");
|
|
|
msg.append("IDNRK= ").append(getNotNullMsg(item_item.IDNRK)).append(" ");
|
|
|
msg.append("MENGE= ").append(getNotNullMsg(item_item.MENGE)).append(" ");
|
|
|
msg.append("MEINS= ").append(getNotNullMsg(item_item.MEINS)).append(" ");
|
|
|
msg.append("SORTF= ").append(getNotNullMsg(item_item.SORTF)).append(" ");
|
|
|
msg.append("POTX1= ").append(getNotNullMsg(item_item.POTX1)).append("\n");
|
|
|
}
|
|
|
msg.append("]\n");
|
|
|
}
|
|
|
string logmsg = " <20><>ʼ<EFBFBD><CABC>¼BOM<4F><4D>Ϣ====>";
|
|
|
//log(" <20><>ʼ<EFBFBD><CABC>¼BOM<4F><4D>Ϣ====>%s", msg.c_str());
|
|
|
log2(logmsg.append(msg));
|
|
|
}
|
|
|
/**
|
|
|
* <20><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>DETAILS<4C><53><EFBFBD><EFBFBD> <20>ش<EFBFBD><D8B4><EFBFBD>
|
|
|
* @param bomMsg <20><>֯<EFBFBD><D6AF>xml<6D><6C>Ϣ
|
|
|
* @param isExistTag <20>жϵ<D0B6>Ԫ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>γ<EFBFBD><CEB3><EFBFBD>
|
|
|
* @param ccpTagMap <20><>ȡ<EFBFBD><C8A1>Ԫ<EFBFBD><D4AA>Ӧ<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD>ϱ<EFBFBD><CFB1><EFBFBD>
|
|
|
* @param code <20><><EFBFBD>ݺ<EFBFBD>
|
|
|
* @param batchNum <20><><EFBFBD>κ<EFBFBD>
|
|
|
*/
|
|
|
void logBatabase(_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST bomMsg,
|
|
|
map<string, string> &isExistTag, map<string, vector<string>> ccpTagMap,
|
|
|
char *code, string batchNum, char *groupId, char*wbsNo, char* alterstatus, bool last) {
|
|
|
log("logBatabase===0");
|
|
|
char topUid[32] = "", *itemId = NULL, *topMatnrNo = NULL;
|
|
|
string materialNoTmp = "";
|
|
|
tc_strcpy(topUid, bomMsg.HEAD.STKTX);
|
|
|
log("topUid===%s", topUid);
|
|
|
if (ccpTagMap.count(topUid) == 0) {
|
|
|
log("logBatabase===1");
|
|
|
if(bomMsg.HEAD.MATNR)
|
|
|
materialNoTmp = bomMsg.HEAD.MATNR;
|
|
|
}
|
|
|
else {
|
|
|
log("logBatabase===2");
|
|
|
vector<string> ccps = ccpTagMap[topUid];
|
|
|
for (int i = 0; i < ccps.size(); i++) {
|
|
|
if (i > 0) {
|
|
|
materialNoTmp.append(";").append(ccps[i]);
|
|
|
}
|
|
|
else {
|
|
|
materialNoTmp.append(ccps[i]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (tc_strlen(topUid) > 0 && isExistTag.count(topUid) == 0) {
|
|
|
log("logBatabase===3");
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݱ<EFBFBD>
|
|
|
tag_t topTag = NULLTAG, partTag = NULLTAG;
|
|
|
ITK__convert_uid_to_tag(topUid, &topTag);
|
|
|
char *type = NULL;
|
|
|
ITKCALL(WSOM_ask_object_type2(topTag, &type));
|
|
|
if (tc_strcmp(type, "ZT2_Design3DRevision") == 0) {
|
|
|
int num = 0;
|
|
|
tag_t *comps = NULL;
|
|
|
ITKCALL(AOM_ask_value_tags(topTag, "representation_for", &num, &comps));
|
|
|
for (int i = 0; i < num; i++) {
|
|
|
char *type2 = NULL;
|
|
|
ITKCALL(WSOM_ask_object_type2(comps[i], &type2));
|
|
|
if (tc_strcmp(type2, "Part Revision") == 0) {
|
|
|
partTag = comps[i];
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
ITK__convert_uid_to_tag(topUid, &partTag);
|
|
|
}
|
|
|
ITKCALL(AOM_ask_value_string(topTag, "item_id", &itemId));
|
|
|
ITKCALL(AOM_ask_value_string(partTag, "zt2_MaterialNo", &topMatnrNo));
|
|
|
isExistTag[topUid] = materialNoTmp.c_str();
|
|
|
string insertSql = "insert into CHINT_BOM_TO_SAP_DETIALS (code,batchnumber,plmsendstatus,plmsendstarttime,factory,productmaterialno,pitemid,puid,materialno,wbsno,plmstatus,plmalterstatus) VALUES ('%s','%s','PLM<4C><4D>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>',SYSDATE,'%s','%s','%s','%s','%s','%s','δ<><CEB4><EFBFBD><EFBFBD>','%s') ";
|
|
|
char selectRxfs[3000];
|
|
|
sprintf(selectRxfs, insertSql.c_str(), code, batchNum.c_str(), groupId, materialNoTmp.c_str(), itemId, topUid, bomMsg.HEAD.MATNR, wbsNo, alterstatus);
|
|
|
log("selectRecord2 ===> %s\n", selectRxfs);
|
|
|
ExecuteSQLNoInputParam(selectRxfs);
|
|
|
ExecuteSQLNoInputParam((char*)"commit");
|
|
|
if (last) {
|
|
|
log("logBatabase===6");
|
|
|
string updateSql = "update CHINT_BOM_TO_SAP_DETIALS set productmaterialno = '%s' where batchnumber = '%s'";
|
|
|
char selectRxfs[3000];
|
|
|
sprintf(selectRxfs, updateSql.c_str(), materialNoTmp.c_str(), batchNum.c_str());
|
|
|
log("selectRecord2 ===> %s\n", selectRxfs);
|
|
|
ExecuteSQLNoInputParam(selectRxfs);
|
|
|
ExecuteSQLNoInputParam((char*)"commit");
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
log("logBatabase===4");
|
|
|
string updateSql = "update CHINT_BOM_TO_SAP_DETIALS set productmaterialno = '%s' where batchnumber = '%s'";
|
|
|
char selectRxfs[3000];
|
|
|
sprintf(selectRxfs, updateSql.c_str(), materialNoTmp.c_str(), batchNum.c_str());
|
|
|
log("selectRecord2 ===> %s\n", selectRxfs);
|
|
|
ExecuteSQLNoInputParam(selectRxfs);
|
|
|
ExecuteSQLNoInputParam((char*)"commit");
|
|
|
}
|
|
|
log("logBatabase===5");
|
|
|
return;
|
|
|
}
|
|
|
/**
|
|
|
* <20><><EFBFBD>㴫<EFBFBD>ݵĺ<DDB5>ʱ
|
|
|
* @param code <20><><EFBFBD>ݺ<EFBFBD>
|
|
|
*/
|
|
|
string getPlmTime(char *code) {
|
|
|
string getMsg = "select trunc((sysdate - plmstarttime) * 24)||'h:'||trunc(mod((sysdate - plmstarttime) * 24 * 60, 60))||'min:'|| trunc(mod((sysdate - plmstarttime) * 24 * 60 * 60, 60))||'s' tim from CHINT_BOM_TO_SAP_SUM where code = %s ";
|
|
|
char selectRxfs[600];
|
|
|
string timel;
|
|
|
sprintf(selectRxfs, getMsg.c_str(), code);
|
|
|
int outputColumn1 = 0, outputValueCount1 = 0;
|
|
|
char*** outputValue1 = NULL;
|
|
|
log("selectRecord2 ===> %s\n", selectRxfs);
|
|
|
QuerySQLNoInputParam(selectRxfs, &outputColumn1, &outputValueCount1, &outputValue1);
|
|
|
for (int num = 0; num < outputValueCount1; num++) {
|
|
|
//TarGXCODE\", \"TarGXNAME\", \"TemGXCODE\", \"TemGXNAME
|
|
|
timel = outputValue1[num][0];
|
|
|
}
|
|
|
return timel;
|
|
|
}
|
|
|
/**
|
|
|
* <20><><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD>BOM<4F><4D>SAP
|
|
|
* @param groupId <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID
|
|
|
* @param mapList <20><>¼ <20><><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>Ӧ<EFBFBD><D3A6>BOM<4F><4D>Ϣ
|
|
|
* @param code <20><><EFBFBD>ݺ<EFBFBD>
|
|
|
* @param wbsNo WBS<42><53>
|
|
|
* @param inCcpMap <20><>Ԫ<EFBFBD><D4AA>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD><CFB1><EFBFBD> 1<>Զ<EFBFBD>
|
|
|
*/
|
|
|
void startSplitSend(char*groupId,
|
|
|
map<tag_t, vector<_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST>> mapList,
|
|
|
char *code, char *wbsNo, map<string, vector<string>> inCcpMap, char* url) {
|
|
|
int url_num = 0;
|
|
|
char** url_vals = NULL;
|
|
|
//<2F><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>IJ<EFBFBD><C4B2>ַ<EFBFBD><D6B7><EFBFBD>
|
|
|
ITKCALL(PREF_ask_char_values("CHINT_SAPBOM_SPLIT", &url_num, &url_vals));
|
|
|
int cfNum = 1; // <20><><EFBFBD>ִ<EFBFBD><D6B4>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
int type = 0; //0<><30><EFBFBD><EFBFBD>Ʒά<C6B7><CEAC> 1 BOM
|
|
|
for (int j = 0; j < url_num; j++) {
|
|
|
vector<string> vec;
|
|
|
Split(url_vals[j], ":", vec);
|
|
|
if (vec.size() == 3) {
|
|
|
if (strcmp(groupId, vec[0].c_str()) == 0) {
|
|
|
if (strcmp("BOM", vec[1].c_str()) == 0) {
|
|
|
type = 1;
|
|
|
}
|
|
|
cfNum = atoi(vec[2].c_str());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
log("====url_vals====%d %zd\n", cfNum, mapList.size());
|
|
|
url_num = 0;
|
|
|
char** rule_vals = NULL;
|
|
|
char alterstatus[2] = "N";
|
|
|
//<2F>Ƿ<EFBFBD><C7B7><EFBFBD>Ҫ<EFBFBD><EFBFBD>״̬
|
|
|
ITKCALL(PREF_ask_char_values("CHINT_BOMTOSAP_STATUS_RULE", &url_num, &rule_vals));
|
|
|
for (int i = 0; i < url_num; i++) {
|
|
|
vector<string> vec;
|
|
|
Split(rule_vals[i], ":", vec);
|
|
|
if (tc_strcmp(vec[0].c_str(), groupId) == 0) {
|
|
|
tc_strcpy(alterstatus, vec[1].c_str());
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
int batchNum = 1;
|
|
|
int numberCnt = 0;
|
|
|
map<string, string> ccpMap;
|
|
|
//map<string, vector<tag_t>> ccpTagMap;
|
|
|
//<2F><><EFBFBD><EFBFBD>BOM <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD>
|
|
|
if (type == 0) {
|
|
|
int count = 1;
|
|
|
vector<_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST> list;
|
|
|
for (auto it = mapList.begin(); it != mapList.end(); ++it) {
|
|
|
//std::cout << "Key: " << it->first << ", Value: " << it->second << std::endl;
|
|
|
tag_t ccp = it->first;
|
|
|
vector<_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST > bomList = mapList[ccp];
|
|
|
log("====bomList====%d \n", bomList.size());
|
|
|
logBomMsg(bomList);
|
|
|
for (int i = 0; i < bomList.size(); i++) {
|
|
|
_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST bomMsg = bomList[i];
|
|
|
/*if (ccpTagMap.count(bomMsg.HEAD.STKTX) > 0) {
|
|
|
ccpTagMap[bomMsg.HEAD.STKTX].push_back(ccp);
|
|
|
}
|
|
|
else {
|
|
|
vector< tag_t> ccpVector;
|
|
|
ccpVector.push_back(ccp);
|
|
|
ccpTagMap[bomMsg.HEAD.STKTX] = ccpVector;
|
|
|
}*/
|
|
|
|
|
|
list.push_back(bomMsg);
|
|
|
}
|
|
|
int last = list.size();
|
|
|
if (count == mapList.size()) {
|
|
|
numberCnt = numberCnt + 1;
|
|
|
string batchMsg;
|
|
|
char numMsg[128] = "";
|
|
|
sprintf_s(numMsg, "%05d", batchNum);
|
|
|
batchMsg.append(code).append("-").append(numMsg);
|
|
|
log("batchMsg%s\n", batchMsg.c_str());
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
log("i.size() ===> %d \n", i);
|
|
|
_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST bomMsg = list[i];
|
|
|
logBatabase(bomMsg, ccpMap, inCcpMap, code, batchMsg, groupId, wbsNo, alterstatus, i == last - 1);
|
|
|
}
|
|
|
log(" start SEND ===\n");
|
|
|
sendBom(list, batchMsg, url);
|
|
|
batchNum = batchNum + 1;
|
|
|
list.clear();
|
|
|
}
|
|
|
else if (count % cfNum == 0) {
|
|
|
numberCnt = numberCnt + 1;
|
|
|
string batchMsg;
|
|
|
char numMsg[128] = "";
|
|
|
sprintf_s(numMsg, "%05d", batchNum);
|
|
|
batchMsg.append(code).append("-").append(numMsg);
|
|
|
log("batchMsg%s\n", batchMsg.c_str());
|
|
|
log("list.size() ===> %d \n", list.size());
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
log("i.size() ===> %d \n", i);
|
|
|
_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST bomMsg = list[i];
|
|
|
logBatabase(bomMsg, ccpMap, inCcpMap, code, batchMsg, groupId, wbsNo, alterstatus, i == last - 1);
|
|
|
//log("i.size() ===> %d \n", i);
|
|
|
}
|
|
|
log(" start SEND ===");
|
|
|
sendBom(list, batchMsg, url);
|
|
|
batchNum = batchNum + 1;
|
|
|
list.clear();
|
|
|
}
|
|
|
count++;
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
//<2F><>BOM<4F><4D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD>
|
|
|
int count = 1;
|
|
|
vector<_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST> list;
|
|
|
for (auto it = mapList.begin(); it != mapList.end(); ++it) {
|
|
|
//std::cout << "Key: " << it->first << ", Value: " << it->second << std::endl;
|
|
|
tag_t ccp = it->first;
|
|
|
vector<_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST > bomList = mapList[ccp];
|
|
|
for (int i = 0; i < bomList.size(); i++) {
|
|
|
list.push_back(bomList[i]);
|
|
|
if (list.size() % cfNum == 0) {
|
|
|
numberCnt = numberCnt + 1;
|
|
|
string batchMsg;
|
|
|
char numMsg[128] = "";
|
|
|
sprintf_s(numMsg, "%05d", batchNum);
|
|
|
batchMsg.append(code).append("-").append(numMsg);
|
|
|
int last = list.size();
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST bomMsg = list[i];
|
|
|
logBatabase(bomMsg, ccpMap, inCcpMap, code, batchMsg, groupId, wbsNo, alterstatus, i == last - 1);
|
|
|
}
|
|
|
sendBom(list, batchMsg, url);
|
|
|
batchNum = batchNum + 1;
|
|
|
list.clear();
|
|
|
}
|
|
|
}
|
|
|
int last = list.size();
|
|
|
if (count == mapList.size() && list.size()>0) {
|
|
|
string batchMsg;
|
|
|
char numMsg[128] = "";
|
|
|
sprintf_s(numMsg, "%05d", batchNum);
|
|
|
numberCnt = numberCnt + 1;
|
|
|
batchMsg.append(code).append("-").append(numMsg);
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST bomMsg = list[i];
|
|
|
logBatabase(bomMsg, ccpMap, inCcpMap, code, batchMsg, groupId, wbsNo, alterstatus, i == last - 1);
|
|
|
}
|
|
|
sendBom(list, batchMsg, url);
|
|
|
batchNum = batchNum + 1;
|
|
|
list.clear();
|
|
|
}
|
|
|
count++;
|
|
|
}
|
|
|
}
|
|
|
string time1 = getPlmTime(code);
|
|
|
string updateSum = "update CHINT_BOM_TO_SAP_SUM set \"NUMBER\" = %d ,datastatus = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SAP',organizationaltime = '%s',taskstauts = '<27><>֯<EFBFBD><D6AF><EFBFBD><EFBFBD>',PLMFINISHTIME = SYSDATE where code = '%s' ";
|
|
|
char selectRxfs[800];
|
|
|
string timel;
|
|
|
sprintf(selectRxfs, updateSum.c_str(), numberCnt, time1.c_str(), code);
|
|
|
log("selectRecord2 ===> %s\n", selectRxfs);
|
|
|
ExecuteSQLNoInputParam(selectRxfs);
|
|
|
ExecuteSQLNoInputParam((char*)"commit");
|
|
|
}
|
|
|
//#define SEND_MSG "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> \\\""
|
|
|
//#define SPLIT_MSG "\\\" \\\""
|
|
|
//#define CODE_MSG "\\\" <20><>Ŀ<EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: "
|
|
|
#define SEND_MSG "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> \\\\\"\""
|
|
|
#define SPLIT_MSG "\\\\\"\" \\\\\"\""
|
|
|
#define CODE_MSG "\\\\\"\" <20><>Ŀ<EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: "
|
|
|
#define TYPE_MSG ", <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: "
|
|
|
#define RESULT_MSG ", <20><><EFBFBD>δ<EFBFBD><CEB4>ݽ<EFBFBD><DDBD><EFBFBD>Ϊ: PLM<4C><4D><EFBFBD><EFBFBD>δͨ<CEB4><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>:\\n"
|
|
|
|
|
|
/**
|
|
|
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD>֪ͨ
|
|
|
* @param code <20><><EFBFBD>ݵı<DDB5><C4B1><EFBFBD>code
|
|
|
* @param errMsg <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
* @param wbsNo <20><>Ŀ<EFBFBD><C4BF>WBS<42><53>
|
|
|
* @param userName <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
|
|
* @param projectName <20><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>
|
|
|
*/
|
|
|
void sendNotice(char *code, string errMsg, char *wbsNo, char *groupName, char *userName, char* projectName) {
|
|
|
/*string noticeMsg = "<22><>ĿBOM<4F><4D><EFBFBD><EFBFBD><EFBFBD>쳣WBS:";
|
|
|
noticeMsg.append(wbsNo).append("\n").append(errMsg);*/
|
|
|
|
|
|
string search = "select userid,TO_CHAR(STARTTIME,'yyyy-MM-dd HH24:mi:ss'),transfer from CHINT_BOM_TO_SAP_SUM where code = '%s' ";
|
|
|
|
|
|
char selectRxfs[600];
|
|
|
string userNameStr = "";
|
|
|
string startTime, transfer;
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
sprintf(selectRxfs, search.c_str(), code);
|
|
|
int outputColumn1 = 0, outputValueCount1 = 0;
|
|
|
char*** outputValue1 = NULL;
|
|
|
log("selectRecord2 ===> %s\n", selectRxfs);
|
|
|
QuerySQLNoInputParam(selectRxfs, &outputColumn1, &outputValueCount1, &outputValue1);
|
|
|
for (int num = 0; num < outputValueCount1; num++) {
|
|
|
if (tc_strcmp(outputValue1[num][0], "admin") != 0)
|
|
|
userNameStr.append("\"\"").append(outputValue1[num][0]).append("\"\"");
|
|
|
startTime = outputValue1[num][1];
|
|
|
transfer = outputValue1[num][2];
|
|
|
}
|
|
|
//
|
|
|
int pref_cnt = 0;
|
|
|
char **pref = NULL;
|
|
|
ITKCALL(PREF_ask_char_values("CHINT_SENDMESSAGE_SYSAD_USER", &pref_cnt, &pref));
|
|
|
string mobiles = "";
|
|
|
vector<string> vec1, vec2;
|
|
|
Split(pref[0], ",", vec1);
|
|
|
for (int i = 0; i < vec1.size(); i++) {
|
|
|
if (i > 0)
|
|
|
mobiles.append(",");
|
|
|
mobiles.append("\"\"").append(vec1[i]).append("\"\"");
|
|
|
}
|
|
|
Split(pref[1], ",", vec2);
|
|
|
for (int i = 0; i < vec2.size(); i++) {
|
|
|
if (userNameStr.size() > 0)
|
|
|
userNameStr.append(",");
|
|
|
userNameStr.append("\"\"").append(vec2[i]).append("\"\"");
|
|
|
}
|
|
|
|
|
|
string noticeMsg = "<EFBFBD><EFBFBD>PLMϵͳ<EFBFBD>Զ<EFBFBD>֪ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
|
|
noticeMsg.append(groupName).append("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>").append(startTime).append(" ")
|
|
|
.append(userName).append(SEND_MSG)
|
|
|
.append(wbsNo).append(SPLIT_MSG)
|
|
|
.append(projectName).append(CODE_MSG)
|
|
|
.append(code).append(TYPE_MSG).append(transfer).append(RESULT_MSG)
|
|
|
.append(errMsg);
|
|
|
string json = "{";
|
|
|
|
|
|
json.append("\"\"mobiles\"\":").append("[").append(mobiles).append("],");//13588843438\"\",\"\"15295371103
|
|
|
json.append("\"\"emails\"\":").append("[").append(userNameStr).append("],");
|
|
|
//json.append("\"\"sms\"\":").append("false,");
|
|
|
json.append("\"\"content\"\":\"\"").append(noticeMsg).append("\"\"");
|
|
|
json.append("}");
|
|
|
|
|
|
log(" <20><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֯<EFBFBD><D6AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ :%s \n", json.c_str());
|
|
|
//string returnMsg = callFsHttpserver(json, "http://10.128.10.170/api/feishu/Message/sendMessages");
|
|
|
string cmd = "java -jar \"";
|
|
|
cmd.append(getenv("TC_ROOT")).append("\\bin\\uploadMinio.jar\" FS \"").append(json).append("\"");
|
|
|
log("cmd==>");
|
|
|
log2(cmd);
|
|
|
FILE* pf = NULL;
|
|
|
string strResult;
|
|
|
char buf[8000] = { 0 };
|
|
|
if ((pf = _popen(cmd.c_str(), "r")) == NULL) {
|
|
|
log("<EFBFBD>ӿڷ<EFBFBD><EFBFBD><EFBFBD>1\n");
|
|
|
}
|
|
|
else {
|
|
|
log("<EFBFBD>ӿڷ<EFBFBD><EFBFBD><EFBFBD>2\n");
|
|
|
while (fgets(buf, sizeof buf, pf)) {
|
|
|
strResult += buf;
|
|
|
}
|
|
|
_pclose(pf);
|
|
|
}
|
|
|
|
|
|
log(" <20><><EFBFBD><EFBFBD>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD> :%s \n", strResult.c_str());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* <20><><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>Ʒ<EFBFBD><C6B7>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>BOM
|
|
|
* @param ccpVector <20><><EFBFBD><EFBFBD>Ʒ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
|
|
* @param projectNo <20><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>
|
|
|
* @param groupName <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>
|
|
|
* @param wbs <20><>Ŀ<EFBFBD><C4BF>WBS<42><53>
|
|
|
* @param now <20><>ǰʱ<C7B0><CAB1>
|
|
|
* @param errMsgBuf <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
* @param code <20><><EFBFBD>ݵı<DDB5><C4B1><EFBFBD>code
|
|
|
* @param transfer <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
* @param userName <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
|
|
* @param projectName <20><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>
|
|
|
*/
|
|
|
void getCcpAndBom(vector<tag_t> ccpVector, char* projectNo, char* groupName, char* wbs,
|
|
|
char* now, string& errMsgBuf, char*code, char* transfer, char* userName, char* projectName, bool isDY) {
|
|
|
log("************** getCcpAndBom **************");
|
|
|
int pref_cnt = 0;
|
|
|
char **urls = NULL;
|
|
|
ITKCALL(PREF_ask_char_values("CHINT_BomUrl_YB", &pref_cnt, &urls));
|
|
|
if (pref_cnt < 3) {
|
|
|
errMsgBuf.append("CHINT_BomUrl_YB<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD>ȷ\\n");
|
|
|
//
|
|
|
string updateSum = "update CHINT_BOM_TO_SAP_SUM set \"DATASTATUS\" = 'CHINT_BomUrl_YB<59><42>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><C3B2><EFBFBD>ȷ' ,SAPRESULT = 'PLM<4C><4D><EFBFBD><EFBFBD>δͨ<CEB4><CDA8>',PLMRESULT = '<27>ѷ<EFBFBD><D1B7>ͷ<EFBFBD><CDB7><EFBFBD>֪ͨ' where code = '%s' ";
|
|
|
char selectRxfs[800];
|
|
|
string timel;
|
|
|
sprintf(selectRxfs, updateSum.c_str(), code);
|
|
|
log("selectRecord2 ===> %s\n", selectRxfs);
|
|
|
ExecuteSQLNoInputParam(selectRxfs);
|
|
|
ExecuteSQLNoInputParam((char*)"commit");
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѷ<EFBFBD><D1B7>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
sendNotice(code, errMsgBuf, wbs, groupName, userName, projectName);
|
|
|
return;
|
|
|
}
|
|
|
//<2F><>¼<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8>ij<EFBFBD><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
vector<tag_t> isCheck_FactoryNos;
|
|
|
//<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>Ʒ <20><>Ӧ<EFBFBD><D3A6> <20><><EFBFBD><EFBFBD>BOM<4F><4D><EFBFBD><EFBFBD>
|
|
|
map<tag_t, vector<tag_t>> cPart_schemes;
|
|
|
vector<_ns1__DT_USCOREFACTORY_USCORENUMBER_USCOREREQ_ITEMS_ITEM> list_Factorys;
|
|
|
for (int len = 0; len < ccpVector.size(); len++) {
|
|
|
vector<tag_t> elcBoms;
|
|
|
tag_t ccp = ccpVector[len], *factoryNos;
|
|
|
char* ccpUid;
|
|
|
ITK__convert_tag_to_uid(ccp, &ccpUid);
|
|
|
log("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƷUID:%s\n", ccpUid);
|
|
|
ITKCALL(AOM_refresh(ccp, FALSE));
|
|
|
int num = 0;
|
|
|
ITKCALL(AOM_ask_value_tags(ccp, "ZT2_FactoryNumber", &num, &factoryNos));
|
|
|
if (num == 0) {
|
|
|
cPart_schemes[ccp] = elcBoms;
|
|
|
}
|
|
|
else {
|
|
|
if (cPart_schemes.count(ccp) > 0) {
|
|
|
continue;
|
|
|
}//<2F><>֯<EFBFBD><D6AF><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>
|
|
|
getFactoryNoList(projectNo, groupName, wbs, factoryNos, num, ccp, list_Factorys);
|
|
|
map<tag_t, vector<tag_t>> items2;
|
|
|
for (int i = 0; i < num; i++) {
|
|
|
tag_t factoryNo = factoryNos[i];
|
|
|
if (std::find(isCheck_FactoryNos.begin(), isCheck_FactoryNos.end(), factoryNo) != isCheck_FactoryNos.end())
|
|
|
continue;
|
|
|
isCheck_FactoryNos.push_back(factoryNos[i]);
|
|
|
|
|
|
int n_references = 0;
|
|
|
int* levels = 0;
|
|
|
tag_t* references_tag;
|
|
|
char** relation_type_name = NULL;
|
|
|
//ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD>ù<EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
ITKCALL(WSOM_where_referenced(factoryNo, 1, &n_references, &levels, &references_tag, &relation_type_name));
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>²<EFBFBD><C2B2><EFBFBD>Ʒ<EFBFBD><C6B7>ITEM<45><4D>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD>汾Ӱ<E6B1BE><D3B0>
|
|
|
tag_t ccpItem;
|
|
|
char* ccpItemUid;
|
|
|
ITEM_ask_item_of_rev(ccp, &ccpItem);
|
|
|
ITK__convert_tag_to_uid(ccpItem, &ccpItemUid);
|
|
|
log("===========%d \n", n_references);
|
|
|
for (int i = 0; i < n_references; i++)
|
|
|
{
|
|
|
char* refType, *grpName, *useUid, *object_name, *zt2_SapState;
|
|
|
tag_t refTag = references_tag[i], group, item;
|
|
|
ITKCALL(AOM_ask_value_string(refTag, "object_type", &refType));
|
|
|
if (strcmp(refType, "Part Revision") != 0) {
|
|
|
continue;
|
|
|
}
|
|
|
ITK__convert_tag_to_uid(refTag, &useUid);
|
|
|
//<2F>жϲ<D0B6><CFB2>Dz<EFBFBD><C7B2><EFBFBD>Ʒ <20><><EFBFBD><EFBFBD>ͬһ<CDAC><D2BB>
|
|
|
ITKCALL(AOM_ask_value_tag(refTag, "owning_group", &group));
|
|
|
ITKCALL(AOM_ask_value_string(group, "name", &grpName));
|
|
|
if (strcmp(grpName, groupName) != 0 || strcmp(ccpUid, useUid) == 0)
|
|
|
continue;
|
|
|
ITKCALL(AOM_UIF_ask_value(refTag, "object_name", &object_name));
|
|
|
ITKCALL(AOM_UIF_ask_value(refTag, "zt2_SapState", &zt2_SapState));
|
|
|
if (strcmp(zt2_SapState, "1") == 0 || strcmp(zt2_SapState, "δ<EFBFBD><EFBFBD>") == 0) {
|
|
|
continue;
|
|
|
}
|
|
|
ITKCALL(ITEM_ask_item_of_rev(refTag, &item));
|
|
|
char* unitUid;
|
|
|
ITK__convert_tag_to_uid(item, &unitUid);
|
|
|
if (strcmp(unitUid, ccpItemUid) == 0) {
|
|
|
continue;
|
|
|
}
|
|
|
log("useUid %s object_name %s \n", useUid, object_name);
|
|
|
if (items2.count(item) > 0) {
|
|
|
items2[item].push_back(refTag);
|
|
|
}
|
|
|
else {
|
|
|
vector<tag_t> revs2;
|
|
|
revs2.push_back(refTag);
|
|
|
items2[item] = revs2;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
vector<tag_t> rev2 = addLastRev(items2);
|
|
|
cPart_schemes[ccp] = rev2;
|
|
|
}
|
|
|
}
|
|
|
//<2F><><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵļ<C5B5>¼<EFBFBD><C2BC>־<EFBFBD><D6BE>Ϣ
|
|
|
log("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> num :%zd\n", list_Factorys.size());
|
|
|
logCcbh(list_Factorys);
|
|
|
|
|
|
sendFactoryNo(list_Factorys, urls[0]);
|
|
|
|
|
|
string errMess;//<2F><>¼BOM<4F><4D><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
map<string, tag_t> material_revs; //<2F><>¼<EFBFBD><C2BC>Ҫ<EFBFBD><EFBFBD><DEB8><EFBFBD><EFBFBD>ԵIJ<D4B5><C4B2><EFBFBD>Ʒ
|
|
|
vector<tag_t> set_meops; //<2F><>¼<EFBFBD><C2BC>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD>·<EFBFBD><C2B7>
|
|
|
map<string, tag_t> gy_meops; //<2F><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
|
|
|
vector<tag_t> needTCM_meops;//û<><C3BB><EFBFBD><EFBFBD>
|
|
|
map<tag_t, vector<tag_t>>::iterator it;
|
|
|
map<tag_t, vector<_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST>> scheme_boms;//<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BOM<4F><4D><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD>Ϣ
|
|
|
map<tag_t, vector<_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST>> process_boms;
|
|
|
vector<string> bomISExist;//<2F><>¼<EFBFBD><C2BC><EFBFBD>ϱ<EFBFBD><CFB1><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD>ظ<EFBFBD>
|
|
|
//<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>ƥ<EFBFBD><C6A5>
|
|
|
map<tag_t, vector<tag_t>> rev_meops;
|
|
|
map<string, vector<string>> inCcpMap;//<2F><>¼<EFBFBD><C2BC>Ԫ<EFBFBD><D4AA>Ӧ<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD>ϱ<EFBFBD><CFB1><EFBFBD>
|
|
|
for (it = cPart_schemes.begin(); it != cPart_schemes.end(); it++) {
|
|
|
tag_t s = it->first;
|
|
|
vector<tag_t> vectorRev = cPart_schemes[s];
|
|
|
log("vectorRev size <20><><EFBFBD><EFBFBD>BOM %zd\n", vectorRev.size());
|
|
|
readSchemesYH(vectorRev, s, scheme_boms, bomISExist, rev_meops, groupName, now, errMess,
|
|
|
material_revs, gy_meops, needTCM_meops, process_boms, transfer, inCcpMap, urls[1]);
|
|
|
log("scheme_boms %zd\n", scheme_boms.size());
|
|
|
}
|
|
|
if (errMess.length() > 0) {
|
|
|
errMsgBuf.append("BOM<EFBFBD>쳣:\\n").append(errMess);
|
|
|
//
|
|
|
string updateSum = "update CHINT_BOM_TO_SAP_SUM set \"DATASTATUS\" = '<27><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' ,SAPRESULT = 'PLM<4C><4D><EFBFBD><EFBFBD>δͨ<CEB4><CDA8>',PLMRESULT = '<27>ѷ<EFBFBD><D1B7>ͷ<EFBFBD><CDB7><EFBFBD>֪ͨ' where code = '%s' ";
|
|
|
char selectRxfs[800];
|
|
|
string timel;
|
|
|
sprintf(selectRxfs, updateSum.c_str(), code);
|
|
|
log("selectRecord2 ===> %s\n", selectRxfs);
|
|
|
ExecuteSQLNoInputParam(selectRxfs);
|
|
|
ExecuteSQLNoInputParam((char*)"commit");
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѷ<EFBFBD><D1B7>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
sendNotice(code, errMsgBuf, wbs, groupName, userName, projectName);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST> proclist;
|
|
|
//vector< vector<_ns1__DT_USCOREBOM_USCOREPLM_USCOREREQ_LIST>> lists;
|
|
|
//vector< vector<_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST>> proclists;
|
|
|
vector<tag_t> isSends;
|
|
|
//vector<tag_t> errorParts;
|
|
|
//vector<tag_t> successParts;
|
|
|
map<tag_t, char*> isExistBom; //<2F>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ݹ<EFBFBD><DDB9>ĵ<EFBFBD>Ԫ<EFBFBD><D4AA><EFBFBD>ٴ<EFBFBD><D9B4><EFBFBD>
|
|
|
map<string, char*> flmMap;
|
|
|
string sendErrMsg;
|
|
|
map<tag_t, vector<_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST>> mapList;
|
|
|
for (int i = 0; i < ccpVector.size(); i++) {
|
|
|
//list.clear();
|
|
|
proclist.clear();
|
|
|
vector<_ns1__DT_USCOREBOM_USCORES4_USCOREREQ_LIST> list; //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BOM<4F><4D>Ϣ
|
|
|
tag_t ccp = ccpVector[i];
|
|
|
if (cPart_schemes.count(ccp) > 0) {
|
|
|
vector<tag_t> schemes = cPart_schemes[ccp];
|
|
|
string sendMsg;
|
|
|
log("schemes size %d \n", schemes.size());
|
|
|
//<2F><><EFBFBD><EFBFBD>Ʒû<C6B7>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
if (schemes.size() == 0) {
|
|
|
continue;
|
|
|
}
|
|
|
readBomInfoYH(ccp, schemes, list, proclist, isSends, "", material_revs,
|
|
|
groupName, now, scheme_boms, gy_meops, needTCM_meops, flmMap, isExistBom, isDY);
|
|
|
if (list.size() > 0) {
|
|
|
//logBomMsg(list);
|
|
|
mapList[ccp] = list;
|
|
|
}
|
|
|
if (proclist.size() > 0) {
|
|
|
logProcessMsg(proclist);// vector <_ns1__DT_USCOREPROCESSROUTE_USCORES4_USCOREREQ_LIST> proclist;
|
|
|
sendProcess(proclist, sendMsg, urls[1]);//proclists.push_back(proclist);//sendProcess(proclist);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
/*if (errorParts.size() > 0) {
|
|
|
errMsgBuf.append("BOM<4F><4D><EFBFBD>ݷ<EFBFBD><DDB7><EFBFBD><EFBFBD>쳣:\n").append(sendErrMsg);
|
|
|
}
|
|
|
else {
|
|
|
string endBuff;
|
|
|
for (int j = 0; j < successParts.size(); j++) {
|
|
|
char* object_string;
|
|
|
AOM_ask_value_string(successParts[j], "object_string", &object_string);
|
|
|
endBuff.append(object_string).append("\n");
|
|
|
}
|
|
|
errMsgBuf.append("<22><><EFBFBD>ݳɹ<DDB3>:\n").append(endBuff);
|
|
|
}*/
|
|
|
if (mapList.size() > 0) {
|
|
|
//<2F><><EFBFBD><EFBFBD>BOM
|
|
|
//logBomMsg(list);
|
|
|
//sendBom(list, sendMsg);
|
|
|
startSplitSend(groupName, mapList, code, wbs, inCcpMap, urls[2]);
|
|
|
//sendBom(list);
|
|
|
}
|
|
|
else {
|
|
|
string time1 = getPlmTime(code);
|
|
|
string updateSum = "update CHINT_BOM_TO_SAP_SUM set datastatus = 'û<>кϷ<D0BA>BOM',organizationaltime = '%s',taskstauts = '<27><>֯<EFBFBD><D6AF><EFBFBD><EFBFBD>',PLMFINISHTIME = SYSDATE where code = '%s' ";
|
|
|
char selectRxfs[800];
|
|
|
string timel;
|
|
|
sprintf(selectRxfs, updateSum.c_str(), time1.c_str(), code);
|
|
|
log("selectRecord2 ===> %s\n", selectRxfs);
|
|
|
ExecuteSQLNoInputParam(selectRxfs);
|
|
|
ExecuteSQLNoInputParam((char*)"commit");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//void startLog() {
|
|
|
// tag_t current_member = NULLTAG, current_user = NULLTAG;
|
|
|
// char* user_id = "";
|
|
|
//
|
|
|
// SA_ask_current_groupmember(¤t_member);
|
|
|
// SA_ask_groupmember_user(current_member, ¤t_user);
|
|
|
// SA_ask_user_identifier2(current_user, &user_id);
|
|
|
//
|
|
|
// string userId = user_id;
|
|
|
// //<2F><>ȡ<EFBFBD><C8A1>ǰʱ<C7B0><CAB1>
|
|
|
// time_t now = time(0);
|
|
|
// tm* p = localtime(&now);
|
|
|
// char dateNow[128] = "";
|
|
|
// sprintf_s(dateNow, "%04d%02d%02d%02d%02d%02d", 1900 + p->tm_year, p->tm_mon + 1, p->tm_mday, p->tm_hour, p->tm_min, p->tm_sec);
|
|
|
// string dateString = dateNow;
|
|
|
// auto file_logger = basic_logger_mt("import_logger", "C:/logs/" + userId + "_" + dateString + ".log");
|
|
|
// set_default_logger(file_logger);
|
|
|
// log("begin connor_import_object");
|
|
|
//}
|