first commit

main
熊朝柱 2 weeks ago
commit cb29b9fd42

8
.idea/.gitignore vendored

@ -0,0 +1,8 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectInspectionProfilesVisibleTreeState">
<entry key="Project Default">
<profile-state>
<expanded-state>
<State>
<id>JUnit</id>
</State>
<State>
<id>JVM 语言</id>
</State>
<State>
<id>Java</id>
</State>
<State>
<id>Java 5Java 语言级别迁移帮助Java</id>
</State>
<State>
<id>Java 8Java 语言级别迁移帮助Java</id>
</State>
<State>
<id>Java 语言级别迁移帮助Java</id>
</State>
<State>
<id>JavadocJava</id>
</State>
<State>
<id>Spring</id>
</State>
<State>
<id>Spring AOPSpring</id>
</State>
<State>
<id>TestNGJava</id>
</State>
<State>
<id>代码成熟度Java</id>
</State>
<State>
<id>性能Java</id>
</State>
<State>
<id>数值问题Java</id>
</State>
<State>
<id>类结构Java</id>
</State>
<State>
<id>线程问题Java</id>
</State>
<State>
<id>编译器问题Java</id>
</State>
</expanded-state>
<selected-state>
<State>
<id>用户定义</id>
</State>
</selected-state>
</profile-state>
</entry>
</component>
</project>

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.33723.286
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zf_itk_c", "zf_itk_c\zf_itk_c.vcxproj", "{68DDF508-8D60-4777-994C-369E7A4B18C1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{68DDF508-8D60-4777-994C-369E7A4B18C1}.Debug|x64.ActiveCfg = Release|x64
{68DDF508-8D60-4777-994C-369E7A4B18C1}.Debug|x64.Build.0 = Release|x64
{68DDF508-8D60-4777-994C-369E7A4B18C1}.Debug|x86.ActiveCfg = Debug|Win32
{68DDF508-8D60-4777-994C-369E7A4B18C1}.Debug|x86.Build.0 = Debug|Win32
{68DDF508-8D60-4777-994C-369E7A4B18C1}.Release|x64.ActiveCfg = Release|x64
{68DDF508-8D60-4777-994C-369E7A4B18C1}.Release|x64.Build.0 = Release|x64
{68DDF508-8D60-4777-994C-369E7A4B18C1}.Release|x86.ActiveCfg = Release|Win32
{68DDF508-8D60-4777-994C-369E7A4B18C1}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7C7AB596-AE43-42DF-B813-ECE2B7B321BD}
EndGlobalSection
EndGlobal

Binary file not shown.

File diff suppressed because it is too large Load Diff

@ -0,0 +1,740 @@
#include "ZF_SendPart.h"
namespace SendGYLX {
struct Host {
std::string prod;
std::string ip;
std::string lang;
std::string acct;
std::string timestamp;
};
struct Service {
std::string prod;
std::string name;
std::string ip;
std::string id;
};
struct DataKey {
std::string EntId;
std::string CompanyId;
};
struct ProcessItem {
std::string ecbb003; // 工序编号
std::string ecbb004; // 设备编号
std::string ecbb005; // 工序顺序
std::string ecbb025; // 标准工时
std::string ecbb013; // 质检标记
std::string ecbb012; // 生产批次
std::string ecbb017; // 返工标记
std::string ecbastus; // 状态标记
};
struct ProductionParameter {
std::string ecba001; // 生产订单号
std::string ecba002; // 计划数量
std::string ecba003; // 物料名称
std::vector<ProcessItem> data; // 工序数据
};
struct StdData {
ProductionParameter parameter;
};
struct Payload {
StdData std_data;
};
struct Root {
std::string key; // 交易密钥
std::string type; // 同步类型
Host host; // 来源系统
Service service; // 目标服务
DataKey datakey; // 数据主键
Payload payload; // 业务负载
};
// 序列化/反序列化适配
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Host, prod, ip, lang, acct, timestamp)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Service, prod, name, ip, id)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(DataKey, EntId, CompanyId)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(ProcessItem, ecbb003, ecbb004, ecbb005, ecbb025, ecbb013, ecbb012, ecbb017, ecbastus)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(ProductionParameter, ecba001, ecba002, ecba003, data)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(StdData, parameter)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Payload, std_data)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Root, key, type, host, service, datakey, payload)
// 文件读取与解析函数
Root parseJson(const std::string& file_path) {
try {
// 创建文件流对象
std::ifstream file_stream(file_path);
if (!file_stream.is_open()) {
throw std::runtime_error("文件打开失败: " + file_path);
}
// 读取文件内容
std::string file_content(
(std::istreambuf_iterator<char>(file_stream)),
std::istreambuf_iterator<char>());
// JSON解析
json j = json::parse(file_content);
return j.get<Root>();
}
catch (const json::exception& e) {
std::cerr << "JSON解析错误[" << e.id << "]: " << e.what() << std::endl;
throw;
}
catch (const std::exception& e) {
std::cerr << "系统异常: " << e.what() << std::endl;
throw;
}
}
// 写入日志信息到文件 writeLog("当前工时: "+ std::to_string(totalGs));
void writeLog(const std::string& message) {
std::ofstream logFile(logFilePath, std::ios_base::app); // 以追加模式打开文件
if (logFile.is_open()) {
std::string logEntry = "[" + getCurrentTime() + "] " + message + "\n";
logFile << logEntry;
logFile.close();
}
else {
std::cerr << "无法打开日志文件" << std::endl;
}
}
std::map<std::string, std::string> parseConfigString(const std::string& configString, tag_t top_line) {
int ifail = ITK_ok;
std::map<std::string, std::string> configMap;
std::stringstream ss(configString);
std::string keyValuePair;
tag_t attachmentTag = NULLTAG;
tag_t attachTagRev = NULLTAG;
ITKCALL(ifail = AOM_ask_value_tag(top_line, bomAttr_lineItemTag, &attachmentTag));
ITKCALL(ifail = AOM_ask_value_tag(top_line, bomAttr_lineItemRevTag, &attachTagRev));
int count = 0;
// relationValues ==> 对象对应关系下的子对象数组
tag_t* relationValues = NULLTAG;
tag_t form = NULLTAG;
// attachmentTag ==> 当前流程下的对象
ITKCALL(ifail = AOM_ask_value_tags(attachTagRev, "IMAN_master_form_rev", &count, &relationValues));
if (count != 0) {
form = relationValues[0];
}
int innerCount = 0;
tag_t* children_line;
ITKCALL(ifail = BOM_line_ask_all_child_lines(top_line, &innerCount, &children_line));
char* propValue = NULL;
date_t dateValue;
// 使用分号分隔键值对
while (std::getline(ss, keyValuePair, ';')) {
try {
std::stringstream pairStream(keyValuePair);
std::string key, value;
// 使用等号分隔键和值
if (std::getline(pairStream, key, '=') && std::getline(pairStream, value)) {
writeLog("当前key ==> " + key);
std::string obj, prop, lastProp;
// 使用 stringstream 和 getline 进行分割
std::stringstream ss(value);
if (std::getline(ss, obj, '.') && std::getline(ss, prop, '.')) {
writeLog("obj: " + obj);
writeLog("prop: " + prop);
if (obj == "Item") {
if (!isPropertyExist(attachmentTag, prop.c_str())) {
printf("prop %s 不存在\n", prop.c_str());
configMap[key] = "";
continue;
}
if (strcmp(prop.c_str(), "uom_tag") == 0) {
ITKCALL(ifail = AOM_UIF_ask_value(attachmentTag, prop.c_str(), &propValue));
writeLog("当前propValue ==> " + std::string(propValue));
configMap[key] = propValue;
}
else {
ITKCALL(ifail = AOM_ask_value_string(attachmentTag, prop.c_str(), &propValue));
writeLog("当前propValue ==> " + std::string(propValue));
configMap[key] = propValue;
}
}
else if (obj == "Rev") {
if (!isPropertyExist(attachTagRev, prop.c_str())) {
printf("prop %s 不存在\n", prop.c_str());
configMap[key] = "";
continue;
}
if (strcmp(prop.c_str(), "creation_date") == 0) {
writeLog("进入date测试");
ITKCALL(ifail = AOM_ask_value_date(attachTagRev, prop.c_str(), &dateValue));
char createDate[128] = "";
sprintf_s(createDate, "%04d-%02d-%02d %02d:%02d:%02d", dateValue.year, dateValue.month + 1, dateValue.day, dateValue.hour, dateValue.minute, dateValue.second);
propValue = createDate;
}
else if ((strcmp(prop.c_str(), "zf6_cpxsyb") == 0)) {
writeLog("进入cpxsyb测试");
/*int cpxsybNum = 0;
char** propValues = NULL;
AOM_ask_value_strings(attachTagRev, prop.c_str(), &cpxsybNum, &propValues);*/
int tempNum = 0;
char** tempValues = NULL;
std::string tempValue = "";
ITKCALL(ifail = AOM_UIF_ask_values(attachTagRev, prop.c_str(), &tempNum, &tempValues));
for (int i = 0; i < tempNum; i++) {
tempValue += tempValues[i];
tempValue += ";";
}
writeLog("当前propValue ==> " + tempValue);
configMap[key] = tempValue;
DOFREE(tempValues);
}
else {
ITKCALL(ifail = AOM_ask_value_string(attachTagRev, prop.c_str(), &propValue));
writeLog("当前propValue ==> " + std::string(propValue));
configMap[key] = propValue;
}
}
else if (count != 0 && obj == "Form") {
if (!isPropertyExist(form, prop.c_str())) {
printf("prop %s 不存在\n", prop.c_str());
configMap[key] = "";
continue;
}
if (!isPropertyExist(form, prop.c_str())) {
printf("prop %s 不存在\n", prop.c_str());
configMap[key] = "";
continue;
}
ITKCALL(ifail = AOM_ask_value_string(form, prop.c_str(), &propValue));
writeLog("当前propValue ==> " + std::string(propValue));
configMap[key] = propValue;
}
else if (obj == "BomLine") {
ITKCALL(ifail = AOM_ask_value_string(top_line, prop.c_str(), &propValue));
writeLog("当前propValue ==> " + std::string(propValue));
configMap[key] = propValue;
}
else if (obj == "Part") {
// 特殊处理ecba001=Part.Item.item_id
tag_t relation_type = NULLTAG;
GRM_find_relation_type("ZF6_R_GYLX", &relation_type);
int gx_num = 0;
tag_t* gx_tags = NULL;
ITKCALL(ifail = GRM_list_primary_objects_only(attachTagRev, relation_type, &gx_num, &gx_tags));
if (gx_num != 0) {
tag_t partItem = NULLTAG;
ITKCALL(ifail = ITEM_ask_item_of_rev(gx_tags[0], &partItem));
AOM_ask_value_string(partItem, "item_id", &propValue);
writeLog("当前propValue ==> " + std::string(propValue));
configMap[key] = propValue;
}
else {
writeLog("[ warning : ]当前特殊处理父层级没有关系对象");
}
DOFREE(gx_tags);
}
else if (obj == "GYLX") {
if (std::getline(ss, lastProp, '.')) {
writeLog("lastProp: " + lastProp);
if (prop == "Item") {
if (key == "ecba002") {
AOM_ask_value_string(attachmentTag, "item_id", &propValue);
writeLog("当前propValue ==> " + std::string(propValue));
configMap[key] = propValue;
}
else if (key == "ecba003") {
std::string finalValue;
AOM_ask_value_string(attachTagRev, "object_name", &propValue);
finalValue = propValue;
ITKCALL(ifail = AOM_UIF_ask_value(attachTagRev, "zf6_zfsyb", &propValue));
finalValue += propValue;
writeLog("当前propValue ==> " + finalValue);
configMap[key] = finalValue;
}
else {
configMap[key] = "GYLX";
writeLog("当前propValue使用默认值GYLX");
}
}
else if (prop == "BomLine") {
ITKCALL(ifail = AOM_ask_value_string(top_line, lastProp.c_str(), &propValue));
writeLog("当前propValue ==> " + std::string(propValue));
configMap[key] = propValue;
}
else {
configMap[key] = "GYLX";
writeLog("当前propValue使用默认值GYLX");
}
}
}
else if (obj == "SCX") {
if (std::getline(ss, lastProp, '.')) {
writeLog("lastProp: " + lastProp);
if (prop == "Rev") {
tag_t childRev = NULLTAG;
if (innerCount != 0) {
ITKCALL(ifail = AOM_ask_value_tag(children_line[0], bomAttr_lineItemRevTag, &childRev));
if (!isPropertyExist(childRev, lastProp.c_str())) {
printf("prop %s 不存在\n", lastProp.c_str());
configMap[key] = "";
continue;
}
ITKCALL(ifail = AOM_ask_value_string(childRev, lastProp.c_str(), &propValue));
writeLog("当前propValue ==> " + std::string(propValue));
configMap[key] = propValue;
}
else {
writeLog("当前版本对象下不存在Bom结构");
}
}
else {
configMap[key] = "SCX";
writeLog("当前propValue使用默认值SCX1");
}
}
else {
configMap[key] = "SCX";
writeLog("当前propValue使用默认值SCX2");
}
}
else {
configMap[key] = value;
writeLog("当前propValue使用默认值1: " + value);
}
}
else {
writeLog("特殊Value处理 ==> " + std::string(value));
// 如果没有正确分割,可以选择存储原始值或处理错误
if (value == "TimeStamp") {
std::string time = getCurrentTimestamp17();
configMap[key] = time;
writeLog("当前propValue ==> " + time);
}
else if (value == "BZGXNo") {
ITKCALL(ifail = AOM_ask_value_string(attachTagRev, "object_name", &propValue));
//执行查询
tag_t query;
int n_found = 0;
ITKCALL(ifail = QRY_find2("零组件...", &query));
tag_t* tags;
char* qry_entries[2] = { "名称" ,"类型" },
* qry_values[2] = { propValue ,"ZF6_BZGX" };
ITKCALL(ifail = QRY_execute(query, 2, qry_entries, qry_values, &n_found, &tags));
if (n_found != 0) {
ITKCALL(ifail = AOM_ask_value_string(tags[0], "item_id", &propValue));
writeLog("当前propValue ==> " + std::string(propValue));
configMap[key] = propValue;
}
else {
writeLog("通过名称并未查询到该对象 ==> " + std::string(propValue));
configMap[key] = "";
}
DOFREE(tags);
}
else if (value == "MaterialClass") {
if (innerCount != 0) {
writeLog("当前propValue ==> A");
configMap[key] = "A";
}
else {
writeLog("当前propValue ==> M");
configMap[key] = "M";
}
DOFREE(children_line);
}
else {
configMap[key] = value;
writeLog("当前propValue使用默认值2: " + value);
}
}
}
}
catch (const std::exception& e) {
writeLog("Error: " + std::string(e.what()));
}
}
DOFREE(relationValues);
DOFREE(propValue);
DOFREE(children_line);
return configMap;
}
Root exportHeadItem(Root data, std::map<std::string, std::string> outerConfigMap) {
for (const auto& pair : outerConfigMap) {
const std::string& key = pair.first;
const std::string& value = pair.second;
if (key == "key") {
data.key = value;
}
else if (key == "type") {
data.type = value;
}
else if (key == "prod") {
data.host.prod = value;
}
else if (key == "lang") {
data.host.lang = value;
}
else if (key == "acct") {
data.host.acct = value;
}
else if (key == "timestamp") {
data.host.timestamp = value;
}
else if (key == "prod") {
data.service.prod = value;
}
else if (key == "name") {
data.service.name = value;
}
else if (key == "id") {
data.service.id = value;
}
else if (key == "EntId") {
data.datakey.EntId = value;
}
else if (key == "CompanyId") {
data.datakey.CompanyId = value;
}
else if (key == "ecba001") {
data.payload.std_data.parameter.ecba001 = value;
}
else if (key == "ecba002") {
data.payload.std_data.parameter.ecba002 = value;
}
else if (key == "ecba003") {
data.payload.std_data.parameter.ecba003 = value;
}
}
return data;
}
std::string writeJsonToString(Root data) {
std::ostringstream oss;
// 打印 Root 属性
oss << "{\n";
oss << " \"key\": \"" << data.key << "\",\n";
oss << " \"type\": \"" << data.type << "\",\n";
// 打印 Host 属性
oss << " \"host\": {\n";
oss << " \"prod\": \"" << data.host.prod << "\",\n";
oss << " \"ip\": \"" << data.host.ip << "\",\n";
oss << " \"lang\": \"" << data.host.lang << "\",\n";
oss << " \"acct\": \"" << data.host.acct << "\",\n";
oss << " \"timestamp\": \"" << data.host.timestamp << "\"\n";
oss << " },\n";
// 打印 Service 属性
oss << " \"service\": {\n";
oss << " \"prod\": \"" << data.service.prod << "\",\n";
oss << " \"name\": \"" << data.service.name << "\",\n";
oss << " \"ip\": \"" << data.service.ip << "\",\n";
oss << " \"id\": \"" << data.service.id << "\"\n";
oss << " },\n";
// 打印 DataKey 属性
oss << " \"datakey\": {\n";
oss << " \"EntId\": \"" << data.datakey.EntId << "\",\n";
oss << " \"CompanyId\": \"" << data.datakey.CompanyId << "\"\n";
oss << " },\n";
// 打印 Payload 和 StdData 属性
oss << " \"payload\": {\n";
oss << " \"std_data\": {\n";
oss << " \"parameter\": {\n";
oss << " \"ecba001\": \"" << data.payload.std_data.parameter.ecba001 << "\",\n";
oss << " \"ecba002\": \"" << data.payload.std_data.parameter.ecba002 << "\",\n";
oss << " \"ecba003\": \"" << data.payload.std_data.parameter.ecba003 << "\",\n";
oss << " \"data\": [\n";
// 打印每个 ProcessItem 的属性
for (size_t i = 0; i < data.payload.std_data.parameter.data.size(); ++i) {
const ProcessItem& di = data.payload.std_data.parameter.data[i];
oss << " {\n";
oss << " \"ecbb003\": \"" << di.ecbb003 << "\",\n";
oss << " \"ecbb004\": \"" << di.ecbb004 << "\",\n";
oss << " \"ecbb005\": \"" << di.ecbb005 << "\",\n";
oss << " \"ecbb025\": \"" << di.ecbb025 << "\",\n";
oss << " \"ecbb013\": \"" << di.ecbb013 << "\",\n";
oss << " \"ecbb012\": \"" << di.ecbb012 << "\",\n";
oss << " \"ecbb017\": \"" << di.ecbb017 << "\",\n";
oss << " \"ecbastus\": \"" << di.ecbastus << "\"";
if (i != data.payload.std_data.parameter.data.size() - 1) {
oss << "\n },\n";
}
else {
oss << "\n }\n";
}
}
oss << " ]\n";
oss << " }\n";
oss << " }\n";
oss << " }\n";
oss << "}\n";
return oss.str();
}
ProcessItem exportDateItem(std::map<std::string, std::string> innerConfigMap) {
ProcessItem& dataItem = ProcessItem();
for (const auto& pair : innerConfigMap) {
const std::string& key = pair.first;
const std::string& value = pair.second;
if (key == "ecbb003") {
dataItem.ecbb003 = value;
}
else if (key == "ecbb004") {
dataItem.ecbb004 = value;
}
else if (key == "ecbb005") {
dataItem.ecbb005 = value;
}
else if (key == "ecbb025") {
dataItem.ecbb025 = value;
}
else if (key == "ecbb013") {
dataItem.ecbb013 = value;
}
else if (key == "ecbb012") {
dataItem.ecbb012 = value;
}
else if (key == "ecbb017") {
dataItem.ecbb017 = value;
}
else if (key == "ecbastus") {
dataItem.ecbastus = value;
}
}
return dataItem;
}
}
using namespace SendGYLX;
int ZF_SendGYLXToERP(EPM_action_message_t msg) {
// 获取日志文件目录路径
// 获取日志文件目录路径
logFilePath = getLogFilePath("ZF_SendGYLXToERP_");
writeLog("=========================工序路线同步 Start===================");
int ifail = ITK_ok;
char* url = NULL, * templateUid = NULL;
ITKCALL(PREF_ask_char_value("ZF_SendGYLXToERP_URL", 0, &url));
writeLog("url : " + std::string(url));
ITKCALL(PREF_ask_char_value("ZF_SendGYLXToERP_Template", 0, &templateUid));
char* argName = NULL, * argValue = NULL, * arg = NULL;
char objTypes[1024] = "";
bool isExistRev = false;
int arg_cnt = TC_number_of_arguments(msg.arguments);
writeLog("参数个数为:" + std::to_string(arg_cnt));
if (arg_cnt > 0)
{
for (int i = 0; i < arg_cnt; i++)
{
arg = TC_next_argument(msg.arguments);
ITKCALL(ifail = ITK_ask_argument_named_value((const char*)arg, &argName, &argValue));
if (strcmp(argName, "type") == 0)
{
if (argValue != NULL)
{
strcpy(objTypes, argValue);
}
}
}
}
MEM_free(argName);
MEM_free(argValue);
std::vector<std::string> typeVector;
getVector(objTypes, typeVector, ';');
tag_t attachmentTag = NULLTAG;
int attachmentCount = 0;
tag_t rootTask = NULLTAG, * attachmentTags = NULLTAG;
ITKCALL(ifail = EPM_ask_root_task(msg.task, &rootTask));
ITKCALL(ifail = EPM_ask_attachments(rootTask, EPM_target_attachment, &attachmentCount, &attachmentTags));
// 获取首选项
tag_t templateDataSet = NULLTAG;
char* fileName = NULL;
ITK__convert_uid_to_tag(templateUid, &templateDataSet);
ITKCALL(ifail = AOM_ask_value_string(templateDataSet, "object_name", &fileName));
int n_found = 0;
tag_t* ref_object = NULLTAG;
const char* ref_name = "Text";
//AE_reference_type_t reference_type;
ITKCALL(AE_ask_dataset_named_refs(templateDataSet, &n_found, &ref_object));
//ITKCALL(ifail = AE_ask_dataset_named_ref2(templateDataSet, ref_name, &reference_type, &ref_object));
// 使用 std::string 进行字符串拼接
std::string tempPath = getenv("TEMP");
std::string fullPath = tempPath + "\\" + fileName;
removeFile(fullPath);
// 导出文件到完整路径
if (IMF_export_file(ref_object[0], fullPath.c_str()) != 0) {
writeLog("导出文件失败,路径: " + fullPath);
EMH_store_error_s1(EMH_severity_error, ITK_err, "文件导出失败");
return 1;
}
else {
writeLog("文件已成功导出到: " + fullPath);
}
char** erpConfig;
int configNum;
ITKCALL(ifail = PREF_ask_char_values("ZF_SendGYLXToERP_Config", &configNum, &erpConfig));
writeLog("开始解析json");
Root data = parseJson(fullPath);
std::vector<ProcessItem> dataItems;
// 解析 erpConfig 字符串
std::map<std::string, std::string> outerConfigMap;
std::map<std::string, std::string> innerConfigMap;
tag_t processUser = NULLTAG;
char* processUserName = NULL;
ITKCALL(AOM_ask_value_tag(rootTask, "owning_user", &processUser));
ITKCALL(AOM_ask_value_string(processUser, "user_id", &processUserName));
//遍历所有的流程目标下的对象
char* itemType = NULL;
tag_t* children_line;
writeLog(std::to_string(attachmentCount));
for (int i = 0; i < attachmentCount; i++) {
attachmentTag = attachmentTags[i];
if (!isTypeOf(attachmentTag, "ItemRevision")) {
continue;
}
ITKCALL(ifail = AOM_ask_value_string(attachmentTag, "object_type", &itemType));
if (inArrays(typeVector, itemType)) {
tag_t windowTag = NULLTAG,
topLineTag = NULLTAG;
tag_t itemTag = NULLTAG;
ITKCALL(ifail = ITEM_ask_item_of_rev(attachmentTag, &itemTag););
//创建Window
ITKCALL(ifail = BOM_create_window(&windowTag));
//设置顶层BOMline
// itemTag==>对象 revisionTag==>对象版本 topLineTog==>顶层BOM
ITKCALL(ifail = BOM_set_window_top_line(windowTag, itemTag, attachmentTag, NULLTAG, &topLineTag));
int innerCount = 0;
//tag_t childRev = NULLTAG;
ITKCALL(ifail = BOM_line_ask_all_child_lines(topLineTag, &innerCount, &children_line));
writeLog("当前数量:" + innerCount);
if (innerCount == 0) {
writeLog("当前工艺路线没有子项");
EMH_store_error_s1(EMH_severity_error, ITK_err, "工艺路线下没有工序,不允许传递");
return -1;
}
writeLog("ErpConfig[0]: " + string(erpConfig[0]));
outerConfigMap = parseConfigString(erpConfig[0], topLineTag);
for (i = 0; i < innerCount; i++) {
//ITKCALL(AOM_ask_value_tag(children_line[i], bomAttr_lineItemRevTag, &childRev));
writeLog("ErpConfig[1]: " + string(erpConfig[1]));
innerConfigMap = parseConfigString(erpConfig[1], children_line[i]);
ProcessItem item = exportDateItem(innerConfigMap);
dataItems.push_back(item);
}
}
else {
continue;
}
try {
if (string(erpConfig[0]).find("OwningUser") != std::string::npos) {
data.host.acct = processUserName;
}
data.payload.std_data.parameter.data = dataItems;
// 遍历 innerConfigMap 并设置 ProcessItem 属性
data = exportHeadItem(data, outerConfigMap);
writeLog("开始拼接json ==>");
std::string jsonStr = writeJsonToString(data);
writeLog(jsonStr);
writeLog("json拼接成功 <==");
writeLog("开始读取json文件");
// 发送 POST 请求
writeLog("开始发送Post请求");
string jsonFileName = generate_uuid_v4();
std::string jsonFilePath = tempPath + "\\" + jsonFileName + ".txt";
writeJsonToFile(jsonFilePath, jsonStr);
writeLog("json文件已保存到: " + jsonFilePath);
string cmd = "java -jar %ZF_ROOT%\\bin\\SendERP.jar " + std::string(url) + " " + jsonFilePath;
string result;
char buf[8000] = { 0 };
//logf("popen");
FILE* pf = _popen(cmd.c_str(), "r");
while (fgets(buf, sizeof buf, pf)) {
result.append(buf);
}
_pclose(pf);
writeLog("result:" + result);
if (result.length() > 1) {
EMH_store_error_s1(EMH_severity_error, ITK_err, result.c_str());
return -1;
}
else {
writeLog("发送成功");
}
}
catch (const json::exception& e) {
writeLog("JSON序列化错误: " + std::string(e.what()));
return -1;
}
catch (const std::exception& e) {
writeLog("标准异常: " + std::string(e.what()));
return -1;
}
}
DOFREE(attachmentTags);
DOFREE(url);
DOFREE(templateUid);
DOFREE(fileName);
DOFREE(ref_object);
DOFREE(itemType);
return ifail;
}

