main
李岩峰 6 years ago
parent ffede8be10
commit 7630162419

Binary file not shown.

@ -153,16 +153,22 @@
<None Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="bs_bom_check.cpp" />
<ClCompile Include="bs_bom_save_check.cpp" />
<ClCompile Include="bs_bypass.cpp" />
<ClCompile Include="bs_file_transfer.cpp" />
<ClCompile Include="bs_sap.cpp" />
<ClCompile Include="bs_signoff.cxx" />
<ClCompile Include="bs_sign_cad.cpp" />
<ClCompile Include="bs_wl_check.cpp" />
<ClCompile Include="epm_register_handler.cxx" />
<ClCompile Include="bs_custom_main.cxx" />
<ClCompile Include="util.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="epm_handler_common.h" />
<ClInclude Include="epm_register_handler.h" />
<ClInclude Include="util.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

@ -49,6 +49,21 @@
<ClCompile Include="bs_sap.cpp">
<Filter>epm-handler</Filter>
</ClCompile>
<ClCompile Include="bs_sign_cad.cpp">
<Filter>epm-handler</Filter>
</ClCompile>
<ClCompile Include="bs_bom_check.cpp">
<Filter>epm-handler</Filter>
</ClCompile>
<ClCompile Include="bs_wl_check.cpp">
<Filter>epm-handler</Filter>
</ClCompile>
<ClCompile Include="bs_bom_save_check.cpp">
<Filter>epm-handler</Filter>
</ClCompile>
<ClCompile Include="util.cpp">
<Filter>epm-handler</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="epm_register_handler.h">
@ -57,5 +72,8 @@
<ClInclude Include="epm_handler_common.h">
<Filter>epm-handler</Filter>
</ClInclude>
<ClInclude Include="util.h">
<Filter>epm-handler</Filter>
</ClInclude>
</ItemGroup>
</Project>

@ -0,0 +1,79 @@
#include "util.h"
boolean judge(tag_t top,string &status,string &name)
{
int line_cnt;
tag_t *lines;
char *val;
BOM_line_ask_child_lines(top, &line_cnt, &lines);
for (int j = 0; j < line_cnt; j++)
{
AOM_UIF_ask_value(lines[j], "jd2_last_release_status", &val);
printf("status:%s\n", val);
string temp = val;
if (temp.length()>0&&status.find(val) != -1)
{
AOM_ask_value_string(lines[j], "bl_rev_object_string", &val);
name = val;
return false;
}
if (!judge(lines[j], status, name))
return false;
}
return true;
}
int bs_bom_check(EPM_rule_message_t msg)
{
int ifail = EPM_go, att_count, line_cnt;
tag_t rootTask, *attachments, win, top, *lines;
char *val;
EPM_ask_root_task(msg.task, &rootTask);
EPM_ask_attachments(rootTask, EPM_target_attachment, &att_count, &attachments);
TC_argument_list_t * arguments = msg.arguments;
int arg_cnt = TC_number_of_arguments(arguments), status = 0;
vector<string> types;
string name;
map<string, string> paras;
for (auto i = 0; i < arg_cnt; i++)
{
char *temp_key, *temp_val;
ITK_ask_argument_named_value(TC_next_argument(arguments), &temp_key, &temp_val);
paras[temp_key] = temp_val;
}
split(paras["type"].c_str(),",", &types);
printf("check status:%s\n", paras["status"].c_str());
BOM_create_window(&win);
for (int i = 0; i < att_count; i++)
{
bool pass = false;
for (int j = 0; j < types.size(); j++)
{
if (isTypeOf(attachments[i], types[j].c_str()))
{
pass = true;
break;
}
}
if (!pass)
continue;
printf("begin check \n");
BOM_set_window_top_line(win, NULLTAG, attachments[i], NULLTAG, &top);
if(!judge(top, paras["status"],name))
{
ifail = EPM_nogo;
break;
}
printf("end check \n");
}
BOM_close_window(win);
if (ifail==EPM_nogo) {
name += paras["prompt"];
EMH_store_error_s1(EMH_severity_user_error, EMH_PROP_error_base, name.c_str());
}
return ifail;
}

