commit
cb29b9fd42
@ -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>
|
Binary file not shown.
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -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(<ime);
|
||||||
|
|
||||||
|
today = localtime(<ime);
|
||||||
|
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,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,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);
|
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
|
||||||
|
正在生成代码...
|
Binary file not shown.
@ -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.
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.
Binary file not shown.
Binary file not shown.
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>
|
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,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\|
|
Binary file not shown.
@ -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…
Reference in new issue