@ -0,0 +1,181 @@
#include "ZF_SendPart.h"
// 回调函数:处理服务器响应
size_t write_callback(char* ptr, size_t size, size_t nmemb, std::string* data) {
data->append(ptr, size * nmemb);
return size * nmemb;
}
// 发送 POST 请求
bool send_post_request(const std::string& url, const std::string& json_data, std::string& response) {
CURL* curl = curl_easy_init();
if (!curl) return false;
// 设置请求选项
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_POST, 1L);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json_data.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
// 设置 HTTP 头部
struct curl_slist* headers = nullptr;
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
// 执行请求
CURLcode res = curl_easy_perform(curl);
// 清理资源
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return (res == CURLE_OK);
}
bool inArrays(const std::vector<std::string>& vec, const std::string& value) {
for (const auto& item : vec) {
if (item == value) {
return true;
}
}
return false;
}
void getVector(const char* value, std::vector<std::string>& targetVector, char delimiter) {
std::string strValue(value);
std::stringstream ss(strValue);
std::string item;
// 尝试用指定的分隔符分割字符串
if (std::getline(ss, item, delimiter)) {
// 如果能成功分割,则继续分割剩余部分
targetVector.push_back(item);
while (std::getline(ss, item, delimiter)) {
targetVector.push_back(item);
}
}
else {
// 如果不能分割则将整个字符串添加到vector中
targetVector.push_back(strValue);
}
}
// 获取当前时间的字符串表示
std::string getCurrentTime() {
std::time_t now = std::time(nullptr);
std::tm* now_tm = std::localtime(&now);
char buffer[20];
std::strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", now_tm);
return std::string(buffer);
}
std::string getCurrentTimestamp17() {
// 获取当前时间的时间点
auto now = std::chrono::system_clock::now();
// 将时间点转换为时间间隔(秒级)
auto seconds = std::chrono::duration_cast<std::chrono::seconds>(now.time_since_epoch()).count();
// 获取毫秒级部分
auto milliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count() % 1000;
// 将时间间隔转换为 std::time_t
std::time_t now_time_t = std::chrono::system_clock::to_time_t(now);
// 将 std::time_t 转换为 std::tm 结构
std::tm now_tm = *std::localtime(&now_time_t);
// 创建一个字符串流来格式化时间戳
std::ostringstream oss;
// 格式化年月日时分秒
oss << std::put_time(&now_tm, "%Y%m%d%H%M%S")
// 添加毫秒部分
<< std::setw(3) << std::setfill('0') << milliseconds;
return oss.str();
}
void removeFile(string path) {
fs::path filePath(path);
if (fs::exists(filePath)) {
fs::remove(filePath);
std::cout << "文件已删除: " << filePath << std::endl;
}
else {
std::cout << "文件不存在: " << filePath << std::endl;
}
}
// 获取日志文件路径
std::string getLogFilePath(const std::string& name) {
std::string tempPath = getenv("TEMP");
std::string logFolder = tempPath + "\\ERPLog";
std::string timestamp = getCurrentTimestamp17();
std::string logFileName = name + timestamp + ".txt";
std::string logFilePath = logFolder + "\\" + logFileName;
// 确保文件夹存在,如果不存在则创建
if (!fs::exists(logFolder)) {
fs::create_directories(logFolder);
}
return logFilePath;
}
std::string generate_uuid_v4() {
static std::random_device rd;
static std::mt19937 gen(rd());
static std::uniform_int_distribution<> dis(0, 15);
static std::uniform_int_distribution<> dis2(8, 11);
std::stringstream ss;
int i;
ss << std::hex;
for (i = 0; i < 10; i++) {
ss << dis(gen);
}
return ss.str();
}
// 方法实现
void writeJsonToFile(const std::string& jsonFilePath, const std::string& jsonStr) {
std::ofstream outFile(jsonFilePath, std::ios::out | std::ios::trunc); // 使用 ios::trunc 覆盖文件内容
if (outFile.is_open()) {
outFile << jsonStr;
outFile.close();
std::cout << "文件写入成功: " << jsonFilePath << std::endl;
}
else {
std::cerr << "无法打开文件: " << jsonFilePath << std::endl;
}
}
int isPropertyExist(tag_t object_tag, const char* target_prop_name) {
int ifail = ITK_ok;
int prop_count = 0;
char** prop_names = NULL;
// 获取对象的所有属性名称
ifail = AOM_ask_prop_names(object_tag, &prop_count, &prop_names);
if (ifail != ITK_ok || prop_count == 0) {
return 0; // 属性不存在或获取失败
}
// 遍历属性列表查找目标属性
int exists = 0;
for (int i = 0; i < prop_count; i++) {
if (strcmp(prop_names[i], target_prop_name) == 0) {
exists = 1;
break;
}
}
// 释放内存
MEM_free(prop_names);
return exists;
}

@ -0,0 +1,94 @@
#pragma once
#include "kutil.h"
#define debug true
#define ITK_err 919012
#define TC_SEND_ERP_URL "TC_SEND_ERP_URL"
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <cstring>
#include <iostream>
#define debug true
#define ITK_err 919012
#include <curl/curl.h>
#include <string>
#include <ctime>
#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#include <windows.h>
#include <iostream>
#include <fstream>
#include <string>
#include <nlohmann/json.hpp>
#include <map>
#include <random>
using json = nlohmann::json;
static string logFilePath;
struct ResponseData {
std::string imaa001;
std::string fields;
std::string notes;
};
struct Execution {
std::string code;
std::string sql_code;
std::string description;
};
// 标准化数据结构体
struct ResponseStdData {
Execution execution;
std::vector<ResponseData> data; // 物料数据集合
};
// 数据载体结构体
struct ResponsePayload {
ResponseStdData std_data;
};
// 完整响应体
struct ResponseResult {
std::string srvver;
std::string srvcode;
json datakey; // 灵活处理可空字段
ResponsePayload payload;
};
// 序列化/反序列化适配
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(ResponseData, imaa001, fields, notes)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Execution, code, sql_code, description)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(ResponseStdData, execution, data)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(ResponsePayload, std_data)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(ResponseResult, srvver, srvcode, datakey, payload)
#ifdef __cplusplus
extern "C" {
#endif
#define DOFREE(obj) \
{ \
if(obj) \
{ \
MEM_free(obj); \
obj = NULL; \
} \
}
size_t write_callback(char* ptr, size_t size, size_t nmemb, std::string* data);
bool send_post_request(const std::string& url, const std::string& json_data, std::string& response);
bool inArrays(const std::vector<std::string>& vec, const std::string& value);
void getVector(const char* value, std::vector<std::string>& targetVector, char delimiter);
std::string getCurrentTime();
std::string getCurrentTimestamp17();
void removeFile(string path);
std::string getLogFilePath(const std::string& name);
std::string generate_uuid_v4();
void writeJsonToFile(const std::string& jsonFilePath, const std::string& jsonStr);
int isPropertyExist(tag_t object_tag, const char* target_prop_name);
#ifdef __cplusplus
}
#endif

@ -0,0 +1,638 @@
#include "ZF_SendPart.h"
namespace sendBomPart {
std::string fullPath;
char** erpConfig;
char* processUserName;
char* url = NULL;
// 嵌套结构体定义
struct Host {
std::string prod;
std::string ip;
std::string lang;
std::string acct;
std::string timestamp;
};
struct Service {
std::string prod;
std::string name;
std::string ip;
std::string id;
};
struct DataKey {
std::string EntId;
std::string CompanyId;
};
struct DataItem {
std::string bmba003;
std::string bmba011;
std::string bmba012;
std::string bmba010;
std::string bmaacrtdt;
std::string acct;
std::string bmaastus;
};
struct Parameter {
std::string bmba001;
std::vector<DataItem> data;
};
struct StdData {
Parameter parameter;
};
struct Payload {
StdData std_data;
};
// 根结构体
struct Root {
std::string key;
std::string type;
Host host;
Service service;
DataKey datakey;
Payload payload;
};
// 序列化/反序列化适配
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Host, prod, ip, lang, acct, timestamp)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Service, prod, name, ip, id)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(DataKey, EntId, CompanyId)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(DataItem, bmba003, bmba011, bmba012, bmba010, bmaacrtdt, acct, bmaastus)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Parameter, bmba001, data)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(StdData, parameter)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Payload, std_data)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Root, key, type, host, service, datakey, payload)
std::string tempPath;
// 文件读取与解析函数
Root parseBomJson(const std::string& file_path) {
try {
// 创建文件流对象
std::ifstream file_stream(file_path);
if (!file_stream.is_open()) {
throw std::runtime_error("文件打开失败: " + file_path);
}
// 读取文件内容
std::string file_content(
(std::istreambuf_iterator<char>(file_stream)),
std::istreambuf_iterator<char>());
// JSON解析
json j = json::parse(file_content);
return j.get<Root>();
}
catch (const json::exception& e) {
std::cerr << "JSON解析错误[" << e.id << "]: " << e.what() << std::endl;
throw;
}
catch (const std::exception& e) {
std::cerr << "系统异常: " << e.what() << std::endl;
throw;
}
}
// 写入日志信息到文件 writeBomLog("当前工时: "+ std::to_string(totalGs));
void writeBomLog(const std::string& message) {
std::ofstream logFile(logFilePath, std::ios_base::app); // 以追加模式打开文件
if (logFile.is_open()) {
std::string logEntry = "[" + getCurrentTime() + "] " + message + "\n";
logFile << logEntry;
logFile.close();
}
else {
std::cerr << "无法打开日志文件" << std::endl;
}
}
std::map<std::string, std::string> parseBomConfigString(const std::string& configString, tag_t top_line) {
int ifail = ITK_ok;
std::map<std::string, std::string> configMap;
std::stringstream ss(configString);
std::string keyValuePair;
tag_t attachmentTag = NULLTAG;
tag_t attachTagRev = NULLTAG;
ITKCALL(ifail = AOM_ask_value_tag(top_line, bomAttr_lineItemTag, &attachmentTag));
ITKCALL(ifail = AOM_ask_value_tag(top_line, bomAttr_lineItemRevTag, &attachTagRev));
int count = 0;
// relationValues ==> 对象对应关系下的子对象数组
tag_t* relationValues = NULLTAG;
tag_t form = NULLTAG;
// attachmentTag ==> 当前流程下的对象
ITKCALL(ifail = AOM_ask_value_tags(attachTagRev, "IMAN_master_form_rev", &count, &relationValues));
if (count != 0) {
form = relationValues[0];
}
char* propValue = NULL;
date_t dateValue;
// 使用分号分隔键值对
while (std::getline(ss, keyValuePair, ';')) {
try {
std::stringstream pairStream(keyValuePair);
std::string key, value;
// 使用等号分隔键和值
if (std::getline(pairStream, key, '=') && std::getline(pairStream, value)) {
writeBomLog("当前key ==> " + key);
//configMap[key] = value;
std::string obj, prop;
// 使用 stringstream 和 getline 进行分割
std::stringstream ss(value);
if (std::getline(ss, obj, '.') && std::getline(ss, prop, '.')) {
writeBomLog("obj: " + obj);
writeBomLog("prop: " + prop);
if (obj == "Item") {
if (!isPropertyExist(attachmentTag, prop.c_str())) {
printf("prop %s 不存在\n", prop.c_str());
configMap[key] = "";
continue;
}
if (strcmp(prop.c_str(), "uom_tag") == 0) {
ITKCALL(ifail = AOM_UIF_ask_value(attachmentTag, prop.c_str(), &propValue));
writeBomLog("当前propValue ==> " + std::string(propValue));
configMap[key] = propValue;
}
else {
ITKCALL(ifail = AOM_ask_value_string(attachmentTag, prop.c_str(), &propValue));
writeBomLog("当前propValue ==> " + std::string(propValue));
configMap[key] = propValue;
}
}
else if (obj == "Rev") {
if (!isPropertyExist(attachTagRev, prop.c_str())) {
printf("prop %s 不存在\n", prop.c_str());
configMap[key] = "";
continue;
}
if (strcmp(prop.c_str(), "creation_date") == 0) {
writeBomLog("进入date测试");
ITKCALL(ifail = AOM_ask_value_date(attachTagRev, prop.c_str(), &dateValue));
char createDate[128] = "";
sprintf_s(createDate, "%04d-%02d-%02d %02d:%02d:%02d", dateValue.year, dateValue.month + 1, dateValue.day, dateValue.hour, dateValue.minute, dateValue.second);
propValue = createDate;
}
else if ((strcmp(prop.c_str(), "zf6_cpxsyb") == 0)) {
writeBomLog("进入cpxsyb测试");
/*int cpxsybNum = 0;
char** propValues = NULL;
AOM_ask_value_strings(attachTagRev, prop.c_str(), &cpxsybNum, &propValues);*/
int tempNum = 0;
char** tempValues = NULL;
ITKCALL(ifail = AOM_UIF_ask_values(attachTagRev, prop.c_str(), &tempNum, &tempValues));
std::string tempValue = "";
ITKCALL(ifail = AOM_UIF_ask_values(attachTagRev, prop.c_str(), &tempNum, &tempValues));
for (int i = 0; i < tempNum; i++) {
tempValue += tempValues[i];
tempValue += ";";
}
writeBomLog("当前propValue ==> " + tempValue);
configMap[key] = tempValue;
}
else {
ITKCALL(ifail = AOM_ask_value_string(attachTagRev, prop.c_str(), &propValue));
writeBomLog("当前propValue ==> " + std::string(propValue));
configMap[key] = propValue;
}
}
else if (count != 0 && obj == "Form") {
if (!isPropertyExist(form, prop.c_str())) {
printf("prop %s 不存在\n", prop.c_str());
configMap[key] = "";
continue;
}
ITKCALL(ifail = AOM_ask_value_string(form, prop.c_str(), &propValue));
writeBomLog("当前propValue ==> " + std::string(propValue));
configMap[key] = propValue;
}
else if (obj == "BomLine") {
if (strcmp(prop.c_str(), "bl_quantity") == 0) {
ITKCALL(ifail = AOM_ask_value_string(top_line, prop.c_str(), &propValue));
writeBomLog("当前propValue ==> " + std::string(propValue));
if (propValue == NULL || std::strlen(propValue) == 0) {
propValue = "1";
}
configMap[key] = propValue;
}
else {
ITKCALL(ifail = AOM_ask_value_string(top_line, prop.c_str(), &propValue));
writeBomLog("当前propValue ==> " + std::string(propValue));
configMap[key] = propValue;
}
}
else {
configMap[key] = value;
writeBomLog("当前propValue使用默认值1: " + value);
}
}
else {
writeBomLog("特殊Value处理 ==> " + std::string(value));
// 如果没有正确分割,可以选择存储原始值或处理错误
if (value == "TimeStamp") {
std::string time = getCurrentTimestamp17();
configMap[key] = time;
writeBomLog("当前propValue ==> " + time);
}
/* else if (value == "OwningUser") {
int userNum = 0;
tag_t* owners = NULLTAG;
ITKCALL(ifail = AOM_ask_value_tags(attachTagRev, "owning_user", &userNum, &owners));
if (userNum != 0) {
AOM_ask_value_string(owners[0], "user_name", &propValue);
}
writeBomLog("当前propValue ==> " + std::string(propValue));
configMap[key] = propValue;
DOFREE(owners);
}*/
else if (value == "MaterialClass") {
//获取子行
int count = 0;
tag_t* children_line;
ITKCALL(BOM_line_ask_all_child_lines(top_line, &count, &children_line));
if (count != 0) {
writeBomLog("当前propValue ==> A");
configMap[key] = "A";
}
else {
writeBomLog("当前propValue ==> M");
configMap[key] = "M";
}
}
else {
configMap[key] = value;
writeBomLog("当前propValue使用默认值2: " + value);
}
}
}
}
catch (const std::exception& e) {
writeBomLog("Error: " + std::string(e.what()));
}
}
return configMap;
}
Root exportHeadItem(Root data, std::map<std::string, std::string> outerConfigMap) {
for (const auto& pair : outerConfigMap) {
const std::string& key = pair.first;
const std::string& value = pair.second;
if (key == "key") {
data.key = value;
}
else if (key == "type") {
data.type = value;
}
else if (key == "prod") {
data.host.prod = value;
}
else if (key == "lang") {
data.host.lang = value;
}
else if (key == "acct") {
data.host.acct = value;
}
else if (key == "timestamp") {
data.host.timestamp = value;
}
else if (key == "prod") {
data.service.prod = value;
}
else if (key == "name") {
data.service.name = value;
}
else if (key == "id") {
data.service.id = value;
}
else if (key == "EntId") {
data.datakey.EntId = value;
}
else if (key == "CompanyId") {
data.datakey.CompanyId = value;
}
else if (key == "bmba001") {
data.payload.std_data.parameter.bmba001 = value;
}
}
return data;
}
std::string writeBomJsonToString(Root data) {
std::ostringstream oss;
// 打印 Root 属性
oss << "{\n";
oss << " \"key\": \"" << data.key << "\",\n";
oss << " \"type\": \"" << data.type << "\",\n";
// 打印 Host 属性
oss << " \"host\": {\n";
oss << " \"prod\": \"" << data.host.prod << "\",\n";
oss << " \"ip\": \"" << data.host.ip << "\",\n";
oss << " \"lang\": \"" << data.host.lang << "\",\n";
oss << " \"acct\": \"" << data.host.acct << "\",\n";
oss << " \"timestamp\": \"" << data.host.timestamp << "\"\n";
oss << " },\n";
// 打印 Service 属性
oss << " \"service\": {\n";
oss << " \"prod\": \"" << data.service.prod << "\",\n";
oss << " \"name\": \"" << data.service.name << "\",\n";
oss << " \"ip\": \"" << data.service.ip << "\",\n";
oss << " \"id\": \"" << data.service.id << "\"\n";
oss << " },\n";
// 打印 DataKey 属性
oss << " \"datakey\": {\n";
oss << " \"EntId\": \"" << data.datakey.EntId << "\",\n";
oss << " \"CompanyId\": \"" << data.datakey.CompanyId << "\"\n";
oss << " },\n";
// 打印 Payload 和 StdData 属性
oss << " \"payload\": {\n";
oss << " \"std_data\": {\n";
oss << " \"parameter\": {\n";
oss << " \"bmba001\": \"" << data.payload.std_data.parameter.bmba001 << "\",\n";
oss << " \"data\": [\n";
// 打印每个 DataItem 的属性
for (size_t i = 0; i < data.payload.std_data.parameter.data.size(); ++i) {
const DataItem& di = data.payload.std_data.parameter.data[i];
oss << " {\n";
oss << " \"bmba003\": \"" << di.bmba003 << "\",\n";
oss << " \"bmba011\": \"" << di.bmba011 << "\",\n";
oss << " \"bmba012\": \"" << di.bmba012 << "\",\n";
oss << " \"bmba010\": \"" << di.bmba010 << "\",\n";
oss << " \"bmaacrtdt\": \"" << di.bmaacrtdt << "\",\n";
oss << " \"acct\": \"" << di.acct << "\",\n";
oss << " \"bmaastus\": \"" << di.bmaastus << "\"";
if (i != data.payload.std_data.parameter.data.size() - 1) {
oss << "\n },\n";
}
else {
oss << "\n }\n";
}
}
oss << " ]\n";
oss << " }\n";
oss << " }\n";
oss << " }\n";
oss << "}\n";
return oss.str();
}
DataItem exportDateItem(std::map<std::string, std::string> innerConfigMap) {
DataItem& dataItem = DataItem();
for (const auto& pair : innerConfigMap) {
const std::string& key = pair.first;
const std::string& value = pair.second;
if (key == "bmba003") {
dataItem.bmba003 = value;
}
else if (key == "bmba011") {
dataItem.bmba011 = value;
}
else if (key == "bmba012") {
dataItem.bmba012 = value;
}
else if (key == "bmba010") {
dataItem.bmba010 = value;
}
else if (key == "bmaacrtdt") {
dataItem.bmaacrtdt = value;
}
else if (key == "acct") {
dataItem.acct = value;
}
else if (key == "bmaastus") {
dataItem.bmaastus = value;
}
}
return dataItem;
}
int recursionBOM(tag_t top_line) {
int count = 0;
tag_t* children_line;
tag_t itemRevision = NULLTAG;
ITKCALL(BOM_line_ask_all_child_lines(top_line, &count, &children_line));
if (count > 0) {
ITKCALL(AOM_ask_value_tag(top_line, bomAttr_lineItemRevTag, &itemRevision));
writeBomLog("开始解析json");
Root data = parseBomJson(fullPath);
std::vector<DataItem> dataItems;
// 解析 erpConfig 字符串
std::map<std::string, std::string> outerConfigMap;
std::map<std::string, std::string> innerConfigMap;
writeBomLog("ErpConfig[0]: " + string(erpConfig[0]));
outerConfigMap = parseBomConfigString(erpConfig[0], top_line);
//tag_t tempRev = NULLTAG;
for (int i = 0; i < count; i++) {
//ITKCALL(AOM_ask_value_tag(children_line[i], bomAttr_lineItemRevTag, &tempRev));
writeBomLog("ErpConfig[1]: " + string(erpConfig[1]));
innerConfigMap = parseBomConfigString(erpConfig[1], children_line[i]);
DataItem item = exportDateItem(innerConfigMap);
dataItems.push_back(item);
}
try {
if (string(erpConfig[0]).find("OwningUser") != std::string::npos) {
data.host.acct = processUserName;
}
data.payload.std_data.parameter.data = dataItems;
// 遍历 innerConfigMap 并设置 DataItem 属性
data = exportHeadItem(data, outerConfigMap);
writeBomLog("开始拼接json ==>");
std::string jsonStr = writeBomJsonToString(data);
writeBomLog(jsonStr);
writeBomLog("json拼接成功 <==");
writeBomLog("开始读取json文件");
// 发送 POST 请求
writeBomLog("开始发送Post请求");
string jsonFileName = generate_uuid_v4();
std::string jsonFilePath = tempPath + "\\" + jsonFileName + ".txt";
writeJsonToFile(jsonFilePath, jsonStr);
writeBomLog("json文件已保存到: " + jsonFilePath);
string cmd = "java -jar %ZF_ROOT%\\bin\\SendERP.jar " + std::string(url) + " " + jsonFilePath;
string result;
char buf[8000] = { 0 };
//logf("popen");
FILE* pf = _popen(cmd.c_str(), "r");
while (fgets(buf, sizeof buf, pf)) {
result.append(buf);
}
_pclose(pf);
writeBomLog("result:" + result);
// 检查结果中是否包含 "code": "0",
if (result.length() > 0) {
EMH_store_error_s1(EMH_severity_error, ITK_err, result.c_str());
return -1;
}
else {
writeBomLog("发送成功");
return 0;
}
}
catch (const json::exception& e) {
writeBomLog("JSON序列化错误: " + std::string(e.what()));
return -1;
}
catch (const std::exception& e) {
writeBomLog("标准异常: " + std::string(e.what()));
return -1;
}
for (int i = 0; i < count; i++) {
int ifail = recursionBOM(children_line[i]);
if (ifail != 0) {
return -1;
}
}
}
return 0;
}
}
using namespace sendBomPart;
int ZF_SendPartBOMToERP(EPM_action_message_t msg) {
// 获取日志文件目录路径
// 获取日志文件目录路径
logFilePath = getLogFilePath("ZF_SendPartBOMToERP_");
writeBomLog("=========================物料BOM同步 Start===================");
int ifail = ITK_ok;
char* templateUid = NULL;
ITKCALL(PREF_ask_char_value("ZF_SendPartBOMToERP_URL", 0, &url));
writeBomLog("url : " + std::string(url));
ITKCALL(PREF_ask_char_value("ZF_SendPartBOMToERP_Template", 0, &templateUid));
char* argName = NULL, * argValue = NULL, * arg = NULL;
char objTypes[1024] = "";
bool isExistRev = false;
int arg_cnt = TC_number_of_arguments(msg.arguments);
writeBomLog("参数个数为:" + std::to_string(arg_cnt));
if (arg_cnt > 0)
{
for (int i = 0; i < arg_cnt; i++)
{
arg = TC_next_argument(msg.arguments);
ITKCALL(ifail = ITK_ask_argument_named_value((const char*)arg, &argName, &argValue));
if (strcmp(argName, "type") == 0)
{
if (argValue != NULL)
{
strcpy(objTypes, argValue);
}
}
}
}
MEM_free(argName);
MEM_free(argValue);
std::vector<std::string> typeVector;
getVector(objTypes, typeVector, ';');
tag_t attachmentTag = NULLTAG;
int attachmentCount = 0;
tag_t rootTask = NULLTAG, * attachmentTags = NULLTAG;
ITKCALL(ifail = EPM_ask_root_task(msg.task, &rootTask));
ITKCALL(ifail = EPM_ask_attachments(rootTask, EPM_target_attachment, &attachmentCount, &attachmentTags));
// 获取首选项
tag_t templateDataSet = NULLTAG;
char* fileName = NULL;
ITK__convert_uid_to_tag(templateUid, &templateDataSet);
ITKCALL(AOM_ask_value_string(templateDataSet, "object_name", &fileName));
int n_found = 0;
tag_t* ref_object = NULLTAG;
const char* ref_name = "Text";
//AE_reference_type_t reference_type;
ITKCALL(AE_ask_dataset_named_refs(templateDataSet, &n_found, &ref_object));
//ITKCALL(ifail = AE_ask_dataset_named_ref2(templateDataSet, ref_name, &reference_type, &ref_object));
// 使用 std::string 进行字符串拼接
tempPath = getenv("TEMP");
fullPath = tempPath + "\\" + fileName;
removeFile(fullPath);
// 导出文件到完整路径
if (IMF_export_file(ref_object[0], fullPath.c_str()) != 0) {
writeBomLog("导出文件失败,路径: " + fullPath);
EMH_store_error_s1(EMH_severity_error, ITK_err, "文件导出失败");
return 1;
}
else {
writeBomLog("文件已成功导出到: " + fullPath);
}
int configNum;
ITKCALL(PREF_ask_char_values("ZF_SendPartBOMToERP_Config", &configNum, &erpConfig));
tag_t processUser = NULLTAG;
ITKCALL(AOM_ask_value_tag(rootTask, "owning_user", &processUser));
ITKCALL(AOM_ask_value_string(processUser, "user_id", &processUserName));
//遍历所有的流程目标下的对象
char* itemType = NULL;
writeBomLog(std::to_string(attachmentCount));
for (int i = 0; i < attachmentCount; i++) {
attachmentTag = attachmentTags[i];
if (!isTypeOf(attachmentTag, "ItemRevision")) {
continue;
}
ITKCALL(ifail = AOM_ask_value_string(attachmentTag, "object_type", &itemType));
if (inArrays(typeVector, itemType)) {
tag_t top_line = NULLTAG, window = NULLTAG;
ITKCALL(BOM_create_window(&window)); // 调用 BOM_create_window 创建 BOM 窗口
ITKCALL(BOM_set_window_top_line(window, NULLTAG, attachmentTag, NULLTAG, &top_line));
if (recursionBOM(top_line) != 0) {
writeBomLog("发送异常");
MEM_free(attachmentTags);
MEM_free(itemType);
return -1;
}
}
}
MEM_free(attachmentTags);
MEM_free(itemType);
return ifail;
}