@ -0,0 +1,62 @@
#include "util.h"
boolean save_judge(tag_t top,string &check,string &name,vector<string> &type_vec)
{
int line_cnt;
tag_t *lines;
BOM_line_ask_child_lines(top, &line_cnt, &lines);
char *val;
for (int i = 0; i<line_cnt; i++)
{
AOM_ask_value_string(lines[i], "bl_item_object_type", &val);
printf("type :%s\n", val);
if (find(type_vec.begin(), type_vec.end(), val) != type_vec.end())
continue;
AOM_UIF_ask_value(lines[i], "jd2_last_release_status", &val);
string temp = val;
printf("length:%llu status:%s\n", temp.length(), val);
if (temp.length() == 0 || check.find(temp) != -1)
{
AOM_ask_value_string(lines[i], "bl_rev_object_string", &val);
name = val;
return false;
}
if (!save_judge(lines[i], check, name,type_vec))
return false;
}
return true;
}
int bs_bom_save_check(METHOD_message_t *msg, va_list args)
{
printf("bs_bom_save_check start11\n");
logical is_judge = false;
PREF_ask_logical_value("connor_bom_check", 0, &is_judge);
if (!is_judge)
return ITK_ok;
int ifail = ITK_ok, num;
//获取属性对象
tag_t win = va_arg(args, tag_t), top;
char *check_val,**type_val;
string name,check;
int type_cnt;
PREF_ask_char_value("connor_bom_check_value", 0, &check_val);
PREF_ask_char_values("connor_bom_check_type", &type_cnt, &type_val);
vector<string> type_vec(type_val,type_val+type_cnt);
check = check_val;
BOM_ask_window_top_line(win, &top);
if (!save_judge(top, check, name,type_vec)) {
ifail = 1;
name += "对象为冻结状态或未发布不能保存BOM!";
EMH_store_error_s1(EMH_severity_user_error, EMH_PROP_error_base, name.c_str());
}
printf("bs_bom_save_check end11\n");
return ifail;
}