@ -0,0 +1,959 @@
#include "ZF_SendPart.h"
namespace sendPart {
struct Host {
std::string prod; // 产品标识
std::string ip; // 主机IP地址
std::string lang; // 语言版本
std::string acct; // 系统账户
std::string timestamp; // 时间戳(当前为空)
};
struct Service {
std::string prod; // 服务产品代码
std::string name; // 服务全限定名
std::string ip; // 服务部署IP
std::string id; // 服务实例ID
};
struct DataKey {
std::string EntId; // 实体ID
std::string CompanyId; // 公司ID
};
struct DataItem {
std::string imaacrtdt; // 创建日期
std::string acct; // 账户编号
std::string imaa001; // 物料基础字段1
std::string imaal003; // 多语言字段3
std::string imaal004; // 多语言字段4
std::string imaa004; // 物料分类字段
std::string imaa009; // 库存管理字段
std::string imaa006; // 计量单位字段
std::string imaa010; // 批次管理标识
std::string imaaud001; // 审计字段1
std::string imaaud012; // 审计字段12
std::string imaaud013; // 审计字段13
std::string imaa017; // 有效期控制字段
std::string imaaud002; // 审计字段2
std::string imaf013; // 财务相关字段
std::string imae034; // 工程数据字段
std::string imaaud003; // 审计字段3
std::string imaaud004; // 审计字段4
std::string imaaud005; // 审计字段5
std::string imaaud006; // 审计字段6
std::string imaaud007; // 审计字段7
std::string imaaud008; // 审计字段8
std::string imaaud009; // 审计字段9
std::string imaaud010; // 审计字段10
};
struct Parameter {
std::vector<DataItem> data; // 物料数据集合
};
struct StdData {
Parameter parameter; // 参数容器
};
struct Payload {
StdData std_data; // 标准化数据载体
};
struct Root {
std::string key; // 请求唯一标识符
std::string type; // 同步类型标识
Host host; // 宿主系统信息
Service service; // 服务实例信息
DataKey datakey; // 数据主键标识
Payload payload; // 业务数据负载
};
// 序列化 Host 结构体
void to_json(json& j, const Host& h) {
j = json{
{"prod", h.prod},
{"ip", h.ip},
{"lang", h.lang},
{"acct", h.acct},
{"timestamp", h.timestamp}
};
}
// 序列化 Service 结构体
void to_json(json& j, const Service& s) {
j = json{
{"prod", s.prod},
{"name", s.name},
{"ip", s.ip},
{"id", s.id}
};
}
// 序列化 DataKey 结构体
void to_json(json& j, const DataKey& dk) {
j = json{
{"EntId", dk.EntId},
{"CompanyId", dk.CompanyId}
};
}
// 序列化 DataItem 结构体
void to_json(json& j, const DataItem& di) {
j = json{
{"imaacrtdt", di.imaacrtdt},
{"acct", di.acct},
{"imaa001", di.imaa001},
{"imaal003", di.imaal003},
{"imaal004", di.imaal004},
{"imaa004", di.imaa004},
{"imaa009", di.imaa009},
{"imaa006", di.imaa006},
{"imaa010", di.imaa010},
{"imaaud001", di.imaaud001},
{"imaaud012", di.imaaud012},
{"imaaud013", di.imaaud013},
{"imaa017", di.imaa017},
{"imaaud002", di.imaaud002},
{"imaf013", di.imaf013},
{"imae034", di.imae034},
{"imaaud003", di.imaaud003},
{"imaaud004", di.imaaud004},
{"imaaud005", di.imaaud005},
{"imaaud006", di.imaaud006},
{"imaaud007", di.imaaud007},
{"imaaud008", di.imaaud008},
{"imaaud009", di.imaaud009},
{"imaaud010", di.imaaud010}
};
}
// 序列化 Parameter 结构体
void to_json(json& j, const Parameter& p) {
j = json{
{"data", p.data}
};
}
// 序列化 StdData 结构体
void to_json(json& j, const StdData& sd) {
j = json{
{"parameter", sd.parameter}
};
}
// 序列化 Payload 结构体
void to_json(json& j, const Payload& pl) {
j = json{
{"std_data", pl.std_data}
};
}
// 序列化 Root 结构体
void to_json(json& j, const Root& root) {
j = json{
{"key", root.key},
{"type", root.type},
{"host", root.host},
{"service", root.service},
{"datakey", root.datakey},
{"payload", root.payload}
};
}
// 反序列化适配器实现
void from_json(const json& j, Host& h) {
j.at("prod").get_to(h.prod);
j.at("ip").get_to(h.ip);
j.at("lang").get_to(h.lang);
j.at("acct").get_to(h.acct);
j.at("timestamp").get_to(h.timestamp);
}
void from_json(const json& j, Service& s) {
j.at("prod").get_to(s.prod);
j.at("name").get_to(s.name);
j.at("ip").get_to(s.ip);
j.at("id").get_to(s.id);
}
void from_json(const json& j, DataKey& dk) {
j.at("EntId").get_to(dk.EntId);
j.at("CompanyId").get_to(dk.CompanyId);
}
void from_json(const json& j, DataItem& di) {
j.at("imaacrtdt").get_to(di.imaacrtdt);
j.at("acct").get_to(di.acct);
j.at("imaa001").get_to(di.imaa001); // 物料基础字段1
j.at("imaal003").get_to(di.imaal003); // 多语言字段3
j.at("imaal004").get_to(di.imaal004); // 多语言字段4
j.at("imaa004").get_to(di.imaa004); // 物料分类字段
j.at("imaa009").get_to(di.imaa009); // 库存管理字段
j.at("imaa006").get_to(di.imaa006); // 计量单位字段
j.at("imaa010").get_to(di.imaa010); // 批次管理标识
j.at("imaaud001").get_to(di.imaaud001); // 审计字段1
j.at("imaaud012").get_to(di.imaaud012); // 审计字段12
j.at("imaaud013").get_to(di.imaaud013); // 审计字段13
j.at("imaa017").get_to(di.imaa017); // 有效期控制字段
j.at("imaaud002").get_to(di.imaaud002); // 审计字段2
j.at("imaf013").get_to(di.imaf013); // 财务相关字段
j.at("imae034").get_to(di.imae034); // 工程数据字段
j.at("imaaud003").get_to(di.imaaud003); // 审计字段3
j.at("imaaud004").get_to(di.imaaud004); // 审计字段4
j.at("imaaud005").get_to(di.imaaud005); // 审计字段5
j.at("imaaud006").get_to(di.imaaud006); // 审计字段6
j.at("imaaud007").get_to(di.imaaud007); // 审计字段7
j.at("imaaud008").get_to(di.imaaud008); // 审计字段8
j.at("imaaud009").get_to(di.imaaud009); // 审计字段9
j.at("imaaud010").get_to(di.imaaud010); // 审计字段10
}
void from_json(const json& j, Parameter& p) {
j.at("data").get_to(p.data);
}
void from_json(const json& j, StdData& sd) {
j.at("parameter").get_to(sd.parameter);
}
void from_json(const json& j, Payload& pl) {
j.at("std_data").get_to(pl.std_data);
}
void from_json(const json& j, Root& root) {
j.at("key").get_to(root.key);
j.at("type").get_to(root.type);
j.at("host").get_to(root.host);
j.at("service").get_to(root.service);
j.at("datakey").get_to(root.datakey);
j.at("payload").get_to(root.payload);
}
// 写入日志信息到文件 writeLog("当前工时: "+ std::to_string(totalGs));
void writeLog(const std::string& message) {
std::ofstream logFile(logFilePath, std::ios_base::app); // 以追加模式打开文件
if (logFile.is_open()) {
std::string logEntry = "[" + getCurrentTime() + "] " + message + "\n";
logFile << logEntry;
logFile.close();
}
else {
std::cerr << "无法打开日志文件" << std::endl;
}
}
// 文件读取与解析函数
Root parseJson(const std::string& file_path) {
try {
// 创建文件流对象
std::ifstream file_stream(file_path);
if (!file_stream.is_open()) {
throw std::runtime_error("文件打开失败: " + file_path);
}
// 读取文件内容
std::string file_content(
(std::istreambuf_iterator<char>(file_stream)),
std::istreambuf_iterator<char>());
// JSON解析
json j = json::parse(file_content);
return j.get<Root>();
}
catch (const json::exception& e) {
std::cerr << "JSON解析错误[" << e.id << "]: " << e.what() << std::endl;
throw;
}
catch (const std::exception& e) {
std::cerr << "系统异常: " << e.what() << std::endl;
throw;
}
}
int isPropertyExist(tag_t object_tag, const char* target_prop_name) {
int ifail = ITK_ok;
int prop_count = 0;
char** prop_names = NULL;
// 获取对象的所有属性名称
ifail = AOM_ask_prop_names(object_tag, &prop_count, &prop_names);
if (ifail != ITK_ok || prop_count == 0) {
return 0; // 属性不存在或获取失败
}
// 遍历属性列表查找目标属性
int exists = 0;
for (int i = 0; i < prop_count; i++) {
if (strcmp(prop_names[i], target_prop_name) == 0) {
exists = 1;
break;
}
}
// 释放内存
MEM_free(prop_names);
return exists;
}
std::map<std::string, std::string> parseConfigString(const std::string& configString, tag_t attachTagRev) {
int ifail = ITK_ok;
std::map<std::string, std::string> configMap;
std::stringstream ss(configString);
std::string keyValuePair;
tag_t attachmentTag = NULLTAG;
ITKCALL(ITEM_ask_item_of_rev(attachTagRev, &attachmentTag));
int count = 0;
// relationValues ==> 对象对应关系下的子对象数组
tag_t* relationValues = NULLTAG;
tag_t form = NULLTAG;
// attachmentTag ==> 当前流程下的对象
ITKCALL(ifail = AOM_ask_value_tags(attachTagRev, "IMAN_master_form_rev", &count, &relationValues));
if (count != 0) {
form = relationValues[0];
}
char* propValue = NULL;
date_t dateValue;
// 使用分号分隔键值对
while (std::getline(ss, keyValuePair, ';')) {
try {
std::stringstream pairStream(keyValuePair);
std::string key, value;
// 使用等号分隔键和值
if (std::getline(pairStream, key, '=') && std::getline(pairStream, value)) {
writeLog("当前key ==> " + key);
//configMap[key] = value;
std::string obj, prop;
// 使用 stringstream 和 getline 进行分割
std::stringstream ss(value);
if (std::getline(ss, obj, '.') && std::getline(ss, prop, '.')) {
writeLog("obj: " + obj);
writeLog("prop: " + prop);
if (obj == "Item") {
if (!isPropertyExist(attachmentTag, prop.c_str())) {
printf("prop %s 不存在\n", prop.c_str());
configMap[key] = "";
continue;
}
if (strcmp(prop.c_str(), "uom_tag") == 0) {
ITKCALL(ifail = AOM_UIF_ask_value(attachmentTag, prop.c_str(), &propValue));
writeLog("当前propValue ==> " + std::string(propValue));
configMap[key] = propValue;
}
else {
ITKCALL(ifail = AOM_ask_value_string(attachmentTag, prop.c_str(), &propValue));
writeLog("当前propValue ==> " + std::string(propValue));
configMap[key] = propValue;
}
}
else if (obj == "Rev") {
if (!isPropertyExist(attachTagRev, prop.c_str())) {
printf("prop %s 不存在\n", prop.c_str());
configMap[key] = "";
continue;
}
if (strcmp(prop.c_str(), "creation_date") == 0) {
writeLog("进入date测试");
ITKCALL(ifail = AOM_ask_value_date(attachTagRev, prop.c_str(), &dateValue));
char createDate[128] = "";
sprintf_s(createDate, "%04d-%02d-%02d %02d:%02d:%02d", dateValue.year, dateValue.month + 1, dateValue.day, dateValue.hour, dateValue.minute, dateValue.second);
propValue = createDate;
}
else if ((strcmp(prop.c_str(), "zf6_cpxsyb") == 0)) {
writeLog("进入cpxsyb测试");
/*int cpxsybNum = 0;
char** propValues = NULL;
AOM_ask_value_strings(attachTagRev, prop.c_str(), &cpxsybNum, &propValues);*/
int tempNum = 0;
char** tempValues = NULL;
std::string tempValue = "";
ITKCALL(ifail = AOM_UIF_ask_values(attachTagRev, prop.c_str(), &tempNum, &tempValues));
for (int i = 0; i < tempNum; i++) {
tempValue += tempValues[i];
tempValue += ";";
}
writeLog("当前propValue ==> " + tempValue);
configMap[key] = tempValue;
}
else {
ITKCALL(ifail = AOM_ask_value_string(attachTagRev, prop.c_str(), &propValue));
writeLog("当前propValue ==> " + std::string(propValue));
configMap[key] = propValue;
}
}
else if (count != 0 && obj == "Form") {
if (!isPropertyExist(form, prop.c_str())) {
configMap[key] = "";
continue;
}
ITKCALL(ifail = AOM_ask_value_string(form, prop.c_str(), &propValue));
writeLog("当前propValue ==> " + std::string(propValue));
configMap[key] = propValue;
}
else {
configMap[key] = value;
writeLog("当前propValue使用默认值1: " + value);
}
}
else {
writeLog("特殊Value处理 ==> " + std::string(value));
// 如果没有正确分割,可以选择存储原始值或处理错误
if (value == "TimeStamp") {
std::string time = getCurrentTimestamp17();
configMap[key] = time;
writeLog("当前propValue ==> " + time);
}
/*else if (value == "OwningUser") {
int userNum = 0;
tag_t* owners = NULLTAG;
ITKCALL(ifail = AOM_ask_value_tags(attachTagRev, "owning_user", &userNum, &owners));
if (userNum != 0) {
AOM_ask_value_string(owners[0], "user_name", &propValue);
}
writeLog("当前propValue ==> " + std::string(propValue));
configMap[key] = propValue;
DOFREE(owners);
}*/
else if (value == "MaterialClass") {
tag_t top_line = NULLTAG, window = NULLTAG;
ITKCALL(BOM_create_window(&window)); // 调用 BOM_create_window 创建 BOM 窗口
ITKCALL(BOM_set_window_top_line(window, NULLTAG, attachTagRev, NULLTAG, &top_line));
//获取子行
int count = 0;
tag_t* children_line;
ITKCALL(BOM_line_ask_all_child_lines(top_line, &count, &children_line));
if (count != 0) {
writeLog("当前propValue ==> A");
configMap[key] = "A";
}
else {
writeLog("当前propValue ==> M");
configMap[key] = "M";
}
}
else if (value == "PurchaseType") {
char* zf6_zz = NULL;
char* zf6_wg = NULL;
if (!(isPropertyExist(attachTagRev, "zf6_zz") && isPropertyExist(attachTagRev, "zf6_wg"))) {
configMap[key] = "";
continue;
}
ITKCALL(AOM_UIF_ask_value(attachTagRev, "zf6_zz", &zf6_zz));
ITKCALL(AOM_UIF_ask_value(attachTagRev, "zf6_wg", &zf6_wg));
if (zf6_zz == NULL || std::strlen(zf6_zz) == 0) {
EMH_store_error_s1(EMH_severity_error, ITK_err, "是否自制属性为空");
return {};
}
if (zf6_wg == NULL || std::strlen(zf6_wg) == 0) {
EMH_store_error_s1(EMH_severity_error, ITK_err, "是否外购属性为空");
return {};
}
if ((zf6_zz == "" && zf6_wg == "") || (zf6_zz == "" && zf6_wg == "")) {
writeLog("当前propValue ==> 2");
configMap[key] = "2";
}
else if (zf6_zz == "" && zf6_wg == "") {
writeLog("当前propValue ==> 1");
configMap[key] = "1";
}
DOFREE(zf6_zz);
DOFREE(zf6_wg);
}
else {
configMap[key] = value;
writeLog("当前propValue使用默认值2: " + value);
}
}
}
}
catch (const std::exception& e) {
writeLog("Error: " + std::string(e.what()));
}
}
return configMap;
}
std::string writeJsonToString(Root data) {
std::ostringstream oss;
// 打印 Root 属性
oss << "{\n";
oss << " \"key\": \"" << data.key << "\",\n";
oss << " \"type\": \"" << data.type << "\",\n";
// 打印 Host 属性
oss << " \"host\": {\n";
oss << " \"prod\": \"" << data.host.prod << "\",\n";
oss << " \"ip\": \"" << data.host.ip << "\",\n";
oss << " \"lang\": \"" << data.host.lang << "\",\n";
oss << " \"acct\": \"" << data.host.acct << "\",\n";
oss << " \"timestamp\": \"" << data.host.timestamp << "\"\n";
oss << " },\n";
// 打印 Service 属性
oss << " \"service\": {\n";
oss << " \"prod\": \"" << data.service.prod << "\",\n";
oss << " \"name\": \"" << data.service.name << "\",\n";
oss << " \"ip\": \"" << data.service.ip << "\",\n";
oss << " \"id\": \"" << data.service.id << "\"\n";
oss << " },\n";
// 打印 DataKey 属性
oss << " \"datakey\": {\n";
oss << " \"EntId\": \"" << data.datakey.EntId << "\",\n";
oss << " \"CompanyId\": \"" << data.datakey.CompanyId << "\"\n";
oss << " },\n";
// 打印 Payload 和 StdData 属性
oss << " \"payload\": {\n";
oss << " \"std_data\": {\n";
oss << " \"parameter\": {\n";
oss << " \"data\": [\n";
// 打印每个 DataItem 的属性
for (size_t i = 0; i < data.payload.std_data.parameter.data.size(); ++i) {
const DataItem& di = data.payload.std_data.parameter.data[i];
oss << " {\n";
oss << " \"imaacrtdt\": \"" << di.imaacrtdt << "\",\n";
oss << " \"acct\": \"" << di.acct << "\",\n";
oss << " \"imaa001\": \"" << di.imaa001 << "\",\n";
oss << " \"imaal003\": \"" << di.imaal003 << "\",\n";
oss << " \"imaal004\": \"" << di.imaal004 << "\",\n";
oss << " \"imaa004\": \"" << di.imaa004 << "\",\n";
oss << " \"imaa009\": \"" << di.imaa009 << "\",\n";
oss << " \"imaa006\": \"" << di.imaa006 << "\",\n";
oss << " \"imaa010\": \"" << di.imaa010 << "\",\n";
oss << " \"imaaud001\": \"" << di.imaaud001 << "\",\n";
oss << " \"imaaud012\": \"" << di.imaaud012 << "\",\n";
oss << " \"imaaud013\": \"" << di.imaaud013 << "\",\n";
oss << " \"imaa017\": \"" << di.imaa017 << "\",\n";
oss << " \"imaaud002\": \"" << di.imaaud002 << "\",\n";
oss << " \"imaf013\": \"" << di.imaf013 << "\",\n";
oss << " \"imae034\": \"" << di.imae034 << "\",\n";
oss << " \"imaaud003\": \"" << di.imaaud003 << "\",\n";
oss << " \"imaaud004\": \"" << di.imaaud004 << "\",\n";
oss << " \"imaaud005\": \"" << di.imaaud005 << "\",\n";
oss << " \"imaaud006\": \"" << di.imaaud006 << "\",\n";
oss << " \"imaaud007\": \"" << di.imaaud007 << "\",\n";
oss << " \"imaaud008\": \"" << di.imaaud008 << "\",\n";
oss << " \"imaaud009\": \"" << di.imaaud009 << "\",\n";
oss << " \"imaaud010\": \"" << di.imaaud010 << "\"";
if (i != data.payload.std_data.parameter.data.size() - 1) {
oss << "\n },\n";
}
else {
oss << "\n }\n";
}
}
oss << " ]\n";
oss << " }\n";
oss << " }\n";
oss << " }\n";
oss << "}\n";
return oss.str();
}
DataItem exportDateItem(std::map<std::string, std::string> innerConfigMap) {
DataItem& dataItem = DataItem();
for (const auto& pair : innerConfigMap) {
const std::string& key = pair.first;
const std::string& value = pair.second;
if (key == "imaacrtdt") {
dataItem.imaacrtdt = value;
}
else if (key == "acct") {
dataItem.acct = value;
}
else if (key == "imaa001") {
dataItem.imaa001 = value;
}
else if (key == "imaal003") {
dataItem.imaal003 = value;
}
else if (key == "imaal004") {
dataItem.imaal004 = value;
}
else if (key == "imaa004") {
dataItem.imaa004 = value;
}
else if (key == "imaa009") {
dataItem.imaa009 = value;
}
else if (key == "imaa006") {
dataItem.imaa006 = value;
}
else if (key == "imaa010") {
dataItem.imaa010 = value;
}
else if (key == "imaaud001") {
dataItem.imaaud001 = value;
}
else if (key == "imaaud012") {
dataItem.imaaud012 = value;
}
else if (key == "imaaud013") {
dataItem.imaaud013 = value;
}
else if (key == "imaa017") {
dataItem.imaa017 = value;
}
else if (key == "imaaud002") {
dataItem.imaaud002 = value;
}
else if (key == "imaf013") {
dataItem.imaf013 = value;
}
else if (key == "imae034") {
dataItem.imae034 = value;
}
else if (key == "imaaud003") {
dataItem.imaaud003 = value;
}
else if (key == "imaaud004") {
dataItem.imaaud004 = value;
}
else if (key == "imaaud005") {
dataItem.imaaud005 = value;
}
else if (key == "imaaud006") {
dataItem.imaaud006 = value;
}
else if (key == "imaaud007") {
dataItem.imaaud007 = value;
}
else if (key == "imaaud008") {
dataItem.imaaud008 = value;
}
else if (key == "imaaud009") {
dataItem.imaaud009 = value;
}
else if (key == "imaaud010") {
dataItem.imaaud010 = value;
}
}
return dataItem;
}
Root exportHeadItem(Root data, std::map<std::string, std::string> outerConfigMap) {
for (const auto& pair : outerConfigMap) {
const std::string& key = pair.first;
const std::string& value = pair.second;
if (key == "key") {
data.key = value;
}
else if (key == "type") {
data.type = value;
}
else if (key == "prod") {
data.host.prod = value;
}
else if (key == "lang") {
data.host.lang = value;
}
else if (key == "acct") {
data.host.acct = value;
}
else if (key == "timestamp") {
data.host.timestamp = value;
}
else if (key == "prod") {
data.service.prod = value;
}
else if (key == "name") {
data.service.name = value;
}
else if (key == "id") {
data.service.id = value;
}
else if (key == "EntId") {
data.datakey.EntId = value;
}
else if (key == "CompanyId") {
data.datakey.CompanyId = value;
}
}
return data;
}
}
using namespace sendPart;
#include <windows.h>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
std::string parseResponseJson(const std::string& json_str) {
try {
// 解析 JSON 字符串
json root = json::parse(json_str);
// 验证 JSON 结构
if (!root.contains("result") ||
!root["result"].contains("payload") ||
!root["result"]["payload"].contains("std_data") ||
!root["result"]["payload"]["std_data"].contains("data")) {
throw std::runtime_error("Invalid JSON structure");
}
// 获取 data 数组
const auto& data_array = root["result"]["payload"]["std_data"]["data"];
// 存储 notes 的容器
std::vector<std::string> notes;
// 遍历数组提取 notes
for (const auto& item : data_array) {
if (item.contains("notes") && item["notes"].is_string()) {
notes.push_back(item["notes"].get<std::string>());
}
}
// 拼接字符串
std::ostringstream oss;
oss << "[ERP系统返回错误] ";
for (size_t i = 0; i < notes.size(); ++i) {
if (i > 0) oss << "\n";
oss << notes[i];
}
return oss.str();
}
catch (const json::exception& e) {
std::cerr << "JSON 解析错误: " << e.what() << std::endl;
return "";
}
catch (const std::exception& e) {
std::cerr << "错误: " << e.what() << std::endl;
return "";
}
}
int ZF_SendPartToERP(EPM_action_message_t msg) {
// 获取日志文件目录路径
logFilePath = getLogFilePath("ZF_SendPartToERP_");
writeLog("=========================物料同步 Start===================");
int ifail = ITK_ok;
char* url =NULL ,* templateUid =NULL;
ITKCALL(PREF_ask_char_value("ZF_SendPartToERP_URL", 0 , &url));
writeLog("url : " + std::string(url));
ITKCALL(PREF_ask_char_value("ZF_SendPartToERP_Template", 0, &templateUid));
char* argName = NULL, * argValue = NULL, * arg = NULL;
char objTypes[1024] = "", option[1024] = "";
bool isExistRev = false;
int arg_cnt = TC_number_of_arguments(msg.arguments);
writeLog("参数个数为:"+ std::to_string(arg_cnt));
if (arg_cnt > 0)
{
for (int i = 0; i < arg_cnt; i++)
{
arg = TC_next_argument(msg.arguments);
ITKCALL(ifail = ITK_ask_argument_named_value((const char*)arg, &argName, &argValue));
if (strcmp(argName, "type") == 0)
{
if (argValue != NULL)
{
strcpy(objTypes, argValue);
}
}
else if (stricmp(argName, "option") == 0)
{
if (argValue != NULL)
{
strcpy(option, argValue);
}
}
}
}
MEM_free(argName);
MEM_free(argValue);
std::vector<std::string> typeVector;
getVector(objTypes, typeVector, ';');
char** config;
int num;
// 判断 -option配置的首选项 是否为空
if (strlen(option) > 0) {
ITKCALL(PREF_ask_char_values(option, &num, &config));
writeLog("option 不为空,值为:"+ std::string(option));
}
else {
EMH_store_error_s1(EMH_severity_error, ITK_err, "option参数为空");
return ifail;
}
tag_t attachmentTag = NULLTAG;
int attachmentCount = 0;
tag_t rootTask = NULLTAG, * attachmentTags = NULLTAG;
ITKCALL(ifail = EPM_ask_root_task(msg.task, &rootTask));
ITKCALL(ifail = EPM_ask_attachments(rootTask, EPM_target_attachment, &attachmentCount, &attachmentTags));
// 获取首选项
tag_t templateDataSet = NULLTAG;
char* fileName = NULL;
ITK__convert_uid_to_tag(templateUid, &templateDataSet);
ITKCALL(AOM_ask_value_string(templateDataSet, "object_name", &fileName));
int n_found = 0;
tag_t* ref_object = NULLTAG;
const char* ref_name = "Text";
//AE_reference_type_t reference_type;
ITKCALL(AE_ask_dataset_named_refs(templateDataSet, &n_found, &ref_object));
//ITKCALL(ifail = AE_ask_dataset_named_ref2(templateDataSet, ref_name, &reference_type, &ref_object));
// 使用 std::string 进行字符串拼接
std::string tempPath = getenv("TEMP");
std::string fullPath = tempPath + "\\" + fileName;
removeFile(fullPath);
// 导出文件到完整路径
if (IMF_export_file(ref_object[0], fullPath.c_str()) != 0) {
writeLog("导出文件失败,路径: " + fullPath);
EMH_store_error_s1(EMH_severity_error, ITK_err, "文件导出失败");
return 1;
}
else {
writeLog("文件已成功导出到: " + fullPath);
}
char** erpConfig;
int configNum;
ITKCALL(PREF_ask_char_values(option, &configNum, &erpConfig));
writeLog("开始解析json");
Root data = parseJson(fullPath);
std::vector<DataItem> dataItems;
// 解析 erpConfig 字符串
std::map<std::string, std::string> outerConfigMap;
tag_t processUser = NULLTAG;
char* processUserName = NULL;
ITKCALL(AOM_ask_value_tag(rootTask, "owning_user", &processUser));
ITKCALL(AOM_ask_value_string(processUser, "user_id", &processUserName));
//遍历所有的流程目标下的对象
char* itemType = NULL;
writeLog(std::to_string(attachmentCount));
for (int i = 0; i < attachmentCount; i++) {
attachmentTag = attachmentTags[i];
if (!isTypeOf(attachmentTag, "ItemRevision")) {
continue;
}
writeLog(std::to_string(i));
std::map<std::string, std::string> innerConfigMap;
if (configNum == 2) {
writeLog("ErpConfig[0]: " + string(erpConfig[0]));
outerConfigMap = parseConfigString(erpConfig[0], attachmentTag);
writeLog("ErpConfig[1]: " + string(erpConfig[1]));
innerConfigMap = parseConfigString(erpConfig[1], attachmentTag);
}
else {
EMH_store_error_s1(EMH_severity_error, ITK_err, "option参数不正确");
return ifail;
}
if (outerConfigMap.empty() || innerConfigMap.empty()) {
return -1;
}
ITKCALL(ifail = AOM_ask_value_string(attachmentTag, "object_type", &itemType));
if (inArrays(typeVector, itemType)) {
DataItem item = exportDateItem(innerConfigMap);
dataItems.push_back(item);
}
}
try {
if (string(erpConfig[0]).find("OwningUser") != std::string::npos) {
data.host.acct = processUserName;
}
data.payload.std_data.parameter.data = dataItems;
// 遍历 innerConfigMap 并设置 DataItem 属性
data = exportHeadItem(data, outerConfigMap);
writeLog("开始拼接json ==>");
std::string jsonStr = writeJsonToString(data);
writeLog(jsonStr);
writeLog("json拼接成功 <==");
// 发送 POST 请求
writeLog("开始发送Post请求");
string jsonFileName = generate_uuid_v4();
std::string jsonFilePath = tempPath + "\\" + jsonFileName + ".txt";
writeJsonToFile(jsonFilePath, jsonStr);
writeLog("json文件已保存到: " + jsonFilePath);
string cmd = "java -jar %ZF_ROOT%\\bin\\SendERP.jar " + std::string(url) +" " + jsonFilePath;
string result;
char buf[8000] = { 0 };
//logf("popen");
FILE* pf = _popen(cmd.c_str(), "r");
while (fgets(buf, sizeof buf, pf)) {
result.append(buf);
}
_pclose(pf);
// 转换编码
writeLog("result:"+ result);
// 检查结果中是否包含 "code": "0",
if (result.length() > 0) {
EMH_store_error_s1(EMH_severity_error, ITK_err, result.c_str());
}
else {
writeLog("发送成功");
}
}
catch (const json::exception& e) {
writeLog("JSON序列化错误: " + std::string(e.what()));
return -1;
}
catch (const std::exception& e) {
writeLog("标准异常: " + std::string(e.what()));
return -1;
}
MEM_free(attachmentTags);
MEM_free(itemType);
return ifail;
}