@ -1,97 +1,4 @@
#include "epm_handler_common.h"
#include <tc\tc_macros.h>
#include <tc\emh.h>
#include <tc\preferences.h>
#include <property\propdesc.h>
#include <epm\epm.h>
#include <epm\epm_toolkit_tc_utils.h>
#include <tccore\item.h>
#include <tccore\grmtype.h>
#include <tccore\grm.h>
#include <tccore\imantype.h>
#include <sa\am.h>
#include <sa\sa.h>
#include <tccore\aom.h>
#include <tccore\aom_prop.h>
#include <property\prop_errors.h>
#include <tccore\workspaceobject.h>
#include <qry\qry.h>
#include <bom\bom_attr.h>
#include <bom\bom.h>
#include <epm\signoff.h>
#include <pom\pom\pom.h>
#include <pom\pom\pom_errors.h>
#include <fclasses\tc_date.h>
#include <epm\cr.h>
#include <cfm\cfm.h>
#include <sa\am.h>
#include "tc/envelope.h"
#include <stdio.h>
#include "ae/dataset.h"
#include <ctype.h>
#include <string.h>
#include <string>
#include <iostream>
#include <iterator>
#include <map>
#include <vector>
#include "ce/ce.h"
#include <time.h>
#include <windows.h>
#include <iostream>
#include <sql.h>
#include <sqlext.h>
#include "string"
#include "sstream"
#include <sa/tcfile.h>
#include <tccore/aom.h>
#include <sa/tcfile_cache.h>
#include "ctime"
#include "tchar.h"
#using "C:/Users/lyf/source/repos/Testdll/bin/Debug/declib.dll"
using namespace std;
using namespace Testdll;
using namespace System;
extern "C" int POM_AM__set_application_bypass(logical bypass);
string ConvertToString(System::String^ str)
{
char* p = (char*)(void*)System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(str);
return p;
}
System::String ^ convert_to_cstring(const char *p)
{
return System::Runtime::InteropServices::Marshal::PtrToStringAnsi((System::IntPtr)(char *)p);
}
bool isTypeOf(tag_t objtag, const char * type_name) {
tag_t type = NULLTAG;
TCTYPE_ask_object_type(objtag, &type);
tag_t item_type = NULLTAG;
TCTYPE_find_type(type_name, "", &item_type);
bool is_type = false;
if (item_type != NULLTAG) {
logical isok = FALSE;
TCTYPE_is_type_of(type, item_type, &isok);
if (isok) {
is_type = true;
}
}
return is_type;
}
void split(std::string s, const char* delim, std::vector<std::string>* ret)
{
size_t last = 0;
size_t index = s.find(delim, last);
int size = strlen(delim);
while (index != std::string::npos) {
ret->push_back(s.substr(last, index - last));
last = index + size;
index = s.find(delim, last);
}
if (index - last > 0) {
ret->push_back(s.substr(last, index - last));
}
}
#include "util.h"
int bs_sap_material(EPM_action_message_t msg)
{
printf("start sap material\n");
@ -101,12 +8,15 @@ int bs_sap_material(EPM_action_message_t msg)
int pref_cnt;
char **pref_vals;
EPM_ask_root_task(msg.task, &rootTask);
map<int, string> class_map;
EPM_ask_attachments(rootTask, EPM_target_attachment, &att_count, &attachments);
TC_argument_list_t * arguments = msg.arguments;
int arg_cnt = TC_number_of_arguments(arguments), status = 0;
POM_AM__set_application_bypass(true);
map<string, string> paras,rel_map;
map<string, string> prop_map;
vector<string> rel_vec;
for (auto i = 0; i < arg_cnt; i++)
{
@ -114,6 +24,20 @@ int bs_sap_material(EPM_action_message_t msg)
ITK_ask_argument_named_value(TC_next_argument(arguments), &temp_key, &temp_val);
paras[temp_key] = temp_val;
}
string d0 = "D00", d1 = "D0";
for(int i=0;i<67;i++)
{
if(i>8)
{
class_map[1000+i] = d1 + to_string(i + 1);
}else
{
class_map[1000 + i] = d0 + to_string(i + 1);
}
}
PREF_ask_char_values("connor_sap", &pref_cnt, &pref_vals);
split(pref_vals[4], ",", &rel_vec);
for(int i=0;i<rel_vec.size();i++)
@ -125,6 +49,17 @@ int bs_sap_material(EPM_action_message_t msg)
rel_map[temp_vec[0]] = temp_vec[1];
}
}
split(pref_vals[5], ",", &rel_vec);
for (int i = 0; i<rel_vec.size(); i++)
{
vector<string> temp_vec;
split(rel_vec[i], "=", &temp_vec);
if (temp_vec.size() == 2)
{
prop_map[temp_vec[0]] = temp_vec[1];
}
}
GRM_find_relation_type("IMAN_master_form", &relation_type);
printf("create class\n");
Testclass ^test = gcnew Testclass();
@ -132,24 +67,22 @@ int bs_sap_material(EPM_action_message_t msg)
String^ url = convert_to_cstring(pref_vals[0]);
String^ user = convert_to_cstring(pref_vals[2]);
String^ password = convert_to_cstring(pref_vals[3]);
map<string, string> map;
map["MTART"] = "jd2_wllx";
map["MATNR"] = "item_id";
map["MAKTX"] = "jd2_wlms";
map["MEINS"] = "jd2_jldw";
map["MATKL"] = "jd2_wlz";
map["PRDHA"] = "jd2_cppc";
map["EXTWG"] = "jd2_wbwlz";
map["MSTAE"] = "release_status_list";
map["VOLUM"] = "jd2_tj";
map["VOLEH"] = "jd2_tjdw";
map["BISMT"] = "jd2_jwlh";
map["ZEINR"] = "jd2_th";
map["BRGEW"] = "jd2_mz";
map["NTGEW"] = "jd2_jz";
map["GEWEI"] = "jd2_zldw";
map["CLASS"] = "jd2_wllx";
// prop_map["MTART"] = "jd2_wllx";
// prop_map["MATNR"] = "item_id";
// prop_map["MAKTX"] = "jd2_wlms";
// prop_map["MEINS"] = "jd2_dldw";
// prop_map["MATKL"] = "jd2_wlz";
// prop_map["PRDHA"] = "jd2_cpcc";
// prop_map["EXTWG"] = "jd2_wbwlz";
// prop_map["MSTAE"] = "release_status_list";
// prop_map["VOLUM"] = "jd2_tj";
// prop_map["VOLEH"] = "jd2_tjdw";
// prop_map["BISMT"] = "jd2_jwlh";
// prop_map["ZEINR"] = "jd2_th";
// prop_map["BRGEW"] = "jd2_mz";
// prop_map["NTGEW"] = "jd2_jz";
// prop_map["GEWEI"] = "jd2_zldw";
// prop_map["CLASS"] = "jd2_wllx";
vector<string> vec{ "jd2_wllx","item_id","jd2_wlms","jd2_jldw","jd2_wlz","jd2_cppc","jd2_wbwlz","release_status_list","jd2_tj","jd2_tjdw","jd2_jwlh","jd2_th","jd2_mz","jd2_jz","jd2_zldw" };
printf("start111\n");
for (int i = 0; i < att_count; i++)
@ -160,7 +93,7 @@ int bs_sap_material(EPM_action_message_t msg)
tag_t *rels;
GRM_list_secondary_objects_only(attachments[i], relation_type, &rel_cnt, &rels);
System::Collections::Generic::Dictionary<String^, String^> ^dic = gcnew System::Collections::Generic::Dictionary<String^, String^>();
for (auto j = map.begin(); j != map.end(); j++)
for (auto j = prop_map.begin(); j != prop_map.end(); j++)
{
char *val="";
string temp_val;
@ -182,8 +115,26 @@ int bs_sap_material(EPM_action_message_t msg)
AOM_UIF_ask_value(rels[0], j->second.c_str(), &val);
temp_val = val;
}
dic[convert_to_cstring(j->first.c_str())] = convert_to_cstring(temp_val.c_str());
}
tag_t class_obj;
ICS_ask_classification_object(attachments[i], &class_obj);
if (class_obj)
{
char ***vals;
int cnt, *ids,*val_count;
ICS_ico_ask_attributes(class_obj, &cnt, &ids, &val_count, &vals);
for(int j=0;j<cnt;j++)
{
printf("id:%d\n", ids[j]);
if(class_map.find(ids[j])!=class_map.end())
{
if(val_count[j])
dic[convert_to_cstring(class_map[ids[j]].c_str())] = convert_to_cstring(vals[j][0]);
}
}
}
dic["MBRSH"] = "M";
dic["SPART"] = "00";
dic["KLART"] = "001";
@ -279,6 +230,7 @@ int bs_sap_bom(EPM_action_message_t msg)
AOM_ask_value_string(rels[0], "jd2_BOMyt", &stlan);
if (tc_strlen(werks)==0||tc_strlen(stlan)==0)
continue;
get_bom(a_list, top_line, werks, stlan);
string result = ConvertToString(test->send_bom(url, user, password, a_list));
printf("result:%s\n", result.c_str());