@ -0,0 +1,300 @@
#include <wchar.h>
#include <string.h>
#ifdef WIN32
#include <io.h>
#include <direct.h>
#else
#include <unistd.h>
#endif
#include "connor_itk_util.h"
//extern "C" int POM_AM__set_application_bypass(logical bypass);
#include <string>
#include <iostream>
#include <sstream>
#define ARGS_LENGTH 200
#define ARGS_NAME_DEBUG "-debug"
#define DEBUG "-debug="
#define MAX_PRINTLINE_LENGTH 10000
#define MAX_PATH_LENGTH 2000
#define MAX_ARGUMENT_LENGTH 400
#define MAX_FILE_EXT_LENGTH 10
#define TRUE_FLAG 1
#define FALSE_FLAG 0
#define DETAILLOG 1
using namespace std;
//void ECHO(char* format, ...)
//{
// //if( !YFJC_OPT_DEBUG )
// // return;
//
// char msg[4096];
// va_list args;
//
// va_start(args, format);
// vsprintf(msg, format, args);
// va_end(args);
//
// printf(msg);
// TC_write_syslog(msg);
//}
FILE* logFile = NULL;
/*=============================================================================*
* FUNCTION: current_time
* PURPOSE : get the current datetime
* INPUT:
* date_t* date_tag // current date time tag
*
* RETURN:
* void
*============================================================================*/
void current_time(date_t* date_tag)
{
time_t ltime;
struct tm* today;
// Set time zone from TZ environment variable. If TZ is not set,
// the operating system is queried to obtain the default value
// for the variable.
//
//_tzset();
// Get UNIX-style time and display as number and string.
time(&ltime);
today = localtime(&ltime);
date_tag->year = today->tm_year + 1900;
date_tag->month = today->tm_mon;
date_tag->day = today->tm_mday;
date_tag->hour = today->tm_hour;
date_tag->minute = today->tm_min;
date_tag->second = today->tm_sec;
}
/*=============================================================================*
* FUNCTION: CreateLogFile
* PURPOSE : create log file
* INPUT:
* char* FunctionName // the funtion which need to create log file
* FILE** logFile // out: the log file pointer
*
* RETURN:
* void
*============================================================================*/
void CreateLogFile(char* FunctionName, char** fullname)
{
int i = 0, ifail = ITK_ok;
//date_t status_now;
//char* date_string = NULL;
char date_string[MAX_PATH_LENGTH];
char logFileDir[MAX_PATH_LENGTH];
char logFileName[MAX_PATH_LENGTH];
char* session_uid = NULL;
tag_t session_tag = NULLTAG;
time_t now;
struct tm* p;
time(&now);
logFile = NULL;
//current_time(&status_now);
p = localtime(&now);
memset(date_string, 0, sizeof(date_string));
//sprintf(date_string,"%4d%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 );
sprintf(date_string, "%4d%02d%02d", 1900 + p->tm_year, p->tm_mon + 1, p->tm_mday);
//if( DATE_date_to_string( status_now, "%Y%m%d%H%M%S", &date_string) != ITK_ok )
//ifail = ITK_date_to_string (status_now, &date_string );
//if (ifail)
//{
// printf("!*ERROR*!: Failed to get current date time\n");
// goto CLEANUP;
//}
memset(logFileDir, 0, sizeof(logFileDir));
memset(logFileName, 0, sizeof(logFileName));
//get log dir
sprintf(logFileDir, "%s", getenv("TEMP"));
printf("\n log file dir: %s\n", logFileDir);
//try to change dir to TC_USER_LOG_DIR
if (chdir(logFileDir) != ITK_ok)
{
//not set TC_USER_LOG_DIR
//log in to default TC_LOG
memset(logFileDir, 0, sizeof(logFileDir));
sprintf(logFileDir, "%s", getenv("TC_LOG"));
printf("\n TC_USER_LOG_DIR invalide, log file dir: %s\n", logFileDir);
if (chdir(logFileDir) != ITK_ok)
{
//still can not change to log dir
printf("!*ERROR*!: Failed to change dir to TC_USER_LOG_DIR\n");
goto CLEANUP;
}
}
//get session_uid to make sure the log file name unique
POM_ask_session(&session_tag);
ITK__convert_tag_to_uid(session_tag, &session_uid);
//get logFileName
//sprintf(logFileName, "%s_%s_%s.log", FunctionName, session_uid, date_string);
sprintf(logFileName, "%s_%s.log", FunctionName, date_string);
printf("log file name: %s\n", logFileName);
*fullname = (char*)MEM_alloc(sizeof(char) * 512);
sprintf(*fullname, "%s\\%s", logFileDir, logFileName);
//for(i = 0; _access((char *)logFileName, 4) == 0; i++)
/*{
memset(logFileName, 0, sizeof(logFileName));
sprintf(logFileName, "%s_%s_%s_%d.log", FunctionName, session_uid, date_string, i);
}
printf("final log file name: %s\n", logFileName);*/
//create log file
logFile = fopen(logFileName, "a");
CLEANUP:
//DOFREE(date_string);
DOFREE(session_uid);
}
void CreateLogFile2(char* FunctionName, char** fullname, char* fileDir)
{
int i = 0, ifail = ITK_ok;
//date_t status_now;
//char* date_string = NULL;
char date_string[MAX_PATH_LENGTH];
char logFileDir[MAX_PATH_LENGTH];
char logFileName[MAX_PATH_LENGTH];
char* session_uid = NULL;
tag_t session_tag = NULLTAG;
time_t now;
struct tm* p;
time(&now);
logFile = NULL;
//current_time(&status_now);
p = localtime(&now);
memset(date_string, 0, sizeof(date_string));
//sprintf(date_string,"%4d%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 );
sprintf(date_string, "%4d%02d%02d", 1900 + p->tm_year, p->tm_mon + 1, p->tm_mday);
//if( DATE_date_to_string( status_now, "%Y%m%d%H%M%S", &date_string) != ITK_ok )
//ifail = ITK_date_to_string (status_now, &date_string );
//if (ifail)
//{
// printf("!*ERROR*!: Failed to get current date time\n");
// goto CLEANUP;
//}
memset(logFileDir, 0, sizeof(logFileDir));
memset(logFileName, 0, sizeof(logFileName));
////get log dir
//sprintf(logFileDir, "%s", getenv("TEMP"));
strcat(logFileDir, fileDir);
printf("\n log file dir: %s\n", logFileDir);
//try to change dir to TC_USER_LOG_DIR
if (chdir(logFileDir) != ITK_ok)
{
//not set TC_USER_LOG_DIR
//log in to default TC_LOG
memset(logFileDir, 0, sizeof(logFileDir));
sprintf(logFileDir, "%s", getenv("TC_LOG"));
printf("\n TC_USER_LOG_DIR invalide, log file dir: %s\n", logFileDir);
if (chdir(logFileDir) != ITK_ok)
{
//still can not change to log dir
printf("!*ERROR*!: Failed to change dir to TC_USER_LOG_DIR\n");
goto CLEANUP;
}
}
//get session_uid to make sure the log file name unique
POM_ask_session(&session_tag);
ITK__convert_tag_to_uid(session_tag, &session_uid);
//get logFileName
//sprintf(logFileName, "%s_%s_%s.log", FunctionName, session_uid, date_string);
sprintf(logFileName, "%s_%s.log", FunctionName, date_string);
printf("log file name: %s\n", logFileName);
*fullname = (char*)MEM_alloc(sizeof(char) * 512);
sprintf(*fullname, "%s\\%s", logFileDir, logFileName);
//for(i = 0; _access((char *)logFileName, 4) == 0; i++)
/*{
memset(logFileName, 0, sizeof(logFileName));
sprintf(logFileName, "%s_%s_%s_%d.log", FunctionName, session_uid, date_string, i);
}
printf("final log file name: %s\n", logFileName);*/
//create log file
logFile = fopen(logFileName, "a");
CLEANUP:
//DOFREE(date_string);
DOFREE(session_uid);
}
/*=============================================================================*
* FUNCTION: WriteLog
* PURPOSE : write log, if debug log File not null, write log message to log File
* INPUT:
* const char* format // debug message string
*
* RETURN:
* void
*============================================================================*/
void WriteLog1(const char* format, ...)
{
va_list arg;
char tmp[MAX_PRINTLINE_LENGTH];
if (logFile)
{
//get the message
memset(tmp, 0, sizeof(tmp));
va_start(arg, format);
vsprintf(tmp, format, arg);
va_end(arg);
//----------print to command window for trace--------//
printf("%s\n", tmp);
//print message to log file
fprintf(logFile, "%s\n", tmp);
fflush(logFile);
}
else
{
printf("*!Error!*: Log File Not Exist\n");
}
}
void WriteLog2(string value) {
if (logFile)
{
fprintf(logFile, "%s\n", value.c_str());
fflush(logFile);
}
else
{
printf("*!Error!*: Log File Not Exist\n");
}
}
void CloseLog1(void)
{
if (logFile)
{
fclose(logFile);
logFile = NULL;
}
}

@ -0,0 +1,64 @@
#pragma once
#include <stdio.h>
#include <Windows.h>
#include <stdlib.h>
//#include <io.h>
#include <time.h>
#include <string>
#include <vector>
#include<algorithm>
#include <epm/epm.h>
#include <epm/epm_toolkit_tc_utils.h>
#include <ict/ict_userservice.h>
#include <tccore/item.h>
#include <ae/ae.h>
#include <tc/folder.h>
#include <tccore/aom.h>
#include <sa/sa.h>
#include <tccore/aom_prop.h>
#include <property/prop_errors.h>
#include <tccore/workspaceobject.h>
#include <tc/preferences.h>
#include <tccore//grm.h>
#include <tccore/grmtype.h>
#include <sa/am.h>
#include <cfm/cfm.h>
#include <bom/bom.h>
#include <tccore/uom.h>
#include <ps/ps.h>
#include <epm/signoff.h>
#include <fclasses/tc_date.h>
#include <objbase.h>
#include <curl/curl.h>
using namespace std;
//#include <tccore/imantype.h>
//#include <textsrv/textserver.h>
//#include <user_exits/epm_toolkit_utils.h>
//#include <ss/ss_errors.h>
//#include <direct.h>
//#include <unistd.h>
#ifdef __cplusplus
extern "C" {
#endif
#define DOFREE(obj) \
{ \
if(obj) \
{ \
MEM_free(obj); \
obj = NULL; \
} \
}
//void ECHO(char* format, ...);
void CreateLogFile(char* FunctionName, char** fullname);
void CreateLogFile2(char* FunctionName, char** fullname, char* fileDir);
void WriteLog1(const char* format, ...);
void WriteLog2(string value);
void CloseLog1(void);
#ifdef __cplusplus
}
#endif

@ -0,0 +1,68 @@
#include <ict/ict_userservice.h>
#include <tccore\item.h>
#include <tccore\aom.h>
#include <tccore\aom_prop.h>
#include "windows.h"
#include <epm/epm.h>
#include <tccore/custom.h>
#include <tccore\aom.h>
#include <time.h>
#include <sstream>
#include <vector>
#include "connor_itk_util.h"
#include "kutil.h"
extern "C" int POM_AM__set_application_bypass(logical bypass);
int connor_set_prop_value(void * returnValue){
char* log_file = NULL;
printf("´´½¨ÈÕÖ¾Îļþ\n");
char* TO_SRM = (char*)malloc(sizeof("connor_set_prop_value"));
strcpy(TO_SRM, "connor_set_prop_value");
CreateLogFile(TO_SRM, &log_file);
int ifail = ITK_ok;
char* uid = NULL;
char* propname = NULL;
char* propvalue = NULL;
USERARG_get_string_argument(&uid);
USERARG_get_string_argument(&propname);
USERARG_get_string_argument(&propvalue);
POM_AM__set_application_bypass(true);
WriteLog1("propname===========================%s \n", propname);
WriteLog1("propvalue===========================%s \n", propvalue);
WriteLog1("uid===========================%s \n", uid);
tag_t tag_instance = NULLTAG;
ITK__convert_uid_to_tag(uid, &tag_instance);
char * object_type = NULL;
tag_t attr=NULLTAG;
ITKCALL(AOM_ask_value_string(tag_instance, "object_type", &object_type));
WriteLog1("object_type===========================%s \n",object_type);
ITKCALL(AOM_lock(tag_instance));
ITKCALL(POM_attr_id_of_attr(propname,object_type,&attr));
ITKCALL(POM_refresh_instances_any_class(1, &tag_instance, POM_modify_lock));
ITKCALL(POM_set_attr_string(1, &tag_instance, attr, propvalue));
ITKCALL(POM_save_instances(1, &tag_instance, true));
ITKCALL(AOM_unlock(tag_instance));
DOFREE(object_type);
POM_AM__set_application_bypass(false);
DOFREE(propname);
DOFREE(propvalue);
CloseLog();
return ITK_ok;
}

@ -0,0 +1,167 @@
#include "kutil.h"
#define debug true
#define ITK_err 919012
#define TC_SEND_ERP_URL "TC_SEND_ERP_URL"
void getBomLinePropertysBom(tag_t top_line,char * top_id,_ConnectionPtr m_pConnection);
int erp_send_bom(EPM_action_message_t msg) {
int ifail = ITK_ok, arg_cnt = 0, att_cnt = 0, bvr_count = 0, count = 0, url_num = 0;
char* arg = NULL, * argflag = NULL, * argvalue = NULL;
char* server_url = NULL;
tag_t* attachments = NULL, task_tag = NULLTAG, rootTask_tag = NULLTAG , bom_window_tag = NULLTAG,* bvr_list = NULLTAG, top_line = NULLTAG;
::CoInitialize(NULL); //初始化OLE/COM库环境
HRESULT hr = NULL;
_ConnectionPtr m_pConnection; // 数据库
_RecordsetPtr m_pRecordset; // 命令
_CommandPtr m_pCommand; // 记录
char* server_address;
int valueNum = 0;
WriteLog(debug, "开始执行传递到ERP (erp_send_bom) ...");
PREF_ask_char_value("TC_SqlServer_Link_ITK", valueNum, &server_address);
if (server_address == NULL) {
EMH_store_error_s1(EMH_severity_error, ITK_err, "未配置数据库参数");
goto end;
}
PREF_ask_char_value("TC_SEND_ERP_URL", url_num, &server_url);
if (server_url == NULL) {
EMH_store_error_s1(EMH_severity_error, ITK_err, "未配置接口地址");
goto end;
}
//拿到当前节点
task_tag = msg.task;
if (task_tag == NULLTAG) {
goto end;
}
ITKCALL(ifail = EPM_ask_root_task(task_tag, &rootTask_tag));
//获取目标下所有对象
ITKCALL(ifail = EPM_ask_attachments(rootTask_tag, EPM_target_attachment, &att_cnt, &attachments));
if (att_cnt == 0) {
goto end;
}
hr = m_pConnection.CreateInstance(_uuidof(Connection));//创建连接对象实例
if (SUCCEEDED(hr))
{
m_pConnection->ConnectionString = (server_address);
//m_pConnection->ConnectionString = ("Provider = SQLOLEDB.1; Persist Security Info = False; User ID =sa; Password=infodba; Initial Catalog = TC13; Data Source =192.168.188.129");
//printf("\n==========================================================\n");
hr = m_pConnection->Open("", "", "", adConnectUnspecified);//打开数据库
if (FAILED(hr))
{
printf("Open Failed!");
return 1;
}
else
{
for (int i = 0; i < att_cnt; i++)
{
tag_t attachment = attachments[i];
char* object_type = NULL;
AOM_ask_value_string(attachment, "object_type", &object_type);
if (!isTypeOf(attachment,"ItemRevision")) {
continue;
}
WriteLog(debug, "开始执行逻辑\n");
ITEM_rev_list_bom_view_revs(attachments[i], &bvr_count, &bvr_list);
if (bvr_count == 0) {
continue;
}
char* item_id = NULL,*object_name = NULL;
AOM_ask_value_string(attachment,"item_id", &item_id);
AOM_ask_value_string(attachment, "object_name", &object_name);
//删除数据库中所有内容
char* deleteSql1 = (char*)calloc(1024, sizeof(char));
char* deleteSql2 = (char*)calloc(1024, sizeof(char));
sprintf(deleteSql1, "delete from BOM_INFOS where puid = '%s'", item_id);
m_pConnection->Execute(_bstr_t(deleteSql1), 0, adCmdText);
sprintf(deleteSql2, "delete from BOM_STRUC where puid = '%s'", item_id);
m_pConnection->Execute(_bstr_t(deleteSql2), 0, adCmdText);
BOM_create_window(&bom_window_tag);
BOM_set_window_top_line_bvr(bom_window_tag, bvr_list[bvr_count - 1], &top_line);
//char* uid_value;
//ITK__convert_tag_to_uid(attachments[i], &uid_value);
//printf("UID为%s\n", uid_value);
char* insertSql1 = (char*)calloc(1024, sizeof(char));
sprintf(insertSql1, "INSERT INTO BOM_INFOS(puid,cid,quantity,cname) VALUES('%s','%s','%s','%s')", item_id, item_id, "1", object_name);
printf("语句为:%s\n", insertSql1);
m_pConnection->Execute(_bstr_t(insertSql1), 0, adCmdText);
insertSql1 = NULL;
DOFREE(insertSql1);
char* insertSql2 = (char*)calloc(1024, sizeof(char));
sprintf(insertSql2, "INSERT INTO BOM_STRUC(puid,pid,cid) VALUES('%s','%s','%s')", item_id, "", item_id);
printf("语句为:%s\n", insertSql2);
m_pConnection->Execute(_bstr_t(insertSql2), 0, adCmdText);
insertSql2 = NULL;
DOFREE(insertSql2);
//遍历BOM写入数据库
getBomLinePropertysBom(top_line,item_id, m_pConnection);
//发送通知给erp
sendErpVersion(server_url, "ProductBom", attachment, item_id);
//CURL* curl;
//CURLcode res;
//curl = curl_easy_init();
//if (curl) {
// char* string_value = (char*)calloc(1024, sizeof(char));
// string uuid = getUUid();
// sprintf(string_value, "%s/api/Send?SysNo=PLM&BillType=%s&BillOp=%s&BillNo=%s&MsgUid=%s", server_url, "ProductBom", "Edit", item_id, uuid.c_str());
// //printf("%s\n", string_value);
// std::cout << string_value << "\n";
// curl_easy_setopt(curl, CURLOPT_URL, string_value);
// res = curl_easy_perform(curl);
// if (CURLE_OK == res) {
// char* ct;
// /* ask for the content-type */
// res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);
// if ((CURLE_OK == res) && ct)
// printf("We received Content-Type: %s\n", ct);
// }
// /* always cleanup */
// curl_easy_cleanup(curl);
//}
}
}
}
end:
return ifail;
}
void getBomLinePropertysBom(tag_t top_line,char * top_id, _ConnectionPtr m_pConnection) {
int count;
tag_t* children_line;
ITKCALL(BOM_line_ask_all_child_lines(top_line, &count, &children_line));
for (int ii = 0; ii < count; ii++)
{
char* item_id = "",
* object_name = "",
*bl_quantity = "1",
*parent_id = "";
ITKCALL(AOM_ask_value_string(children_line[ii], "bl_item_item_id", &item_id));
ITKCALL(AOM_ask_value_string(top_line, "bl_item_item_id", &parent_id));
ITKCALL(AOM_ask_value_string(children_line[ii], "bl_item_object_name", &object_name));
ITKCALL(AOM_ask_value_string(children_line[ii], "bl_quantity", &bl_quantity));
char* insertSql1 = (char*)calloc(1024, sizeof(char));
sprintf(insertSql1, "INSERT INTO BOM_INFOS(puid,cid,quantity,cname) VALUES('%s','%s','%s','%s')", top_id, item_id, bl_quantity, object_name);
printf("语句为:%s\n", insertSql1);
m_pConnection->Execute(_bstr_t(insertSql1), 0, adCmdText);
insertSql1 = NULL;
DOFREE(insertSql1);
char* insertSql2 = (char*)calloc(1024, sizeof(char));
sprintf(insertSql2, "INSERT INTO BOM_STRUC(puid,pid,cid) VALUES('%s','%s','%s')", top_id, parent_id, item_id);
printf("语句为:%s\n", insertSql2);
m_pConnection->Execute(_bstr_t(insertSql2), 0, adCmdText);
insertSql2 = NULL;
DOFREE(insertSql2);
DOFREE(item_id);
DOFREE(object_name);
DOFREE(bl_quantity);
DOFREE(parent_id);
getBomLinePropertysBom(children_line[ii], top_id, m_pConnection);
}
}

@ -0,0 +1,232 @@
#include "kutil.h"
#define debug true
#define ITK_err 919012
#define TC_SEND_ERP_URL "TC_SEND_ERP_URL"
/**
*===============================================================================
* Copyright (c) 2012-2023 CONNOR Ltd.
* Unpublished - All Rights Reserved
*===============================================================================
*File description:
*
* erp_send_bzgx.cpp
*
* BOMERP
*
*
*===============================================================================
DATE Name Description of Change
2023-12-19 lijh modify BOMBUG
2024-01-03 lijh modify ERP_BZGX_STRUCid
===============================================================================
*/
void addBomLinePropertysBom(tag_t top_line, char* top_id, _ConnectionPtr m_pConnection);
int erp_send_bzgx(EPM_action_message_t msg) {
int ifail = ITK_ok, arg_cnt = 0, att_cnt = 0, bvr_count = 0, count = 0, url_num = 0;
char* arg = NULL, * argflag = NULL, * argvalue = NULL;
char* server_url = NULL;
tag_t* attachments = NULL, task_tag = NULLTAG, rootTask_tag = NULLTAG, bom_window_tag = NULLTAG, * bvr_list = NULLTAG, top_line = NULLTAG;
::CoInitialize(NULL); //初始化OLE/COM库环境
HRESULT hr = NULL;
_ConnectionPtr m_pConnection; // 数据库
_RecordsetPtr m_pRecordset; // 命令
_CommandPtr m_pCommand; // 记录
WriteLog(debug, "开始执行传递到ERP (erp_send_bzgx) ...");
char* server_address;
int valueNum = 0;
PREF_ask_char_value("TC_SqlServer_Link_ITK", valueNum, &server_address);
if (server_address == NULL) {
EMH_store_error_s1(EMH_severity_error, ITK_err, "未配置数据库参数");
goto end;
}
PREF_ask_char_value(TC_SEND_ERP_URL, url_num, &server_url);
printf("%s\n", server_url);
if (server_url == NULL) {
EMH_store_error_s1(EMH_severity_error, ITK_err, "未配置接口地址");
goto end;
}
//拿到当前节点
task_tag = msg.task;
if (task_tag == NULLTAG) {
goto end;
}
ITKCALL(ifail = EPM_ask_root_task(task_tag, &rootTask_tag));
//获取目标下所有对象
ITKCALL(ifail = EPM_ask_attachments(rootTask_tag, EPM_target_attachment, &att_cnt, &attachments));
if (att_cnt == 0) {
goto end;
}
hr = m_pConnection.CreateInstance(_uuidof(Connection));//创建连接对象实例
if (SUCCEEDED(hr))
{
m_pConnection->ConnectionString = (server_address);
//m_pConnection->ConnectionString = ("Provider = SQLOLEDB.1; Persist Security Info = False; User ID =sa; Password=infodba; Initial Catalog = TC13; Data Source =192.168.188.129");
//printf("\n==========================================================\n");
hr = m_pConnection->Open("", "", "", adConnectUnspecified);//打开数据库
if (FAILED(hr))
{
printf("Open Failed!");
return 1;
}
else
{
for (int i = 0; i < att_cnt; i++)
{
tag_t attachment = attachments[i];
char* object_type = NULL;
AOM_ask_value_string(attachment, "object_type", &object_type);
if (!isTypeOf(attachment, "ItemRevision")) {
continue;
}
WriteLog(debug, "开始执行逻辑\n");
char* item_id = NULL, * object_name = NULL, * zf6_scphdm = NULL, * zf6_yxxs = NULL, * zf6_bzde = NULL;
//int zf6_sfcg, zf6_sfbzgx, zf6_sfyzgx, zf6_sffj;
//char * zf6_sfcg = NULL, *zf6_sfbzgx = NULL, *zf6_sfyzgx = NULL, *zf6_sffj = NULL;
logical zf6_sfcg, zf6_sfbzgx, zf6_sfyzgx, zf6_sffj;
AOM_ask_value_string(attachment, "item_id", &item_id);
AOM_ask_value_string(attachment, "object_name", &object_name);
AOM_ask_value_string(attachment, "zf6_scphdm", &zf6_scphdm);
AOM_ask_value_string(attachment, "zf6_yxxs", &zf6_yxxs);
AOM_ask_value_string(attachment, "zf6_bzde", &zf6_bzde);
AOM_ask_value_logical(attachment, "zf6_sfcg", &zf6_sfcg);
AOM_ask_value_logical(attachment, "zf6_sfbzgx", &zf6_sfbzgx);
AOM_ask_value_logical(attachment, "zf6_sfyzgx", &zf6_sfyzgx);
AOM_ask_value_logical(attachment, "zf6_sffj", &zf6_sffj);
int one = 0, two = 0, three = 0, four = 0;
if (zf6_sfcg) {
one = 1;
}
if (zf6_sfbzgx) {
two = 1;
}
if (zf6_sfyzgx) {
three = 1;
}
if (zf6_sffj) {
four = 1;
}
//删除数据库中所有内容
char* deleteSql1 = (char*)calloc(1024, sizeof(char));
char* deleteSql2 = (char*)calloc(1024, sizeof(char));
sprintf(deleteSql1, "delete from ERP_BZGX_TABLE where puid = '%s'", item_id);
m_pConnection->Execute(_bstr_t(deleteSql1), 0, adCmdText);
sprintf(deleteSql2, "delete from ERP_BZGX_TABLE where puid = '%s'", item_id);
m_pConnection->Execute(_bstr_t(deleteSql2), 0, adCmdText);
//char* uid_value;
//ITK__convert_tag_to_uid(attachments[i], &uid_value);
//printf("UID为%s\n", uid_value);
char* insertSql1 = (char*)calloc(1024, sizeof(char));
sprintf(insertSql1, "INSERT INTO ERP_BZGX_TABLE(puid,cid,cname,pzf6_scphdm,pzf6_yxxs,pzf6_bzde,pzf6_sfcg,pzf6_sfbzgx,pzf6_sfyzgx,pzf6_sffj,sequence) VALUES('%s','%s','%s','%s','%s','%s',%d,%d,%d,%d,'')",
item_id, item_id, object_name, zf6_scphdm, zf6_yxxs, zf6_bzde, one, two, three, four);
printf("语句为:%s\n", insertSql1);
m_pConnection->Execute(_bstr_t(insertSql1), 0, adCmdText);
//20240103 增加插入之前先删除相同puid的数据
char* deleteSameData = (char*)calloc(1024, sizeof(char));
sprintf(deleteSameData, "delete from ERP_BZGX_STRUC where puid = '%s'", item_id);
m_pConnection->Execute(_bstr_t(deleteSameData), 0, adCmdText);
insertSql1 = NULL;
DOFREE(insertSql1);
char* insertSql2 = (char*)calloc(1024, sizeof(char));
sprintf(insertSql2, "INSERT INTO ERP_BZGX_STRUC(puid,pid,cid) VALUES('%s','%s','%s')", item_id, "", item_id);
printf("语句为:%s\n", insertSql2);
m_pConnection->Execute(_bstr_t(insertSql2), 0, adCmdText);
printf("1\n");
insertSql2 = NULL;
DOFREE(insertSql2);
//遍历标准工序BOM写入数据库
ITEM_rev_list_bom_view_revs(attachments[i], &bvr_count, &bvr_list);
printf("2\n");
//20231219 修改标准工序无子BOM不传递BUG
if (bvr_count == 0) {
printf("--------1-----------\n");
sendErp(server_url, "ActiveCode", attachment, item_id);
continue;
printf("--------2-----------\n");
}
else {
BOM_create_window(&bom_window_tag);
BOM_set_window_top_line_bvr(bom_window_tag, bvr_list[bvr_count - 1], &top_line);
addBomLinePropertysBom(top_line, item_id, m_pConnection);
sendErp(server_url, "ActiveCode", attachment, item_id);
}
}
}
end:
return ifail;
}
}
void addBomLinePropertysBom(tag_t top_line, char* top_id, _ConnectionPtr m_pConnection) {
int count;
tag_t* children_line;
ITKCALL(BOM_line_ask_all_child_lines(top_line, &count, &children_line));
for (int ii = 0; ii < count; ii++)
{
char* item_id = "",
* object_name = "",
* bl_quantity = "1",
* parent_id = "",
* bl_sequence_no = NULL;
ITKCALL(AOM_ask_value_string(children_line[ii], "bl_item_item_id", &item_id));
ITKCALL(AOM_ask_value_string(top_line, "bl_item_item_id", &parent_id));
ITKCALL(AOM_ask_value_string(children_line[ii], "bl_item_object_name", &object_name));
ITKCALL(AOM_ask_value_string(children_line[ii], "bl_quantity", &bl_quantity));
tag_t partItemRevision = NULLTAG;
AOM_ask_value_tag(children_line[ii], "bl_line_object", &partItemRevision);
char * zf6_scphdm = NULL, * zf6_yxxs = NULL, * zf6_bzde = NULL;
logical zf6_sfcg, zf6_sfbzgx, zf6_sfyzgx, zf6_sffj;
AOM_ask_value_string(children_line[ii], "bl_sequence_no", &bl_sequence_no);
AOM_ask_value_string(partItemRevision, "zf6_scphdm", &zf6_scphdm);
AOM_ask_value_string(partItemRevision, "zf6_yxxs", &zf6_yxxs);
AOM_ask_value_string(partItemRevision, "zf6_bzde", &zf6_bzde);
AOM_ask_value_logical(partItemRevision, "zf6_sfcg", &zf6_sfcg);
AOM_ask_value_logical(partItemRevision, "zf6_sfbzgx", &zf6_sfbzgx);
AOM_ask_value_logical(partItemRevision, "zf6_sfyzgx", &zf6_sfyzgx);
AOM_ask_value_logical(partItemRevision, "zf6_sffj", &zf6_sffj);
int one = 0, two = 0, three = 0, four = 0;
if (zf6_sfcg) {
one = 1;
}
if (zf6_sfbzgx) {
two = 1;
}
if (zf6_sfyzgx) {
three = 1;
}
if (zf6_sffj) {
four = 1;
}
char* insertSql1 = (char*)calloc(1024, sizeof(char));
sprintf(insertSql1, "INSERT INTO ERP_BZGX_TABLE(puid,cid,cname,pzf6_scphdm,pzf6_yxxs,pzf6_bzde,pzf6_sfcg,pzf6_sfbzgx,pzf6_sfyzgx,pzf6_sffj,sequence) VALUES('%s','%s','%s','%s','%s','%s',%d,%d,%d,%d,'%s')",
item_id, item_id, object_name, zf6_scphdm, zf6_yxxs, zf6_bzde, one, two, three, four, bl_sequence_no);
printf("语句为:%s\n", insertSql1);
m_pConnection->Execute(_bstr_t(insertSql1), 0, adCmdText);
insertSql1 = NULL;
DOFREE(insertSql1);
char* insertSql2 = (char*)calloc(1024, sizeof(char));
sprintf(insertSql2, "INSERT INTO ERP_BZGX_STRUC (puid,pid,cid) VALUES('%s','%s','%s')", top_id, parent_id, item_id);
printf("语句为:%s\n", insertSql2);
m_pConnection->Execute(_bstr_t(insertSql2), 0, adCmdText);
insertSql2 = NULL;
DOFREE(insertSql2);
DOFREE(item_id);
DOFREE(object_name);
DOFREE(bl_quantity);
DOFREE(parent_id);
//addBomLinePropertysBom(children_line[ii], top_id, m_pConnection);
}
}