@ -0,0 +1,95 @@
#pragma once
#include "util.h"
static void replace_dataset_named_reference(tag_t dataset_tag, tag_t old_file,
const char *new_file_path, char *ref_name)
{
IMF_file_data_p_t file_data;
int index = 0;
ITKCALL(IMF_get_file_access(old_file, 0, &file_data));
tag_t new_file_tag = NULLTAG;
AOM_lock(old_file);
ITKCALL(IMF_replace_file_and_get_new_tag(old_file, new_file_path,
FALSE, &new_file_tag));
AOM_lock(dataset_tag);
ITKCALL(AE_replace_dataset_named_ref2(dataset_tag, old_file, ref_name,
AE_PART_OF, new_file_tag));
ITKCALL(AE_save_myself(dataset_tag));
AOM_unlock(dataset_tag);
ITKCALL(IMF_release_file_access(&file_data));
// ITKCALL2(AOM_lock_for_delete(old_file));
// ITKCALL2(AOM_delete(old_file));
}
int bs_sign_cad(EPM_action_message_t msg)
{
int ifail = ITK_ok, att_count,tag_cnt,form_cnt;
tag_t rootTask, *attachments, *tags,ref,*forms;
TC_argument_list_t * arguments = msg.arguments;
char *name,*val;
int arg_cnt = TC_number_of_arguments(arguments), status = 0;
POM_AM__set_application_bypass(true);
map<string, string> paras;
string tempdir = getenv("temp");
for (auto i = 0; i<arg_cnt; i++)
{
char *temp_key, *temp_val;
ITK_ask_argument_named_value(TC_next_argument(arguments), &temp_key, &temp_val);
paras[temp_key] = temp_val;
}
vector<string> prop_vec;
map<string, string> prop_map;
split(paras["prop"], ",", &prop_vec);
for(int i=0;i<prop_vec.size();i++)
{
vector<string> temp_vec;
split(prop_vec[i], "=", &temp_vec);
if (temp_vec.size() == 2)
prop_map[temp_vec[0]] = temp_vec[1];
}
EPM_ask_root_task(msg.task, &rootTask);
Testclass ^test = gcnew Testclass();
EPM_ask_attachments(rootTask, EPM_target_attachment, &att_count, &attachments);
AE_reference_type_t ae_ref;
POM_AM__set_application_bypass(true);
for(int i=0;i<att_count;i++)
{
if(isTypeOf(attachments[i],paras["type"].c_str()))
{
printf("get item\n");
AOM_ask_value_tags(attachments[i], "TC_Attaches", &tag_cnt, &tags);
AOM_ask_value_tags(attachments[i], "IMAN_master_form_rev", &form_cnt, &forms);
for(int j=0;j<tag_cnt;j++)
{
AE_ask_dataset_named_ref2(tags[j], "JD2_dwg", &ae_ref, &ref);
if(ref)
{
IMF_ask_original_file_name2(ref, &name);
stringstream path;
path << tempdir <<"\\"<< newGUID() << name;
printf("path:%s\n", path.str().c_str());
IMF_export_file(ref, path.str().c_str());
System::Collections::Generic::Dictionary<String^, String^> ^dic = gcnew System::Collections::Generic::Dictionary<String^, String^>();
for(auto k=prop_map.begin();k!=prop_map.end();k++)
{
AOM_UIF_ask_value(forms[0], k->second.c_str(), &val);
dic[convert_to_cstring(k->first.c_str())] = convert_to_cstring(val);
}
bool result= test->signCad(convert_to_cstring(path.str().c_str()), convert_to_cstring(paras["title"].c_str()), dic);
if(result)
{
replace_dataset_named_reference(tags[j], ref, path.str().c_str(), "JD2_dwg");
}
}
}
}
}
POM_AM__set_application_bypass(false);
return 0;
}