@ -0,0 +1,132 @@
#include "kutil.h"
#define debug true
#define ITK_err 919012
#define TC_SEND_ERP_URL "TC_SEND_ERP_URL"
int erp_send_gx(EPM_action_message_t msg) {
int ifail = ITK_ok, arg_cnt = 0, att_cnt = 0, bvr_count = 0, count = 0, url_num = 0;
char* arg = NULL, * argflag = NULL, * argvalue = NULL;
char* server_url = NULL;
tag_t* attachments = NULL, task_tag = NULLTAG, rootTask_tag = NULLTAG;
::CoInitialize(NULL); //初始化OLE/COM库环境
HRESULT hr = NULL;
_ConnectionPtr m_pConnection; // 数据库
_RecordsetPtr m_pRecordset; // 命令
_CommandPtr m_pCommand; // 记录
WriteLog(debug, "开始执行传递到ERP (erp_send_gx) ...");
PREF_ask_char_value(TC_SEND_ERP_URL, url_num, &server_url);
printf("%s\n", server_url);
if (server_url == NULL) {
EMH_store_error_s1(EMH_severity_error, ITK_err, "未配置接口地址");
goto end;
}
char* server_address;
int valueNum = 0;
PREF_ask_char_value("TC_SqlServer_Link_ITK", valueNum, &server_address);
if (server_address == NULL) {
EMH_store_error_s1(EMH_severity_error, ITK_err, "未配置数据库参数");
goto end;
}
//拿到当前节点
task_tag = msg.task;
if (task_tag == NULLTAG) {
goto end;
}
ITKCALL(ifail = EPM_ask_root_task(task_tag, &rootTask_tag));
//获取目标下所有对象
ITKCALL(ifail = EPM_ask_attachments(rootTask_tag, EPM_target_attachment, &att_cnt, &attachments));
if (att_cnt == 0) {
goto end;
}
hr = m_pConnection.CreateInstance(_uuidof(Connection));//创建连接对象实例
if (SUCCEEDED(hr))
{
m_pConnection->ConnectionString = (server_address);
hr = m_pConnection->Open("", "", "", adConnectUnspecified);//打开数据库
}
if (FAILED(hr))
{
printf("Open Failed!");
return 1;
}
else
{
for (int i = 0; i < att_cnt; i++)
{
tag_t attachment = attachments[i];
char* object_type = NULL;
AOM_ask_value_string(attachment, "object_type", &object_type);
if (!isTypeOf(attachment, "ItemRevision") || strcmp("ZF6_GXRevision", object_type) != 0) {
continue;
}
char* item_id;
AOM_ask_value_string(attachment, "item_id", &item_id);
//获取对象被使用的是所有上级父物料对象
//参数说明:对象,层数,上级父物料数量,层数数组,上级父物料数组
int n_parents = 0, * levels;
tag_t* parents;
PS_where_used_all(attachment, PS_where_used_all_levels, &n_parents, &levels, &parents);
char* gylx_id = "";
for (int k = 0; k < n_parents; k++)
{
char* type;
AOM_ask_value_string(parents[k], "object_type", &type);
if (strcmp("ZF6_GYLXRevision", type) == 0) {
//AOM_ask_value_string(parents[k], "item_id", &gylx_id);
POM_tag_to_uid(parents[k], &gylx_id);
break;
}
}
//更新值ERP_GYFA_TABLE
char* pzf6_bzde = "",
* pzf6_scphdm = "",
pzf6_sfbzgx[12] = { 0 },
pzf6_sfcg[12] = { 0 },
pzf6_sffj[12] = { 0 },
pzf6_sfyzgx[12] = { 0 },
* pzf6_yxxs = "";
ITKCALL(AOM_ask_value_string(attachment, "zf6_bzde", &pzf6_bzde));
ITKCALL(AOM_ask_value_string(attachment, "zf6_scphdm", &pzf6_scphdm));
ITKCALL(AOM_ask_value_string(attachment, "zf6_yxxs", &pzf6_yxxs));
logical zf6_sfbzgx, zf6_sfcg, zf6_sffj, zf6_sfyzgx;
ITKCALL(AOM_ask_value_logical(attachment, "zf6_sfbzgx", &zf6_sfbzgx));
ITKCALL(AOM_ask_value_logical(attachment, "zf6_sffj", &zf6_sffj));
ITKCALL(AOM_ask_value_logical(attachment, "zf6_sfyzgx", &zf6_sfyzgx));
ITKCALL(AOM_ask_value_logical(attachment, "zf6_sfcg", &zf6_sfcg));
if (zf6_sfbzgx) {
strcat(pzf6_sfbzgx, "1");
}
else {
strcat(pzf6_sfbzgx, "0");
}
if (zf6_sffj) {
strcat(pzf6_sffj, "1");
}
else {
strcat(pzf6_sffj, "0");
}
if (zf6_sfyzgx) {
strcat(pzf6_sfyzgx, "1");
}
else {
strcat(pzf6_sfyzgx, "0");
}
if (zf6_sfcg) {
strcat(pzf6_sfcg, "1");
}
else {
strcat(pzf6_sfcg, "0");
}
char* updateSql2 = (char*)calloc(1024, sizeof(char));
sprintf(updateSql2,"UPDATE ERP_GYFA_TABLE SET pzf6_bzde = '%s',pzf6_scphdm = '%s', pzf6_sfbzgx = '%s', pzf6_sfcg = '%s', pzf6_sffj = '%s', pzf6_sfyzgx = '%s', pzf6_yxxs = '%s', where sid = '%s' and pitem_id = '%s'"
, pzf6_bzde, pzf6_scphdm, pzf6_sfbzgx, pzf6_sfcg, pzf6_sffj, pzf6_sfyzgx, pzf6_yxxs, gylx_id, item_id);
printf("语句为:%s\n", updateSql2);
m_pConnection->Execute(_bstr_t(updateSql2), 0, adCmdText);
updateSql2 = NULL;
DOFREE(updateSql2);
sendErpVersion(server_url, "ActiveCode", attachment, item_id);
}
}
end:
return ifail;
}

@ -0,0 +1,350 @@
#include "kutil.h"
#include "connor_itk_util.h"
#define debug true
#define ITK_err 919012
#define TC_SEND_ERP_URL "TC_SEND_ERP_URL"
void putBomLinePropertysBom(tag_t top_line, char* top_id, _ConnectionPtr m_pConnection, char* top_name, char* pid, char* pname, tag_t top_rev);
int erp_send_gylx(EPM_action_message_t msg) {
char* log_file = NULL;
printf("创建日志文件\n");
char* TO_SRM = (char*)malloc(sizeof("erp_send_gylx"));
strcpy(TO_SRM, "erp_send_gylx");
CreateLogFile(TO_SRM, &log_file);
int ifail = ITK_ok, arg_cnt = 0, arg_cnt1 = 0, att_cnt = 0, bvr_count = 0, count = 0, url_num = 0;
char* arg = NULL, *arg1 = NULL,* argflag = NULL, * argvalue = NULL;
char* server_url = NULL;
tag_t* attachments = NULL, task_tag = NULLTAG, rootTask_tag = NULLTAG, bom_window_tag = NULLTAG, * bvr_list = NULLTAG, top_line = NULLTAG;
::CoInitialize(NULL); //初始化OLE/COM库环境
HRESULT hr = NULL;
_ConnectionPtr m_pConnection; // 数据库
_RecordsetPtr m_pRecordset; // 命令
_CommandPtr m_pCommand; // 记录
WriteLog(debug, "开始执行传递到ERP (erp_send_bzgx) ...");
char* server_address;
int valueNum = 0;
PREF_ask_char_value("TC_SqlServer_Link_ITK", valueNum, &server_address);
if (server_address == NULL) {
EMH_store_error_s1(EMH_severity_error, ITK_err, "未配置数据库参数");
goto end;
}
PREF_ask_char_value(TC_SEND_ERP_URL, url_num, &server_url);
printf("%s\n", server_url);
if (server_url == NULL) {
EMH_store_error_s1(EMH_severity_error, ITK_err, "未配置接口地址");
goto end;
}
//拿到当前节点
task_tag = msg.task;
if (task_tag == NULLTAG) {
goto end;
}
ITKCALL(ifail = EPM_ask_root_task(task_tag, &rootTask_tag));
//获取流程参数
char* getType = "";
arg_cnt1 = TC_number_of_arguments(msg.arguments);
if (arg_cnt1 > 0) {
for (int j = 0; j < arg_cnt1; j++) {
arg1 = TC_next_argument(msg.arguments);
char* argflag1, * argvalue1;
ITKCALL(ITK_ask_argument_named_value((const char*)arg1, &argflag1, &argvalue1));
if (strcmp(argflag1, "sub_include_type") == 0) {
if (argvalue1 != NULL)
{
WriteLog(debug, "BOM中未包含指定类型\n");
//printf("获取的值%s:", argvalue1);
WriteLog(debug, "获取的值%s\n", argvalue1);
getType = argvalue1;
}
}
}
}
//获取目标下所有对象
ITKCALL(ifail = EPM_ask_attachments(rootTask_tag, EPM_target_attachment, &att_cnt, &attachments));
if (att_cnt == 0) {
goto end;
}
hr = m_pConnection.CreateInstance(_uuidof(Connection));//创建连接对象实例
if (SUCCEEDED(hr))
{
m_pConnection->ConnectionString = (server_address);
//m_pConnection->ConnectionString = ("Provider = SQLOLEDB.1; Persist Security Info = False; User ID =sa; Password=infodba; Initial Catalog = TC13; Data Source =192.168.188.129");
//printf("\n==========================================================\n");
hr = m_pConnection->Open("", "", "", adConnectUnspecified);//打开数据库
if (FAILED(hr))
{
printf("Open Failed!");
return 1;
}
else
{
for (int i = 0; i < att_cnt; i++)
{
tag_t attachment = attachments[i];
char* object_type = NULL;
AOM_ask_value_string(attachment, "object_type", &object_type);
if (!isTypeOf(attachment, "ItemRevision") || strcmp("ZF6_GYLXRevision", object_type) != 0) {
continue;
}
WriteLog(debug, "开始执行逻辑\n");
char* item_id = NULL, * object_name, * pid = "", * pname = "";
//AOM_ask_value_string(attachment, "item_id", &item_id);
POM_tag_to_uid(attachment, &item_id);
AOM_ask_value_string(attachment, "object_name", &object_name);
//获取对象被引用的是所有上级父物料对象
//参数说明:对象,层数,上级父物料数量,层数数组,上级父物料数组,引用的关系名称
int iCount = 0, * iRetLevels;
tag_t* tag_temp;
char** sRelationNames = NULL;
//判断标识
bool flag = false;
WSOM_where_referenced2(attachment, 1, &iCount, &iRetLevels, &tag_temp, &sRelationNames);
//把工艺路线和对象写到数据库
for (int k = 0; k < iCount; k++)
{
char* type;
AOM_ask_value_string(tag_temp[k], "object_type", &type);
if (strcmp("ZF6_LBJRevision", type) == 0 || strcmp("ZF6_YRRevision", type) == 0 || strcmp("ZF6_YCLRevision", type) == 0) {
AOM_ask_value_string(tag_temp[k], "item_id", &pid);
AOM_ask_value_string(tag_temp[k], "object_name", &pname);
flag = true;
break;
}
}
//判断是否有引用
if (!flag) {
EMH_store_error_s1(EMH_severity_error, EMH_USER_error_base, "未关联物料");
return -1;
}
//修改 判断当前是否包含指定类型的type
//创建BOMWindow
int bomcount;
tag_t top_line = NULLTAG, window = NULLTAG; tag_t* children_line = NULLTAG;
printf("创建BOMWindow\n");
ITKCALL(BOM_create_window(&window));
//设置顶层BOM
printf("设置顶层BOM\n");
ITKCALL(BOM_set_window_top_line(window, NULLTAG, attachment, NULLTAG, &top_line));
ITKCALL(BOM_line_ask_all_child_lines(top_line, &bomcount, &children_line));
char* object_name1 = "";
ITKCALL(AOM_ask_value_string(top_line, "bl_item_object_string", &object_name1));
printf("bom数量为%d\n", bomcount);
if (bomcount == 0) {
string aname = object_name1;
string error = "当前BOM对象"+ aname +"为空,未包含指定类型";
EMH_store_error_s2(EMH_severity_error, ITK_err, "提示", error.c_str());
return 1;
}
else {
WriteLog(debug, "判断当前是否包含指定类型的type\n");
if (strcmp(getType,"")!=0) {
int count;
char* childType;
tag_t* children_line;
//string resultStr = getType;
ITKCALL(BOM_line_ask_all_child_lines(top_line, &count, &children_line));
for (int j = 0; j < count; j++) {
tag_t child_tag = children_line[j];
ITKCALL(AOM_ask_value_string(child_tag, "bl_item_object_type", &childType));
if (strstr(getType, childType) == nullptr) {
char* object_name = "";
ITKCALL(AOM_ask_value_string(top_line, "bl_item_object_string", &object_name));
WriteLog(debug, "BOM中未包含指定类型%s\n", object_name);
string objectname = object_name;
string error = "BOM中未包含指定类型" + objectname;
EMH_store_error_s2(EMH_severity_error, ITK_err, "提示", error.c_str());
return 1;
}
}
}
}
//遍历工艺路线写入数据库
ITEM_rev_list_bom_view_revs(attachment, &bvr_count, &bvr_list);
BOM_create_window(&bom_window_tag);
BOM_set_window_top_line_bvr(bom_window_tag, bvr_list[bvr_count - 1], &top_line);
printf("开始遍历BOM!!\n");
putBomLinePropertysBom(top_line, item_id, m_pConnection, object_name, pid, pname, attachments[i]);
sendErp(server_url, "CraftCode", attachment, item_id);
}
}
CloseLog();
end:
CloseLog();
return ifail;
}
}
void putBomLinePropertysBom(tag_t top_line, char* top_id, _ConnectionPtr m_pConnection, char* top_name, char* pid, char* pname, tag_t top_rev) {
//工艺路线属性
int num = 0;
logical master;
char** zf6_syb, * localization_statuses;
AOM_UIF_ask_localized_value_strings(top_rev, "zf6_zfsyb", "zh_CN", &num, &zf6_syb, &localization_statuses, &master);
char* zf6_dzxs,
* zf6_gd,
* zf6_gylx1,
* zf6_gylx2,
* zf6_gylx3,
* zf6_gylx4,
* zf6_gylx5;
logical zf6_sfzgy;
char pzf6_sfzgy[12] = { 0 };
AOM_ask_value_string(top_rev, "zf6_dzxs", &zf6_dzxs);
AOM_ask_value_string(top_rev, "zf6_gd", &zf6_gd);
AOM_ask_value_string(top_rev, "zf6_gylx1", &zf6_gylx1);
AOM_ask_value_string(top_rev, "zf6_gylx2", &zf6_gylx2);
AOM_ask_value_string(top_rev, "zf6_gylx3", &zf6_gylx3);
AOM_ask_value_string(top_rev, "zf6_gylx4", &zf6_gylx4);
AOM_ask_value_string(top_rev, "zf6_gylx5", &zf6_gylx5);
ITKCALL(AOM_ask_value_logical(top_rev, "zf6_sfzgy", &zf6_sfzgy));
if (zf6_sfzgy) {
strcat(pzf6_sfzgy, "1");
}
else {
strcat(pzf6_sfzgy, "0");
}
int count;
tag_t* children_line, child_rev_tag;
ITKCALL(BOM_line_ask_all_child_lines(top_line, &count, &children_line));
for (int ii = 0; ii < count; ii++)
{
char* item_id = "",
* object_name = "",
* bl_sequence_no = "",
* parent_id = "",
* parent_name = "",
* product_line = "",
* erpID = "",
* object_type = "";
int sequence_no = 0;
ITKCALL(AOM_ask_value_string(children_line[ii], "bl_item_item_id", &item_id));
//ITKCALL(AOM_ask_value_string(top_line, "bl_item_item_id", &parent_id));
POM_tag_to_uid(top_rev, &parent_id);
ITKCALL(AOM_ask_value_string(top_line, "bl_rev_object_name", &parent_name));
ITKCALL(AOM_ask_value_string(children_line[ii], "bl_item_object_name", &object_name));
ITKCALL(AOM_ask_value_string(children_line[ii], "bl_sequence_no", &bl_sequence_no));
sequence_no = atoi(bl_sequence_no);
ITKCALL(AOM_ask_value_string(children_line[ii], "bl_item_object_type", &object_type));
ITKCALL(AOM_ask_value_tag(children_line[ii], "bl_line_object", &child_rev_tag));
char* pzf6_bzde = "",
* pzf6_scphdm = "",
pzf6_sfbzgx[12] = { 0 },
pzf6_sfcg[12] = { 0 },
pzf6_sffj[12] = { 0 },
pzf6_sfyzgx[12] = { 0 },
* pzf6_yxxs = "";
ITKCALL(AOM_ask_value_string(child_rev_tag, "zf6_bzde", &pzf6_bzde));
ITKCALL(AOM_ask_value_string(child_rev_tag, "zf6_scphdm", &pzf6_scphdm));
ITKCALL(AOM_ask_value_string(child_rev_tag, "zf6_yxxs", &pzf6_yxxs));
logical zf6_sfbzgx, zf6_sfcg, zf6_sffj, zf6_sfyzgx;
ITKCALL(AOM_ask_value_logical(child_rev_tag, "zf6_sfbzgx", &zf6_sfbzgx));
ITKCALL(AOM_ask_value_logical(child_rev_tag, "zf6_sffj", &zf6_sffj));
ITKCALL(AOM_ask_value_logical(child_rev_tag, "zf6_sfyzgx", &zf6_sfyzgx));
ITKCALL(AOM_ask_value_logical(child_rev_tag, "zf6_sfcg", &zf6_sfcg));
if (zf6_sfbzgx) {
strcat(pzf6_sfbzgx, "1");
}
else {
strcat(pzf6_sfbzgx, "0");
}
if (zf6_sffj) {
strcat(pzf6_sffj, "1");
}
else {
strcat(pzf6_sffj, "0");
}
if (zf6_sfyzgx) {
strcat(pzf6_sfyzgx, "1");
}
else {
strcat(pzf6_sfyzgx, "0");
}
if (zf6_sfcg) {
strcat(pzf6_sfcg, "1");
}
else {
strcat(pzf6_sfcg, "0");
}
if (strcmp("ZF6_GX", object_type) == 0) {
int line_count = 0;
tag_t* product_children_line;
ITKCALL(BOM_line_ask_all_child_lines(children_line[ii], &line_count, &product_children_line));
if (line_count == 1) {
tag_t product_tag; char* product_type;
ITKCALL(AOM_ask_value_tag(product_children_line[0], "bl_line_object", &product_tag));
ITKCALL(AOM_ask_value_string(product_tag, "object_type", &product_type));
if (strcmp("ZF6_SCXRevision", product_type) == 0) {
ITKCALL(AOM_ask_value_string(product_tag, "zf6_erpid", &erpID));
ITKCALL(AOM_ask_value_string(product_tag, "object_name", &product_line));
}
}
}
//删除数据库中所有内容
char* deleteSql1 = (char*)calloc(1024, sizeof(char));
char* deleteSql2 = (char*)calloc(1024, sizeof(char));
char* deleteSql3 = (char*)calloc(1024, sizeof(char));
sprintf(deleteSql1, "delete from ERP_GYLX_TABLE where pid = '%s' and cid='%s'", parent_id, item_id);
m_pConnection->Execute(_bstr_t(deleteSql1), 0, adCmdText);
//sprintf(deleteSql2, "delete from ERP_GYFA_TABLE where sid = '%s' and pitem_id='%s'", top_id, item_id);
sprintf(deleteSql2, "delete from ERP_GYFA_TABLE where pitem_id='%s'", item_id);//20231016删除只根据item_id来判断
m_pConnection->Execute(_bstr_t(deleteSql2), 0, adCmdText);
//20240521 增加通过pid + pzf6_zfsyb+pobject_name + sid删除
sprintf(deleteSql3, "delete from ERP_GYFA_TABLE where pid='%s' and pzf6_zfsyb='%s' and pitem_id='%s' and sid='%s'", pid, zf6_syb[0], item_id,top_id);
m_pConnection->Execute(_bstr_t(deleteSql3), 0, adCmdText);
printf("写入数据到数据库\n");
char* insertSql1 = (char*)calloc(1024, sizeof(char));
sprintf(insertSql1, "INSERT INTO ERP_GYLX_TABLE(pid,pname,cid,cname,sequence,erpID,product_line) VALUES('%s','%s','%s','%s',%d,'%s','%s')",
parent_id, parent_name, item_id, object_name, sequence_no, erpID, product_line);
printf("语句为:%s\n", insertSql1);
m_pConnection->Execute(_bstr_t(insertSql1), 0, adCmdText);
WriteLog1("ERP_GYLX_TABLE传递数据%s\n", insertSql1);
insertSql1 = NULL;
DOFREE(insertSql1);
//, [pitem_id]
//, [pobject_name]
// , [pzf6_bzde]
// , [pzf6_scphdm]
// , [pzf6_sfbzgx]
// , [pzf6_sfcg]
// , [pzf6_sffj]
// , [pzf6_sfyzgx]
// , [pzf6_yxxs]
char* insertSql2 = (char*)calloc(1024, sizeof(char));
sprintf(insertSql2, "INSERT INTO ERP_GYFA_TABLE(sid,sname,pid,pname,pitem_id,pobject_name,pzf6_bzde,pzf6_scphdm,pzf6_sfbzgx,pzf6_sfcg,pzf6_sffj,pzf6_sfyzgx,pzf6_yxxs,pzf6_dzxs,pzf6_zfsyb,pzf6_gd,pzf6_gylx1,pzf6_gylx2,pzf6_gylx3,pzf6_gylx4,pzf6_gylx5,pzf6_sfzgy) VALUES('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')"
, top_id, top_name, pid, pname, item_id, object_name, pzf6_bzde, pzf6_scphdm, pzf6_sfbzgx, pzf6_sfcg, pzf6_sffj, pzf6_sfyzgx, pzf6_yxxs
, zf6_dzxs, zf6_syb[0], zf6_gd, zf6_gylx1, zf6_gylx2, zf6_gylx3, zf6_gylx4, zf6_gylx5, pzf6_sfzgy);
printf("语句为:%s\n", insertSql2);
m_pConnection->Execute(_bstr_t(insertSql2), 0, adCmdText);
WriteLog1("ERP_GYFA_TABLE传递数据%s\n", insertSql2);
//删除历史数据
char* deleteSql4 = (char*)calloc(1024, sizeof(char));
sprintf(deleteSql4, "delete from ERP_GYFA_TABLE where pid='%s' and pzf6_zfsyb='%s' and sid !='%s'", pid, zf6_syb[0],top_id);
m_pConnection->Execute(_bstr_t(deleteSql4), 0, adCmdText);
insertSql2 = NULL;
DOFREE(insertSql2);
DOFREE(item_id);
DOFREE(object_name);
DOFREE(bl_sequence_no);
DOFREE(parent_id);
DOFREE(parent_name);
//putBomLinePropertysBom(children_line[ii], top_id, m_pConnection);
}
}

@ -0,0 +1,98 @@
#include "kutil.h"
#define debug true
#define ITK_err 919012
#define TC_SEND_ERP_URL "TC_SEND_ERP_URL"
int erp_send_part(EPM_action_message_t msg) {
int ifail = ITK_ok, arg_cnt = 0, att_cnt = 0, bvr_count = 0, count = 0,url_num = 0;
char* arg = NULL, * argflag = NULL, * argvalue = NULL;
char* server_url = NULL;
tag_t* attachments = NULL, task_tag = NULLTAG, rootTask_tag = NULLTAG;
string type;
vector<string> types;
WriteLog(debug, "开始执行传递到ERP (erp_send_part) ...");
arg_cnt = TC_number_of_arguments(msg.arguments);
if (arg_cnt > 0) {
for (int i = 0; i < arg_cnt; i++) {
arg = TC_next_argument(msg.arguments);
ITKCALL(ifail = ITK_ask_argument_named_value(arg, &argflag, &argvalue));
if (strcmp(argflag, "type") == 0) {
type.assign(argvalue);
}
MEM_free(argflag);
MEM_free(argvalue);
}
}
else {
EMH_store_error_s1(EMH_severity_error, ITK_err, "未配置流程参数");
ifail = 1;
goto end;
}
{
Split(type, ",", types);
if (types.size() == 0) {
EMH_store_error_s1(EMH_severity_error, ITK_err, "未配置流程参数:-type");
goto end;
}
}
//PREF_ask_char_value("TC_SqlServer_Link_ITK", address_num, &server_address);
PREF_ask_char_value(TC_SEND_ERP_URL, url_num, &server_url);
printf("%s\n", server_url);
if (server_url == NULL) {
EMH_store_error_s1(EMH_severity_error, ITK_err, "未配置接口地址");
goto end;
}
//拿到当前节点
task_tag = msg.task;
if (task_tag == NULLTAG) {
goto end;
}
ITKCALL(ifail = EPM_ask_root_task(task_tag, &rootTask_tag));
//获取目标下所有对象
ITKCALL(ifail = EPM_ask_attachments(rootTask_tag, EPM_target_attachment, &att_cnt, &attachments));
if (att_cnt == 0) {
goto end;
}
for (int i = 0; i < att_cnt; i++)
{
tag_t attachment = attachments[i];
for each (string type in types)
{
if (!isTypeOf(attachment, type.c_str()))
{
continue;
}
char* item_id;
AOM_ask_value_string(attachment,"item_id",&item_id);
sendErpVersion(server_url, "ProductCode", attachment, item_id);
//CURL* curl;
//CURLcode res;
//curl = curl_easy_init();
//if (curl) {
// char* string_value = (char*)calloc(1024, sizeof(char));
// string uuid = getUUid();
// sprintf(string_value, "%s/api/Send?SysNo=PLM&BillType=%s&BillOp=%s&BillNo=%s&MsgUid=%s", server_url,"ProductCode", "Edit", item_id, uuid.c_str());
// //printf("%s\n", string_value);
// std::cout << string_value << "\n";
// curl_easy_setopt(curl, CURLOPT_URL, string_value);
// res = curl_easy_perform(curl);
// if (CURLE_OK == res) {
// char* ct;
// /* ask for the content-type */
// res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);
// if ((CURLE_OK == res) && ct)
// printf("We received Content-Type: %s\n", ct);
// }
// /* always cleanup */
// curl_easy_cleanup(curl);
//}
}
}
end:
return ifail;
}

@ -0,0 +1,14 @@
#pragma once
#include <epm/epm.h>
int erp_send_part(EPM_action_message_t msg);
int erp_send_bom(EPM_action_message_t msg);
int erp_send_gx(EPM_action_message_t msg);
int erp_send_bzgx(EPM_action_message_t msg);
int erp_send_gylx(EPM_action_message_t msg);
int ZF_SendPartToERP(EPM_action_message_t msg);
int ZF_SendPartBOMToERP(EPM_action_message_t msg);
int ZF_SendGYLXToERP(EPM_action_message_t msg);
int ZF_SendBZGXToERP(EPM_action_message_t msg);
int connor_set_prop_value(void* returnValue);