@ -0,0 +1,98 @@
#include "util.h"
int bs_wl_check(EPM_rule_message_t msg)
{
int ifail = EPM_go, att_count, tag_cnt,form_cnt;
tag_t rootTask, *attachments, win, top, *tags,*forms;
char *val;
EPM_ask_root_task(msg.task, &rootTask);
EPM_ask_attachments(rootTask, EPM_target_attachment, &att_count, &attachments);
TC_argument_list_t * arguments = msg.arguments;
int arg_cnt = TC_number_of_arguments(arguments), status = 0;
vector<string> wl_types, judge_types,judge_vec;
string name;
map<string, string> paras,judge_map;
for (auto i = 0; i<arg_cnt; i++)
{
char *temp_key, *temp_val;
ITK_ask_argument_named_value(TC_next_argument(arguments), &temp_key, &temp_val);
paras[temp_key] = temp_val;
}
split(paras["wlType"], ",", &wl_types);
split(paras["judgeType"], ",", &judge_types);
split(paras["judgeProps"], ",", &judge_vec);
for(int i=0;i<judge_vec.size();i++)
{
vector<string> temp;
split(judge_vec[i], "=", &temp);
if(temp.size()==2)
{
judge_map[temp[0]] = temp[1];
}
}
for (int i = 0; i<att_count; i++)
{
bool pass=false;
for(int j=0;j<wl_types.size();j++)
{
if(isTypeOf(attachments[i],wl_types[j].c_str()))
{
pass = true;
printf("wl_type:%s\n", wl_types[j].c_str());
break;
}
}
if (!pass)
{
continue;
}
AOM_ask_value_tags(attachments[i], "IMAN_master_form_rev", &form_cnt, &forms);
pass = false;
for(auto j=judge_map.begin();j!=judge_map.end();j++)
{
AOM_UIF_ask_value(forms[0], j->first.c_str(), &val);
if(j->second!=val)
{
pass = true;
break;
}
}
if(!pass)
{
continue;
}
AOM_ask_value_tags(attachments[i], paras["relation"].c_str(), &tag_cnt, &tags);
printf("relation :%s\n, length:%d\n", paras["relation"].c_str(), tag_cnt);
pass = false;
for(int j=0;j<tag_cnt;j++)
{
for(int k=0;k<judge_types.size();k++)
{
if(isTypeOf(tags[j], judge_types[k].c_str()))
{
printf("judge_type:%s\n", judge_types[k].c_str());
pass = true;
break;
}
}
}
if (!pass)
{
AOM_ask_value_string(attachments[i], "object_string", &val);
name = val;
ifail = EPM_nogo;
break;
}
}
if (ifail==EPM_nogo) {
name += paras["prompt"];
EMH_store_error_s1(EMH_severity_user_error, EMH_PROP_error_base, name.c_str());
}
return ifail;
}