@ -0,0 +1,439 @@
#pragma warning (disable: 4996)
#include "kutil.h"
#include <mld/logging/TcMainLogger.hxx>
#include <chrono>
#include <fstream>
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
using namespace std::chrono;
using namespace Teamcenter::Logging;
using Teamcenter::Main::logger;
extern "C" int POM_AM__set_application_bypass(logical bypass);
#define MAX_PATH_LENGTH 200
#define MAX_PRINTLINE_LENGTH 400000
Logger* klog = NULL;
string GbkToUtf8(const char* src_str) {
int len = MultiByteToWideChar(CP_ACP, 0, src_str, -1, NULL, 0);
wchar_t* wstr = new wchar_t[len + 1];
memset(wstr, 0, len + 1);
MultiByteToWideChar(CP_ACP, 0, src_str, -1, wstr, len);
len = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL);
char* str = new char[len + 1];
memset(str, 0, len + 1);
WideCharToMultiByte(CP_UTF8, 0, wstr, -1, str, len, NULL, NULL);
string strTemp = str;
if (wstr) delete[] wstr;
if (str) delete[] str;
return strTemp;
}
int WriteToFile(FILE* file, const char* text)
{
if (!file) {
return ITK_ok;
}
va_list arg;
char* time_str = getTime();
fprintf(file, "[%s] - %s\r\n", time_str, text);
fflush(file);
free(time_str);
return ITK_ok;
}
int getCurrentMilliSeconds() {
unsigned __int64 now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
std::cout << now << std::endl;
return now % 1000;
}
char* getTime() {
time_t now;
struct tm* p;
char date_string[30];
time(&now);
//logFile = NULL;
//current_time(&status_now);
p = localtime(&now);
memset(date_string, 0, sizeof(date_string));
sprintf(date_string, "%4d-%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);
char* dateC = (char*)malloc(sizeof(char) * (strlen(date_string) + 1));
strcpy(dateC, date_string);
return dateC;
}
int ReportError(logical is_utf8, int err_code, const char* format, ...)
{
va_list arg;
char tmp[8000];
memset(tmp, 0, sizeof(tmp));
va_start(arg, format);
vsprintf(tmp, format, arg);
va_end(arg);
if (is_utf8) {
printf("%s\n", G2U(tmp));
ITKCALL(EMH_store_error_s1(EMH_severity_error, err_code, G2U(tmp)));
}
else {
printf("%s\n", tmp);
ITKCALL(EMH_store_error_s1(EMH_severity_error, err_code, tmp));
}
return err_code;
}
void StartLog(string str) {
klog = Logger::getLogger(str);
}
void CloseLog() {
if (klog) {
klog = NULL;
}
}
int Log(IFail ex) {
cout << ex.getMessage() << endl;
cout << "error " << ex.ifail() << endl;
if (klog) {
klog->error(ex.ifail(), ex.getMessage());
}
return ex.ifail();
}
void Log(const char* format, ...)
{
va_list arg;
char tmp[8000];
memset(tmp, 0, sizeof(tmp));
va_start(arg, format);
vsprintf(tmp, format, arg);
va_end(arg);
cout << tmp << endl;
if (klog) {
klog->info(tmp);
}
//TC_write_syslog(format);
}
void set_bypass(logical bypass)
{
POM_AM__set_application_bypass(bypass);
}
void Split(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 = "";
int len = spliter.size();
while (strArg.size() > 0)
{
index0 = strArg.find(spliter);
if (index0 != string::npos)
{
one_arg = strArg.substr(0, index0);
strArg = strArg.substr(index0 + len);
ans.push_back(one_arg);
if (strArg.size() == 0) {
ans.push_back(strArg);
}
}
else
{
ans.push_back(strArg);
break;
}
}
}
logical inArray(vector<string> types, string type) {
int len = types.size();
for (int i = 0; i < len; i++) {
if (strcmp(types[i].c_str(), type.c_str()) == 0) {
return true;
}
}
return false;
}
string trim(const string& str)
{
size_t first = str.find_first_not_of(' ');
if (string::npos == first)
{
return str;
}
size_t last = str.find_last_not_of(' ');
string res = str.substr(first, (last - first + 1));
last = res.find("\n");
if (last == res.size() - 1) {
res = res.substr(0, res.size() - 1);
}
last = res.find("\r");
if (last == res.size() - 1) {
res = res.substr(0, res.size() - 1);
}
return res;
}
char* U2G(const char* utf8)
{
int len = MultiByteToWideChar(CP_UTF8, 0, utf8, -1, NULL, 0);
wchar_t* wstr = new wchar_t[len + 1];
memset(wstr, 0, len + 1);
MultiByteToWideChar(CP_UTF8, 0, utf8, -1, wstr, len);
len = WideCharToMultiByte(CP_ACP, 0, wstr, -1, NULL, 0, NULL, NULL);
char* str = new char[len + 1];
memset(str, 0, len + 1);
WideCharToMultiByte(CP_ACP, 0, wstr, -1, str, len, NULL, NULL);
if (wstr) delete[] wstr;
return str;
}
char* G2U(const char* gb2312)
{
int len = MultiByteToWideChar(CP_ACP, 0, gb2312, -1, NULL, 0);
wchar_t* wstr = new wchar_t[len + 1];
memset(wstr, 0, len + 1);
MultiByteToWideChar(CP_ACP, 0, gb2312, -1, wstr, len);
len = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL);
char* str = new char[len + 1];
memset(str, 0, len + 1);
WideCharToMultiByte(CP_UTF8, 0, wstr, -1, str, len, NULL, NULL);
if (wstr) delete[] wstr;
return str;
}
void WriteLog(logical debug, const char* format, ...)
{
va_list arg;
char tmp[MAX_PRINTLINE_LENGTH];
char date_string[MAX_PATH_LENGTH];
time_t now;
struct tm* p;
//get the message
memset(tmp, 0, sizeof(tmp));
va_start(arg, format);
vsprintf(tmp, format, arg);
va_end(arg);
//----------print to command window for trace--------//
//printf("%s\n", tmp);
printf("%s\n", tmp);
//print message to log file
TC_write_syslog("%s\n", tmp);
}
/*
objtagtype_name
*/
bool isTypeOf(tag_t objtag, const char* type_name) {
tag_t type = NULLTAG;
TCTYPE_ask_object_type(objtag, &type);
tag_t item_type = NULLTAG;
TCTYPE_find_type(type_name, "", &item_type);
bool is_type = false;
if (item_type != NULLTAG) {
logical isok = FALSE;
TCTYPE_is_type_of(type, item_type, &isok);
if (isok) {
is_type = true;
}
}
return is_type;
}
std::string GuidToString(const GUID& guid)
{
char buf[64] = { 0 };
sprintf_s(buf, sizeof(buf),
"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
guid.Data1, guid.Data2, guid.Data3,
guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
return std::string(buf);
}
string getUUid()
{
char buffer[64] = { 0 };
GUID guid;
if (CoCreateGuid(&guid))
{
fprintf(stderr, "create guid error\n");
return "";
}
//_snprintf(buffer, sizeof(buffer), "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", guid.Data1, guid.Data2, guid.Data3,
// guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
sprintf_s(buffer, sizeof(buffer),
"%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
guid.Data1, guid.Data2, guid.Data3,
guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
return buffer;
}
char* substring(char* dst, const char* src, int start, int len)
{
char* p = dst;
const char* q = src;
int length = strlen(src);
if (start >= length || start < 0)
return NULL;
if (len > length)
len = length - start;
q += start;
while (len--)
{
*(p++) = *(q++);
}
*(p++) = '\0';
return dst;
}
std::string urlEncode(const std::string& value) {
std::ostringstream escaped;
escaped.fill('0');
escaped << std::hex;
for (auto&& c : value) {
// 将不需要进行编码的字符直接添加到结果中
if (isalnum(c) || c == '-' || c == '_' || c == '.' || c == '~') {
escaped << c;
}
// 对其它字符进行编码
else {
escaped << '%' << std::setw(2) << int((unsigned char)c);
}
}
return escaped.str();
}
void sendErp(char *server_url,char * send_type,tag_t rev,char *item_id) {
CURL* curl;
CURLcode res;
curl = curl_easy_init();
printf("111\n");
if (curl) {
char* string_value = (char*)calloc(1024, sizeof(char));
string uuid = getUUid();
//判断是新增,修改还是废弃
string send_way;
int status_list_cnt = 0;
tag_t* status_tag;
char* status_obj_name;
printf("222\n");
ITKCALL(AOM_ask_value_tags(rev, "release_status_list", &status_list_cnt, &status_tag));
if (status_list_cnt > 0)
{
printf("333\n");
ITKCALL(AOM_ask_value_string(status_tag[status_list_cnt - 1], "object_name", &status_obj_name));
printf("当前对象的状态为:%s\n", status_obj_name);
if (strcmp(status_obj_name, "TCM 已发布") == 0 || strcmp(status_obj_name, "TCM Released") == 0)
{
send_way.append("Edit");
}
else if(strcmp(status_obj_name, "Obsolete") == 0)
{
send_way.append("Close");
}
}
else
{
send_way.append("Add");
printf("444\n");
}
string changeValue = GbkToUtf8(item_id);
printf("555\n");
std::string encodedValue = urlEncode(changeValue);
printf("666\n");
sprintf(string_value, "%s/api/Send?SysNo=PLM&BillType=%s&BillOp=%s&BillNo=%s&MsgUid=%s", server_url, send_type , send_way.c_str(), encodedValue.c_str(), uuid.c_str());
printf("发送数据:%s\n", string_value);
//printf("%s\n", string_value);
std::cout << string_value << "\n";
//修改 2023 7 3 hcj
//string changeValue = GbkToUtf8(string_value);
// printf("转为utf-8发送数据%s\n", changeValue.c_str());
curl_easy_setopt(curl, CURLOPT_URL, string_value);
res = curl_easy_perform(curl);
if (CURLE_OK == res) {
char* ct;
/* ask for the content-type */
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);
if ((CURLE_OK == res) && ct)
printf("We received Content-Type: %s\n", ct);
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
//增加版本判断 不是A版本就是
void sendErpVersion(char* server_url, char* send_type, tag_t rev, char* item_id) {
CURL* curl;
CURLcode res;
curl = curl_easy_init();
if (curl) {
char* string_value = (char*)calloc(1024, sizeof(char));
string uuid = getUUid();
//判断是新增,修改还是废弃
string send_way;
int status_list_cnt = 0;
tag_t* status_tag;
char* status_obj_name;
char* item_revision_id;
AOM_ask_value_string(rev, "item_revision_id", &item_revision_id);
ITKCALL(AOM_ask_value_tags(rev, "release_status_list", &status_list_cnt, &status_tag));
if (status_list_cnt > 0)
{
ITKCALL(AOM_ask_value_string(status_tag[status_list_cnt - 1], "object_name", &status_obj_name));
printf("当前对象的状态为:%s\n", status_obj_name);
if (strcmp(status_obj_name, "TCM 已发布") == 0 || strcmp(status_obj_name, "TCM Released") == 0)
{
send_way.append("Edit");
}
else if (strcmp(status_obj_name, "Obsolete") == 0)
{
send_way.append("Close");
}
}
else if (strcmp(item_revision_id, "A") != 0) {
send_way.append("Edit");
}
else
{
send_way.append("Add");
}
string changeValue = GbkToUtf8(item_id);
std::string encodedValue = urlEncode(changeValue);
sprintf(string_value, "%s/api/Send?SysNo=PLM&BillType=%s&BillOp=%s&BillNo=%s&MsgUid=%s", server_url, send_type, send_way.c_str(), encodedValue.c_str(), uuid.c_str());
printf("发送数据:%s\n", string_value);
//printf("%s\n", string_value);
std::cout << string_value << "\n";
//修改 2023 7 3 hcj
//string changeValue = GbkToUtf8(string_value);
// printf("转为utf-8发送数据%s\n", changeValue.c_str());
curl_easy_setopt(curl, CURLOPT_URL, string_value);
res = curl_easy_perform(curl);
if (CURLE_OK == res) {
char* ct;
/* ask for the content-type */
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);
if ((CURLE_OK == res) && ct)
printf("We received Content-Type: %s\n", ct);
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}

@ -0,0 +1,50 @@
#include <tc\tc_macros.h>
#include <tc\emh.h>
#include <epm\epm_toolkit_tc_utils.h>
#include <tc\preferences.h>
#include <tccore\grm.h>
#include <tccore\aom.h>
#include <tccore\aom_prop.h>
#include <tccore\workspaceobject.h>
#include <ae/ae.h>
#include <stdio.h>
#include <string>
#include <iostream>
#include <vector>
#include <base_utils/IFail.hxx>
#include <base_utils/TcResultStatus.hxx>
#import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF","adoEOF")rename("BOF","adoBOF")
#include <curl\curl.h>
#include<algorithm>
#include <objbase.h>
#include <bom/bom.h>
using namespace std;
#define DOFREE(obj) \
{ \
if(obj) \
{ \
MEM_free(obj); \
obj = NULL; \
} \
}
char* getTime();
int getCurrentMilliSeconds();
string trim(const string& str);
int ReportError(logical is_utf8, int err_code, const char* format, ...);
void StartLog(string str);
void Log(const char* format, ...);
int Log(IFail ex);
void CloseLog();
void set_bypass(logical bypass);
char* G2U(const char* gb2312);
char* U2G(const char* utf8);
void Split(string strArg, string spliter, vector<string>& ans);
logical inArray(vector<string> types, string type);
void WriteLog(logical debug, const char* format, ...);
bool isTypeOf(tag_t objtag, const char* type_name);
std::string GuidToString(const GUID& guid);
string getUUid();
char* substring(char* dst, const char* src, int start, int len);
void sendErp(char* server_url, char* send_type, tag_t rev, char* item_id);
void sendErpVersion(char* server_url, char* send_type, tag_t rev, char* item_id);

@ -0,0 +1,71 @@
#include <iostream>
#include <libxl.h>
#include <tchar.h>
using namespace libxl;
int main() {
// 初始化 Excel 文件对象(支持 xls 和 xlsx 两种格式)
Book* book = xlCreateBook();
if (!book) {
std::cerr << "Failed to create Excel book object" << std::endl;
return 1;
}
// 加载 Excel 文件(此处假设模板文件名为 template.xlsx
if (!book->load(_T("C:\\Users\\Administrator\\Desktop\\零件清单模板.xlsx"))) {
std::cerr << "Failed to load Excel file: " << book->errorMessage() << std::endl;
book->release();
return 1;
}
// 获取第一个工作表索引从0开始
Sheet* sheet = book->getSheet(0);
if (!sheet) {
std::cerr << "Worksheet not found" << std::endl;
book->release();
return 1;
}
// 遍历工作表中的数据
const int rowStart = sheet->firstRow();
const int rowEnd = sheet->lastRow();
const int colStart = sheet->firstCol();
const int colEnd = sheet->lastCol();
std::cout << "Reading Excel data ("
<< (rowEnd - rowStart + 1) << " rows, "
<< (colEnd - colStart + 1) << " columns):\n";
// 逐行读取数据
for (int row = rowStart; row <= rowEnd; ++row) {
std::cout << "Row " << row << ": ";
for (int col = colStart; col <= colEnd; ++col) {
// 根据单元格类型读取数据
CellType cellType = sheet->cellType(row, col);
switch (cellType) {
case CELLTYPE_STRING:
std::cout << "[" << sheet->readStr(row, col) << "] ";
break;
case CELLTYPE_NUMBER:
std::cout << sheet->readNum(row, col) << " ";
break;
case CELLTYPE_BOOLEAN:
std::cout << std::boolalpha << sheet->readBool(row, col) << " ";
break;
case CELLTYPE_BLANK:
std::cout << "(blank) ";
break;
case CELLTYPE_ERROR:
std::cout << "(error) ";
break;
default:
std::cout << "(unknown) ";
}
}
std::cout << "\n";
}
// 释放资源
book->release();
return 0;
}

Binary file not shown.

Binary file not shown.

@ -0,0 +1,3 @@
c:\users\何家乐\desktop\itk-master0612\itk-master\itk\zf_itk_c\zf_itk_c\x64\debug\vc143.idb
c:\users\何家乐\desktop\itk-master0612\itk-master\itk\zf_itk_c\zf_itk_c\x64\debug\vc143.pdb
c:\users\何家乐\desktop\itk-master0612\itk-master\itk\zf_itk_c\zf_itk_c\x64\debug\zf_itk_c.tlog\cl.command.1.tlog

@ -0,0 +1,15 @@
 erp_send_bom.cpp
C:\Users\何家乐\Desktop\ITK-master0612\ITK-master\itk\zf_itk_c\zf_itk_c\kutil.h(1,10): fatal error C1083: 无法打开包括文件: “tc\tc_macros.h”: No such file or directory
erp_send_bzgx.cpp
C:\Users\何家乐\Desktop\ITK-master0612\ITK-master\itk\zf_itk_c\zf_itk_c\kutil.h(1,10): fatal error C1083: 无法打开包括文件: “tc\tc_macros.h”: No such file or directory
erp_send_gx.cpp
C:\Users\何家乐\Desktop\ITK-master0612\ITK-master\itk\zf_itk_c\zf_itk_c\kutil.h(1,10): fatal error C1083: 无法打开包括文件: “tc\tc_macros.h”: No such file or directory
erp_send_gylx.cpp
C:\Users\何家乐\Desktop\ITK-master0612\ITK-master\itk\zf_itk_c\zf_itk_c\kutil.h(1,10): fatal error C1083: 无法打开包括文件: “tc\tc_macros.h”: No such file or directory
kutil.cpp
C:\Users\何家乐\Desktop\ITK-master0612\ITK-master\itk\zf_itk_c\zf_itk_c\kutil.h(1,10): fatal error C1083: 无法打开包括文件: “tc\tc_macros.h”: No such file or directory
zf_itk_c.cpp
C:\Users\何家乐\Desktop\ITK-master0612\ITK-master\itk\zf_itk_c\zf_itk_c\zf_itk_c.cpp(1,10): fatal error C1083: 无法打开包括文件: “server_exits/user_server_exits.h”: No such file or directory
erp_send_part.cpp
C:\Users\何家乐\Desktop\ITK-master0612\ITK-master\itk\zf_itk_c\zf_itk_c\kutil.h(1,10): fatal error C1083: 无法打开包括文件: “tc\tc_macros.h”: No such file or directory
正在生成代码...

@ -0,0 +1,2 @@
PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.36.32532:TargetPlatformVersion=10.0.19041.0:
Debug|x64|C:\Users\何家乐\Desktop\ITK-master0612\ITK-master\itk\zf_itk_c\|

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

@ -0,0 +1,30 @@
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\vc142.pdb
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\zf_sendparttoerp.obj
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\zf_sendpartbomtoerp.obj
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\zf_sendpart.obj
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\zf_sendgylxtoerp.obj
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\zf_sendbzgxtoerp.obj
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\erp_send_part.obj
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\zf_itk_c.obj
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\test.obj
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\kutil.obj
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\erp_send_gylx.obj
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\erp_send_gx.obj
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\erp_send_bzgx.obj
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\erp_send_bom.obj
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\connor_itk_util.obj
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\x64\release\zf_itk_c.dll
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\zf_itk_c.ipdb
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\zf_itk_c.iobj
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\x64\release\zf_itk_c.pdb
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\x64\release\zf_itk_c.lib
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\x64\release\zf_itk_c.exp
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\msado15.tli
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\msado15.tlh
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\zf_itk_c.tlog\cl.command.1.tlog
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\zf_itk_c.tlog\cl.read.1.tlog
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\zf_itk_c.tlog\cl.write.1.tlog
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\zf_itk_c.tlog\link.command.1.tlog
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\zf_itk_c.tlog\link.read.1.tlog
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\zf_itk_c.tlog\link.write.1.tlog
e:\itk_workspace\itk\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\x64\release\zf_itk_c.tlog\zf_itk_c.write.1u.tlog

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<ProjectOutputs>
<ProjectOutput>
<FullPath>E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\x64\Release\zf_itk_c.dll</FullPath>
</ProjectOutput>
</ProjectOutputs>
<ContentFiles />
<SatelliteDlls />
<NonRecipeFileRefs />
</Project>

@ -0,0 +1,147 @@
 connor_itk_util.cpp
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(806,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(5417,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\connor_itk_util.cpp(121,6): warning C4996: 'chdir': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _chdir. See online help for details.
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\connor_itk_util.cpp(128,7): warning C4996: 'chdir': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _chdir. See online help for details.
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\connor_itk_util.cpp(203,6): warning C4996: 'chdir': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _chdir. See online help for details.
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\connor_itk_util.cpp(210,7): warning C4996: 'chdir': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _chdir. See online help for details.
connor_set_prop_value.cpp
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(806,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(5417,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include_cpp\base_utils\IFail.hxx(114,17): warning C4251: “IFail::m_message”: class“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”需要有 dll 接口由 class“IFail”的客户端使用
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
erp_send_bom.cpp
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(806,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(5417,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include_cpp\base_utils\IFail.hxx(114,17): warning C4251: “IFail::m_message”: class“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”需要有 dll 接口由 class“IFail”的客户端使用
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
erp_send_bzgx.cpp
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(806,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(5417,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include_cpp\base_utils\IFail.hxx(114,17): warning C4251: “IFail::m_message”: class“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”需要有 dll 接口由 class“IFail”的客户端使用
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
erp_send_gx.cpp
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(806,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(5417,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include_cpp\base_utils\IFail.hxx(114,17): warning C4251: “IFail::m_message”: class“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”需要有 dll 接口由 class“IFail”的客户端使用
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
erp_send_gylx.cpp
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(806,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(5417,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include_cpp\base_utils\IFail.hxx(114,17): warning C4251: “IFail::m_message”: class“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”需要有 dll 接口由 class“IFail”的客户端使用
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
kutil.cpp
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(806,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(5417,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include_cpp\base_utils\IFail.hxx(114,17): warning C4251: “IFail::m_message”: class“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”需要有 dll 接口由 class“IFail”的客户端使用
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include_cpp\mld\logging\Logger.hxx(592,29): warning C4251: “Teamcenter::Logging::Logger::loggerName”: class“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”需要有 dll 接口由 class“Teamcenter::Logging::Logger”的客户端使用
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\kutil.cpp(42,13): warning C4101: “arg”: 未引用的局部变量
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\kutil.cpp(136,29): warning C4267: “初始化”: 从“size_t”转换到“int”可能丢失数据
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\kutil.cpp(158,27): warning C4267: “初始化”: 从“size_t”转换到“int”可能丢失数据
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\kutil.cpp(221,12): warning C4101: “now”: 未引用的局部变量
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\kutil.cpp(220,10): warning C4101: “date_string”: 未引用的局部变量
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\kutil.cpp(222,16): warning C4101: “p”: 未引用的局部变量
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\kutil.cpp(289,29): warning C4267: “初始化”: 从“size_t”转换到“int”可能丢失数据
test.cpp
zf_itk_c.cpp
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(806,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(5417,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\zf_itk_c.cpp(101,17): warning C4101: “mth_tag”: 未引用的局部变量
erp_send_part.cpp
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(806,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(5417,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include_cpp\base_utils\IFail.hxx(114,17): warning C4251: “IFail::m_message”: class“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”需要有 dll 接口由 class“IFail”的客户端使用
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
ZF_SendBZGXToERP.cpp
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(806,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(5417,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include_cpp\base_utils\IFail.hxx(114,17): warning C4251: “IFail::m_message”: class“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”需要有 dll 接口由 class“IFail”的客户端使用
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPart.h(85,30): warning C4190: “getCurrentTime”有指定的 C 链接,但返回了与 C 不兼容的 UDT“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPart.h(86,37): warning C4190: “getCurrentTimestamp17”有指定的 C 链接,但返回了与 C 不兼容的 UDT“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPart.h(88,53): warning C4190: “getLogFilePath”有指定的 C 链接,但返回了与 C 不兼容的 UDT“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPart.h(89,32): warning C4190: “generate_uuid_v4”有指定的 C 链接,但返回了与 C 不兼容的 UDT“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendBZGXToERP.cpp(746,56): warning C4267: “参数”: 从“size_t”转换到“int”可能丢失数据
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendBZGXToERP.cpp(760,60): warning C4267: “参数”: 从“size_t”转换到“int”可能丢失数据
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendBZGXToERP.cpp(775,60): warning C4267: “参数”: 从“size_t”转换到“int”可能丢失数据
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendBZGXToERP.cpp(790,60): warning C4267: “参数”: 从“size_t”转换到“int”可能丢失数据
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendBZGXToERP.cpp(773,3): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead.
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendBZGXToERP.cpp(788,3): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead.
ZF_SendGYLXToERP.cpp
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(806,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(5417,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include_cpp\base_utils\IFail.hxx(114,17): warning C4251: “IFail::m_message”: class“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”需要有 dll 接口由 class“IFail”的客户端使用
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPart.h(85,30): warning C4190: “getCurrentTime”有指定的 C 链接,但返回了与 C 不兼容的 UDT“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPart.h(86,37): warning C4190: “getCurrentTimestamp17”有指定的 C 链接,但返回了与 C 不兼容的 UDT“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPart.h(88,53): warning C4190: “getLogFilePath”有指定的 C 链接,但返回了与 C 不兼容的 UDT“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPart.h(89,32): warning C4190: “generate_uuid_v4”有指定的 C 链接,但返回了与 C 不兼容的 UDT“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendGYLXToERP.cpp(164,9): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead.
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendGYLXToERP.cpp(198,9): warning C4996: 'AOM_UIF_ask_values': "AOM_UIF_ask_values" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead.
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendGYLXToERP.cpp(267,11): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead.
ZF_SendPart.cpp
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(806,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(5417,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include_cpp\base_utils\IFail.hxx(114,17): warning C4251: “IFail::m_message”: class“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”需要有 dll 接口由 class“IFail”的客户端使用
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPart.h(85,30): warning C4190: “getCurrentTime”有指定的 C 链接,但返回了与 C 不兼容的 UDT“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPart.h(86,37): warning C4190: “getCurrentTimestamp17”有指定的 C 链接,但返回了与 C 不兼容的 UDT“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPart.h(88,53): warning C4190: “getLogFilePath”有指定的 C 链接,但返回了与 C 不兼容的 UDT“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPart.h(89,32): warning C4190: “generate_uuid_v4”有指定的 C 链接,但返回了与 C 不兼容的 UDT“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
ZF_SendPartBOMToERP.cpp
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(806,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(5417,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include_cpp\base_utils\IFail.hxx(114,17): warning C4251: “IFail::m_message”: class“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”需要有 dll 接口由 class“IFail”的客户端使用
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPart.h(85,30): warning C4190: “getCurrentTime”有指定的 C 链接,但返回了与 C 不兼容的 UDT“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPart.h(86,37): warning C4190: “getCurrentTimestamp17”有指定的 C 链接,但返回了与 C 不兼容的 UDT“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPart.h(88,53): warning C4190: “getLogFilePath”有指定的 C 链接,但返回了与 C 不兼容的 UDT“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPart.h(89,32): warning C4190: “generate_uuid_v4”有指定的 C 链接,但返回了与 C 不兼容的 UDT“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPartBOMToERP.cpp(166,9): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead.
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPartBOMToERP.cpp(199,9): warning C4996: 'AOM_UIF_ask_values': "AOM_UIF_ask_values" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead.
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPartBOMToERP.cpp(201,9): warning C4996: 'AOM_UIF_ask_values': "AOM_UIF_ask_values" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead.
ZF_SendPartToERP.cpp
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(806,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include\pom\pom\pom.h(5417,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include_cpp\base_utils\IFail.hxx(114,17): warning C4251: “IFail::m_message”: class“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”需要有 dll 接口由 class“IFail”的客户端使用
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPart.h(85,30): warning C4190: “getCurrentTime”有指定的 C 链接,但返回了与 C 不兼容的 UDT“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPart.h(86,37): warning C4190: “getCurrentTimestamp17”有指定的 C 链接,但返回了与 C 不兼容的 UDT“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPart.h(88,53): warning C4190: “getLogFilePath”有指定的 C 链接,但返回了与 C 不兼容的 UDT“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPart.h(89,32): warning C4190: “generate_uuid_v4”有指定的 C 链接,但返回了与 C 不兼容的 UDT“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”
D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4871): message : 参见“std::basic_string<char,std::char_traits<char>,std::allocator<char>>”的声明
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPartToERP.cpp(348,9): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead.
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPartToERP.cpp(381,9): warning C4996: 'AOM_UIF_ask_values': "AOM_UIF_ask_values" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead.
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPartToERP.cpp(456,8): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead.
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPartToERP.cpp(457,8): warning C4996: 'AOM_UIF_ask_value': "AOM_UIF_ask_value" deprecated in Teamcenter "11.1"; Use "AOM_ask_displayable_values" instead.
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendPartToERP.cpp(789,13): warning C4996: 'stricmp': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _stricmp. See online help for details.
正在创建库 E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\x64\Release\zf_itk_c.lib 和对象 E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\x64\Release\zf_itk_c.exp
正在生成代码
Previous IPDB not found, fall back to full compilation.
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\erp_send_bzgx.cpp(170): warning C4715: “erp_send_bzgx”: 不是所有的控件路径都返回值
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\erp_send_gylx.cpp(187): warning C4715: “erp_send_gylx”: 不是所有的控件路径都返回值
E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\zf_itk_c\ZF_SendBZGXToERP.cpp(986): warning C4715: “updateJson”: 不是所有的控件路径都返回值
All 2912 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
已完成代码的生成
zf_itk_c.vcxproj -> E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\x64\Release\zf_itk_c.dll

Binary file not shown.

@ -0,0 +1,2 @@
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:TargetPlatformVersion=10.0.19041.0:
Release|x64|E:\ITK_WorkSpace\ITK\兆丰\zf_itk_c_final\zf_itk_c\|

@ -0,0 +1,157 @@
#include <server_exits/user_server_exits.h>
#include <tccore/custom.h>
#include <tc\preferences.h>
#include <string>
#include "handlers.h"
#define PREF_HANDLER_PREFIX "Connor_Std_Handler_Prefix"
using namespace std;
extern DLLAPI int k_register_handlers(int* decision, va_list args)
{
int ifail = ITK_ok;
//erp_send_part
ITKCALL(ifail = EPM_register_action_handler("erp_send_part", "", (EPM_action_handler_t)erp_send_part));
if (ifail == 0) {
printf("注册操作处理程序成功erp_send_part\n");
}
else {
printf("注册操作处理程序失败[%d]erp_send_part\n", ifail);
}
//erp_send_bom
ITKCALL(ifail = EPM_register_action_handler("erp_send_bom", "", (EPM_action_handler_t)erp_send_bom));
if (ifail == 0) {
printf("注册操作处理程序成功erp_send_bom\n");
}
else {
printf("注册操作处理程序失败[%d]erp_send_bom\n", ifail);
}
//erp_send_gx
ITKCALL(ifail = EPM_register_action_handler("erp_send_gx", "", (EPM_action_handler_t)erp_send_gx));
if (ifail == 0) {
printf("注册操作处理程序成功erp_send_gx\n");
}
else {
printf("注册操作处理程序失败[%d]erp_send_gx\n", ifail);
}
//erp_send_bzgx
ITKCALL(ifail = EPM_register_action_handler("erp_send_bzgx", "", (EPM_action_handler_t)erp_send_bzgx));
if (ifail == 0) {
printf("注册操作处理程序成功erp_send_bzgx\n");
}
else {
printf("注册操作处理程序失败[%d]erp_send_bzgx\n", ifail);
}
//erp_send_gylx
ITKCALL(ifail = EPM_register_action_handler("erp_send_gylx", "", (EPM_action_handler_t)erp_send_gylx));
if (ifail == 0) {
printf("注册操作处理程序成功erp_send_gylx\n");
}
else {
printf("注册操作处理程序失败[%d]erp_send_gylx\n", ifail);
}
//ZF_SendPartToERP
ITKCALL(ifail = EPM_register_action_handler("ZF_SendPartToERP", "", (EPM_action_handler_t)ZF_SendPartToERP));
if (ifail == 0) {
printf("注册操作处理程序成功ZF_SendPartToERP\n");
}
else {
printf("注册操作处理程序失败[%d]ZF_SendPartToERP\n", ifail);
}
//ZF_SendPartBOMToERP
ITKCALL(ifail = EPM_register_action_handler("ZF_SendPartBOMToERP", "", (EPM_action_handler_t)ZF_SendPartBOMToERP));
if (ifail == 0) {
printf("注册操作处理程序成功ZF_SendPartBOMToERP\n");
}
else {
printf("注册操作处理程序失败[%d]ZF_SendPartBOMToERP\n", ifail);
}
//ZF_SendGYLXToERP
ITKCALL(ifail = EPM_register_action_handler("ZF_SendGYLXToERP", "", (EPM_action_handler_t)ZF_SendGYLXToERP));
if (ifail == 0) {
printf("注册操作处理程序成功ZF_SendGYLXToERP\n");
}
else {
printf("注册操作处理程序失败[%d]ZF_SendGYLXToERP\n", ifail);
}
//ZF_SendBZGXToERP 标准工序同步
ITKCALL(ifail = EPM_register_action_handler("ZF_SendBZGXToERP", "", (EPM_action_handler_t)ZF_SendBZGXToERP));
if (ifail == 0) {
printf("注册操作处理程序成功ZF_SendBZGXToERP\n");
}
else {
printf("注册操作处理程序失败[%d]ZF_SendBZGXToERP\n", ifail);
}
return ifail;
}
////register service method
extern DLLAPI int USERSERVICE_custom_register_methods()
{
int
status = ITK_ok,
numberOfArguments = 0,
returnValueType = USERARG_STRING_TYPE,
* argumentList = NULL;
USER_function_t functionPtr;
METHOD_id_t mth_tag;
//规定java需要传递过来的个数
numberOfArguments = 3;
//需要调用的函数地址函数地址
functionPtr = connor_set_prop_value;
//定义java需要传递的参数
argumentList = (int*)MEM_alloc(numberOfArguments * sizeof(int));
argumentList[0] = USERARG_STRING_TYPE;
argumentList[1] = USERARG_STRING_TYPE;
argumentList[2] = USERARG_STRING_TYPE;
//定义返回值的类型
returnValueType = USERARG_VOID_TYPE;
status = USERSERVICE_register_method("connor_set_prop_value", functionPtr, numberOfArguments,
argumentList, returnValueType);
MEM_free(argumentList);
if (status == ITK_ok)
{
printf("\n Registering connor_set_prop_value finished\n");
}
else
{
printf("\n Registering connor_set_prop_value failed %d\n", status);
}
return(status);
}
#ifdef __cplusplus
extern "C" {
#endif
//此函数必须有规范的写法必须以dll的名称加上"_"开头
DLLAPI int zf_itk_c_register_callbacks()
{
int ifail = ITK_ok;
ITKCALL(ifail = CUSTOM_register_exit("zf_itk_c", "USER_gs_shell_init_module", (CUSTOM_EXIT_ftn_t)k_register_handlers));
ITKCALL(ifail = CUSTOM_register_exit("zf_itk_c", "USERSERVICE_register_methods", (CUSTOM_EXIT_ftn_t)USERSERVICE_custom_register_methods));
if (ifail == ITK_ok) {
printf("General_register_callbacks 注册成功!\n");
}
else {
printf("General_register_callbacks 注册失败:%d\n", ifail);
}
return ifail;
}
#ifdef __cplusplus
}
#endif

@ -0,0 +1,175 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{68ddf508-8d60-4777-994c-369e7a4b18c1}</ProjectGuid>
<RootNamespace>zfitkc</RootNamespace>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;ZFITKC_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;ZFITKC_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;ZFITKC_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;IPLIB=none;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>D:\WorkEnvironment\LiYuan\include_cpp;D:\WorkEnvironment\LiYuan\include;D:\WorkEnvironment\LiYuan\curllaoban\include;C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include;C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\include_cpp;C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\oci\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>D:\WorkEnvironment\LiYuan\lib\*.lib;D:\WorkEnvironment\LiYuan\curllaoban\lib\*.lib;C:\environment\Teamcenter-ENV\ITK_Configuration_File\ZF_ITK\lib\*.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>libuser_exits.ar.lib</IgnoreSpecificDefaultLibraries>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="connor_itk_util.cpp" />
<ClCompile Include="connor_set_prop_value.cpp" />
<ClCompile Include="erp_send_bom.cpp" />
<ClCompile Include="erp_send_bzgx.cpp" />
<ClCompile Include="erp_send_gx.cpp" />
<ClCompile Include="erp_send_gylx.cpp" />
<ClCompile Include="kutil.cpp" />
<ClCompile Include="test.cpp" />
<ClCompile Include="zf_itk_c.cpp" />
<ClCompile Include="erp_send_part.cpp" />
<ClCompile Include="ZF_SendBZGXToERP.cpp" />
<ClCompile Include="ZF_SendGYLXToERP.cpp" />
<ClCompile Include="ZF_SendPart.cpp" />
<ClCompile Include="ZF_SendPartBOMToERP.cpp" />
<ClCompile Include="ZF_SendPartToERP.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="connor_itk_util.h" />
<ClInclude Include="handlers.h" />
<ClInclude Include="kutil.h" />
<ClInclude Include="ZF_SendPart.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="kutil.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="zf_itk_c.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="erp_send_part.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="erp_send_bom.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="erp_send_gx.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="erp_send_bzgx.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="erp_send_gylx.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="connor_itk_util.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="ZF_SendPartToERP.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="ZF_SendPartBOMToERP.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="test.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="ZF_SendPart.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="ZF_SendGYLXToERP.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="ZF_SendBZGXToERP.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="connor_set_prop_value.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="handlers.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="kutil.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="connor_itk_util.h">
<Filter>源文件</Filter>
</ClInclude>
<ClInclude Include="ZF_SendPart.h">
<Filter>源文件</Filter>
</ClInclude>
</ItemGroup>
</Project>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
Loading…
Cancel
Save