@ -39,8 +39,10 @@ extern "C" {
int bs_file_transfer(EPM_action_message_t msg);
int bs_sap_material(EPM_action_message_t msg);
int bs_sap_bom(EPM_action_message_t msg);
int bs_bom_check(EPM_rule_message_t msg);
int bs_wl_check(EPM_rule_message_t msg);
int bs_bom_save_check(METHOD_message_t *msg, va_list args);
int bs_sign_cad(EPM_action_message_t msg);
////将流程信息签入版本属性上去
//int qtmc_sign_ir(EPM_action_message_t msg);

@ -52,14 +52,70 @@ extern DLLAPI int CUST_init_module(int *decision, va_list args)
*decision = ALL_CUSTOMIZATIONS;
printf("register start\n");
ifail = EPM_register_action_handler("bs_file_transfer", "bs_file_transfer",
(EPM_action_handler_t)bs_file_transfer);
if(ifail)
{
printf("register bs_file_transfer failed\n");
}else
{
printf("register bs_file_transfer successfully\n");
}
ifail = EPM_register_action_handler("bs_sap_material", "bs_sap_material",
(EPM_action_handler_t)bs_sap_material);
if (ifail)
{
printf("register bs_sap_material failed\n");
}
else
{
printf("register bs_sap_material successfully\n");
}
ifail = EPM_register_action_handler("bs_sap_bom", "bs_sap_bom",
(EPM_action_handler_t)bs_sap_bom);
if (ifail)
{
printf("register bs_sap_bom failed\n");
}
else
{
printf("register bs_sap_bom successfully\n");
}
ifail = EPM_register_rule_handler("bs_bom_check", "bs_bom_check", (EPM_rule_handler_t)bs_bom_check);
if (ifail)
{
printf("register bs_bom_check failed\n");
}
else
{
printf("register bs_bom_check successfully\n");
}
ifail = EPM_register_rule_handler("bs_wl_check", "bs_wl_check", (EPM_rule_handler_t)bs_wl_check);
if (ifail)
{
printf("register bs_wl_check failed\n");
}
else
{
printf("register bs_wl_check successfully\n");
}
ifail = EPM_register_action_handler("bs_sign_cad", "bs_sign_cad",
(EPM_action_handler_t)bs_sign_cad);
if (ifail)
{
printf("register bs_sign_cad failed\n");
}
else
{
printf("register bs_sign_cad successfully\n");
}
//if(ifail == ITK_ok)
//{
// fprintf(stdout,"Registering action handler qtmc-sign-ir completed!\n");
@ -76,164 +132,25 @@ extern DLLAPI int CUST_init_module(int *decision, va_list args)
////register service method
extern DLLAPI int USERSERVICE_custom_register_methods()
{
////2.7 SP-CUS-007 <20><>DBOM<4F><4D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>EBOM
//numberOfArguments = 1;
//functionPtr = Q7_ebom_to_pbom;
//argumentList = (int*)MEM_alloc(numberOfArguments * sizeof(int) );
//argumentList[0] = USERARG_TAG_TYPE;
////argumentList[1] = USERARG_STRING_TYPE + USERARG_ARRAY_TYPE;
//returnValueType = USERARG_STRING_TYPE;
//ITKCALL(status = USERSERVICE_register_method("Q7_ebom_to_pbom", functionPtr, numberOfArguments,
// argumentList, returnValueType ));
//MEM_free(argumentList);
//if(status == ITK_ok)
//{
// fprintf( stdout, "\n Registering Q7_ebom_to_pbom finished\n" );
//}
//else
//{
// fprintf( stdout, "\n Registering Q7_ebom_to_pbom failed %d\n" , status );
//}
////QTM_ebom_to_pbom
//numberOfArguments = 1;
//functionPtr = QTM_ebom_to_pbom;
//argumentList = (int*)MEM_alloc(numberOfArguments * sizeof(int) );
//argumentList[0] = USERARG_TAG_TYPE;
////argumentList[1] = USERARG_STRING_TYPE + USERARG_ARRAY_TYPE;
//returnValueType = USERARG_STRING_TYPE;
//ITKCALL(status = USERSERVICE_register_method("QTM_ebom_to_pbom", functionPtr, numberOfArguments,
// argumentList, returnValueType ));
//MEM_free(argumentList);
//if(status == ITK_ok)
//{
// fprintf( stdout, "\n Registering QTM_ebom_to_pbom finished\n" );
//}
//else
//{
// fprintf( stdout, "\n Registering QTM_ebom_to_pbom failed %d\n" , status );
//}
////QTM_ebom_to_mbom
//numberOfArguments = 1;
//functionPtr = QTM_ebom_to_mbom;
//argumentList = (int*)MEM_alloc(numberOfArguments * sizeof(int) );
//argumentList[0] = USERARG_TAG_TYPE;
////argumentList[1] = USERARG_STRING_TYPE + USERARG_ARRAY_TYPE;
//returnValueType = USERARG_STRING_TYPE;
//ITKCALL(status = USERSERVICE_register_method("QTM_ebom_to_mbom", functionPtr, numberOfArguments,
// argumentList, returnValueType ));
//MEM_free(argumentList);
//if(status == ITK_ok)
//{
// fprintf( stdout, "\n Registering QTM_ebom_to_mbom finished\n" );
//}
//else
//{
// fprintf( stdout, "\n Registering QTM_ebom_to_mbom failed %d\n" , status );
//}
////2.6 SP-CUS-006<30><36><EFBFBD>е<D0B5><C2B6><EFBFBD>excel<65><6C>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//numberOfArguments = 3;
//functionPtr = qtmc_update_revision_prop;
//argumentList = (int*)MEM_alloc(numberOfArguments * sizeof(int) );
//argumentList[0] = USERARG_TAG_TYPE+USERARG_ARRAY_TYPE;
//argumentList[1] = USERARG_TAG_TYPE;
//argumentList[2] = USERARG_STRING_TYPE;
//returnValueType = USERARG_VOID_TYPE;
//ITKCALL(status = USERSERVICE_register_method("QTMC_update_revision_prop",functionPtr,numberOfArguments,argumentList,returnValueType));
//if(status == ITK_ok)
//{
// fprintf(stdout,"Registering user service QTMC_update_revision_prop successful !\n");
//}else{
// fprintf(stdout,"Registering user service QTMC_update_revision_prop failed %d\n",status);
//}
//
////SP-CUS-017SolidWorksģ<73><C4A3><EFBFBD><EFBFBD><EFBFBD>浽TC
//numberOfArguments = 7;
//functionPtr = qtmc_import_solidworks_to_tc;
//argumentList = (int*)MEM_alloc(numberOfArguments * sizeof(int) );
//argumentList[0] = USERARG_STRING_TYPE;
//argumentList[1] = USERARG_STRING_TYPE;
//argumentList[2] = USERARG_STRING_TYPE;
//argumentList[3] = USERARG_TAG_TYPE;
//argumentList[4] = USERARG_LOGICAL_TYPE;
//argumentList[5] = USERARG_LOGICAL_TYPE;
//argumentList[6] = USERARG_LOGICAL_TYPE;
//returnValueType = USERARG_LOGICAL_TYPE;
//ITKCALL(status = USERSERVICE_register_method("QTMC_import_solidworks",functionPtr,numberOfArguments,argumentList,returnValueType));
//if(status == ITK_ok)
//{
// fprintf(stdout,"Registering user service QTMC_import_solidworks successful !\n");
//}else{
// fprintf(stdout,"Registering user service QTMC_import_solidworks failed %d\n",status);
//}
////3.8 SP-CUS-020<32><30><EFBFBD><EFBFBD>ϵ<EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//numberOfArguments = 3;
//functionPtr = qtmc_update_series_parts;
//argumentList = (int*)MEM_alloc(numberOfArguments * sizeof(int) );
//argumentList[0] = USERARG_TAG_TYPE;
//argumentList[1] = USERARG_STRING_TYPE;
//argumentList[2] = USERARG_STRING_TYPE;
//returnValueType = USERARG_TAG_TYPE;
//ITKCALL(status = USERSERVICE_register_method("QTMC_update_series_parts",functionPtr,numberOfArguments,argumentList,returnValueType));
//if(status == ITK_ok)
//{
// fprintf(stdout,"Registering user service QTMC_update_series_parts successful !\n");
//}else{
// fprintf(stdout,"Registering user service QTMC_update_series_parts failed %d\n",status);
//}
//numberOfArguments = 1;
//functionPtr = qtmc_by_pass;
//argumentList = (int*)MEM_alloc(numberOfArguments * sizeof(int) );
//argumentList[0] = USERARG_LOGICAL_TYPE;
//returnValueType = USERARG_VOID_TYPE;
//ITKCALL(status = USERSERVICE_register_method("QTMC-bypass",functionPtr,numberOfArguments,argumentList,returnValueType));
//if(status == ITK_ok)
//{
// fprintf(stdout,"Registering user service QTMC-bypass successful !\n");
//}else{
// fprintf(stdout,"Registering user service QTMC-bypass failed %d\n",status);
//}
//numberOfArguments = 3;
//functionPtr = qtmc_qry_service;
//argumentList = (int*)MEM_alloc(numberOfArguments * sizeof(int) );
//argumentList[0] = USERARG_STRING_TYPE;
//argumentList[1] = USERARG_STRING_TYPE+USERARG_ARRAY_TYPE;
//argumentList[2] = USERARG_STRING_TYPE+USERARG_ARRAY_TYPE;
//returnValueType = USERARG_TAG_TYPE+USERARG_ARRAY_TYPE;
//ITKCALL(status = USERSERVICE_register_method("QTMC_Search",functionPtr,numberOfArguments,argumentList,returnValueType));
//if(status == ITK_ok)
//{
// fprintf(stdout,"Registering user service QTMC_Search successful !\n");
//}else{
// fprintf(stdout,"Registering user service QTMC_Search failed %d\n",status);
//}
//
////7.3 <09><><EFBFBD><EFBFBD>HBOM<4F><4D><EFBFBD>ݵĵ<DDB5><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//numberOfArguments = 4;
//functionPtr = qtmc_update_hbom_bomline_prop;
//argumentList = (int*)MEM_alloc(numberOfArguments * sizeof(int) );
//argumentList[0] = USERARG_TAG_TYPE;
//argumentList[1] = USERARG_TAG_TYPE;
//argumentList[2] = USERARG_STRING_TYPE;
//argumentList[3] = USERARG_STRING_TYPE;
//returnValueType = USERARG_VOID_TYPE;
//ITKCALL(status = USERSERVICE_register_method("QTMC_update_bomline",functionPtr,numberOfArguments,argumentList,returnValueType));
//if(status == ITK_ok)
//{
// fprintf(stdout,"Registering user service QTMC_update_bomline successful !\n");
//}else{
// fprintf(stdout,"Registering user service QTMC_update_bomline failed %d\n",status);
//}
int status = 0;
METHOD_id_t mth_tag;
METHOD_find_method("BOMWindow", "BOMWindow_save", &mth_tag);
printf("register service\n");
if (mth_tag.id)
{
printf("register bomwindow_save\n");
status=METHOD_add_action(mth_tag, METHOD_pre_action_type, (METHOD_function_t)bs_bom_save_check, NULL);
if(status==ITK_ok)
{
printf("register bomwindow_save success\n");
}else
{
printf("register bomwindow_save failed\n");
}
}
return 0;
}

@ -0,0 +1,61 @@
#include "util.h"
string ConvertToString(System::String^ str)
{
char* p = (char*)(void*)System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(str);
return p;
}
System::String ^ convert_to_cstring(const char *p)
{
return System::Runtime::InteropServices::Marshal::PtrToStringAnsi((System::IntPtr)(char *)p);
}
bool isTypeOf(tag_t objtag, const char * type_name) {
tag_t type = NULLTAG;
TCTYPE_ask_object_type(objtag, &type);
tag_t item_type = NULLTAG;
TCTYPE_find_type(type_name, "", &item_type);
bool is_type = false;
if (item_type != NULLTAG) {
logical isok = FALSE;
TCTYPE_is_type_of(type, item_type, &isok);
if (isok) {
is_type = true;
}
}
return is_type;
}
void split(std::string s, const char* delim, std::vector<std::string>* ret)
{
size_t last = 0;
size_t index = s.find(delim, last);
int size = strlen(delim);
while (index != std::string::npos) {
ret->push_back(s.substr(last, index - last));
last = index + size;
index = s.find(delim, last);
}
if (index - last > 0) {
ret->push_back(s.substr(last, index - last));
}
}
const char* newGUID()
{
static char buf[64] = { 0 };
GUID guid;
if (S_OK == ::CoCreateGuid(&guid))
{
_snprintf(buf, sizeof(buf)
, "%08X-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02X"
, guid.Data1
, guid.Data2
, guid.Data3
, guid.Data4[0], guid.Data4[1]
, guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5]
, guid.Data4[6], guid.Data4[7]
);
}
return (const char*)buf;
}

@ -0,0 +1,68 @@
#pragma once
#include "epm_handler_common.h"
#include <tc\tc_macros.h>
#include <tc\emh.h>
#include <tc\preferences.h>
#include <property\propdesc.h>
#include <epm\epm.h>
#include <epm\epm_toolkit_tc_utils.h>
#include <tccore\item.h>
#include <tccore\grmtype.h>
#include <tccore\grm.h>
#include <tccore\imantype.h>
#include <sa\am.h>
#include <sa\sa.h>
#include <tccore\aom.h>
#include <tccore\aom_prop.h>
#include <property\prop_errors.h>
#include <tccore\workspaceobject.h>
#include <qry\qry.h>
#include <bom\bom_attr.h>
#include <bom\bom.h>
#include <epm\signoff.h>
#include <pom\pom\pom.h>
#include <pom\pom\pom_errors.h>
#include <fclasses\tc_date.h>
#include <epm\cr.h>
#include <cfm\cfm.h>
#include <sa\am.h>
#include "tc/envelope.h"
#include <stdio.h>
#include "ae/dataset.h"
#include <ctype.h>
#include <string.h>
#include <string>
#include <iostream>
#include <iterator>
#include <map>
#include <vector>
#include "ce/ce.h"
#include <time.h>
#include <windows.h>
#include <iostream>
#include <sql.h>
#include <sqlext.h>
#include "string"
#include "sstream"
#include <sa/tcfile.h>
#include <tccore/aom.h>
#include <sa/tcfile_cache.h>
#include "ctime"
#include "tchar.h"
#include "ics/ics.h"
#include "ics/ics2.h"
#using "C:/Users/lyf/source/repos/Testdll/bin/Debug/declib.dll"
using namespace std;
using namespace Testdll;
using namespace System;
extern "C" int POM_AM__set_application_bypass(logical bypass);
string ConvertToString(System::String^ str);
System::String ^ convert_to_cstring(const char *p);
bool isTypeOf(tag_t objtag, const char * type_name);
void split(std::string s, const char* delim, std::vector<std::string>* ret);
const char* newGUID();
Loading…
Cancel
Save