commit
a953a91889
@ -0,0 +1,443 @@
|
||||
# ---> C++
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
*.smod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
|
||||
# ---> VisualStudio
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUnit
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
nunit-*.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Coverlet is a free, cross platform Code Coverage Tool
|
||||
coverage*[.json, .xml, .info]
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
|
||||
# ---> C
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
|
||||
# Linker output
|
||||
*.ilk
|
||||
*.map
|
||||
*.exp
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Libraries
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.lo
|
||||
|
||||
# Shared objects (inc. Windows DLLs)
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
||||
# Debug files
|
||||
*.dSYM/
|
||||
*.su
|
||||
*.idb
|
||||
*.pdb
|
||||
|
||||
# Kernel Module Compile Results
|
||||
*.mod*
|
||||
*.cmd
|
||||
.tmp_versions/
|
||||
modules.order
|
||||
Module.symvers
|
||||
Mkfile.old
|
||||
dkms.conf
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
// HEZON_ITK.cpp : 定义控制台应用程序的入口点。
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -0,0 +1,82 @@
|
||||
<?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;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="头文件">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;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>
|
||||
<Filter Include="common">
|
||||
<UniqueIdentifier>{d25e0aa0-8791-4277-b392-abc3943f925c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="epm-handler">
|
||||
<UniqueIdentifier>{f8d4fa90-4363-4e0f-8f44-a2e02a224ad9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="userservice">
|
||||
<UniqueIdentifier>{5f8496b0-ad7e-4c6c-b832-59575601b9f1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="easylogging">
|
||||
<UniqueIdentifier>{aa5fbb6b-b5ee-4f80-8b16-de99d912a542}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ReadMe.txt" />
|
||||
<None Include="..\..\..\..\..\..\Program Files\Common Files\System\ado\msado15.dll" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="epm_register_handler.cxx">
|
||||
<Filter>epm-handler</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="bs_custom_main.cxx">
|
||||
<Filter>common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="bs_bypass.cpp">
|
||||
<Filter>epm-handler</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="kl_erp_bom.cpp">
|
||||
<Filter>epm-handler</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="kl_erp_save.cpp">
|
||||
<Filter>epm-handler</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="kl_erp_update.cpp">
|
||||
<Filter>epm-handler</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="util.cpp">
|
||||
<Filter>epm-handler</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="test.cpp">
|
||||
<Filter>epm-handler</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="common_itk_util.cpp">
|
||||
<Filter>easylogging</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="epm_register_handler.h">
|
||||
<Filter>epm-handler</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="epm_handler_common.h">
|
||||
<Filter>epm-handler</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="util.h">
|
||||
<Filter>epm-handler</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="test.h">
|
||||
<Filter>epm-handler</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="common_itk_util.h">
|
||||
<Filter>easylogging</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="error_handling.h">
|
||||
<Filter>easylogging</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -0,0 +1,44 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003-2005 UGS Corporation
|
||||
Unpublished - All Rights Reserved
|
||||
|
||||
File :qtmc_by_pass.cpp
|
||||
Module : user_exits
|
||||
|
||||
|
||||
|
||||
============================================================================================================
|
||||
DATE Name Description of Change
|
||||
30_OTC_2014 mengyawei creation
|
||||
$HISTORY$
|
||||
|
||||
============================================================================================================*/
|
||||
|
||||
#include <tc/tc.h>
|
||||
#include "epm_handler_common.h"
|
||||
#include "stdafx.h"
|
||||
#include <ict/ict_userservice.h>
|
||||
#include <tccore/custom.h>
|
||||
#include <epm/epm_toolkit_tc_utils.h>
|
||||
#include <tccore/aom.h>
|
||||
#include <tccore/aom_prop.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern "C" int POM_AM__set_application_bypass(logical bypass);
|
||||
|
||||
int bs_bypass(void *retValType)
|
||||
{
|
||||
int ifail = ITK_ok;
|
||||
|
||||
logical bypass=true;
|
||||
USERARG_get_logical_argument(&bypass);
|
||||
POM_AM__set_application_bypass( bypass );
|
||||
|
||||
return ifail;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -0,0 +1,68 @@
|
||||
/**
|
||||
* @defgroup common 公用函数
|
||||
* @defgroup workflow 流程函数
|
||||
* @defgroup bmf 业务扩展
|
||||
* @defgroup service 服务函数
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup common
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief 注册主函数
|
||||
* @date 2014/4/21
|
||||
* @author mengyawei
|
||||
*/
|
||||
|
||||
#pragma warning (disable: 4819)
|
||||
|
||||
/**
|
||||
* @headerfile tcua 头文件
|
||||
*/
|
||||
#include <tc/tc.h>
|
||||
#include <tccore/custom.h>
|
||||
#include <server_exits/user_server_exits.h>
|
||||
#include "epm_register_handler.h"
|
||||
#include "epm_handler_common.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @fn extern "C" DLLAPI int liborigin_register_callbacks
|
||||
* @return usually return ITK_ok
|
||||
* @brief liborigin customization entry
|
||||
*/
|
||||
DLLAPI int bs_register_callbacks()
|
||||
{
|
||||
int ifail = ITK_ok;
|
||||
ifail = CUSTOM_register_exit(
|
||||
"bs",
|
||||
"USERSERVICE_register_methods",
|
||||
(CUSTOM_EXIT_ftn_t)USERSERVICE_custom_register_methods) ;
|
||||
|
||||
|
||||
ifail = CUSTOM_register_exit(
|
||||
"bs",
|
||||
"USER_gs_shell_init_module",
|
||||
(CUSTOM_EXIT_ftn_t)CUST_init_module);
|
||||
|
||||
return ifail;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@ -0,0 +1,305 @@
|
||||
/**
|
||||
* @file common_itk_util.cpp
|
||||
* @brief itk warpper utility function
|
||||
* @author James
|
||||
* @history
|
||||
* ===================================================================================
|
||||
* Date Name Description of Change
|
||||
* 18-July-2008 James
|
||||
*/
|
||||
|
||||
#pragma warning (disable: 4996)
|
||||
#pragma warning (disable: 4819)
|
||||
#include "stdafx.h"
|
||||
#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/imantype.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 <tccore/imantype.h>
|
||||
//#include <textsrv/textserver.h>
|
||||
//#include <user_exits/epm_toolkit_utils.h>
|
||||
//#include <ss/ss_errors.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
//#include <io.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
//#include <direct.h>
|
||||
//#include <unistd.h>
|
||||
#include "error_handling.h"
|
||||
#include "common_itk_util.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <io.h>
|
||||
#include <direct.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define ARGS_LENGTH 200
|
||||
#define ARGS_NAME_DEBUG "-debug"
|
||||
#define DEBUG "-debug="
|
||||
#define MAX_PRINTLINE_LENGTH 2000
|
||||
#define MAX_PATH_LENGTH 2000
|
||||
#define MAX_ARGUMENT_LENGTH 400
|
||||
#define MAX_PARAMNAME_LENGTH 50
|
||||
#define MAX_FILE_EXT_LENGTH 10
|
||||
#define TRUE_FLAG 1
|
||||
#define FALSE_FLAG 0
|
||||
#define DETAILLOG 1
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
|
||||
//void set_bypass(logical bypass)
|
||||
//{
|
||||
// POM_AM__set_application_bypass(bypass);
|
||||
//}
|
||||
/*=============================================================================*
|
||||
* 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 );
|
||||
//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);
|
||||
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, "w");
|
||||
|
||||
CLEANUP:
|
||||
//DOFREE(date_string);
|
||||
DOFREE(session_uid);
|
||||
}
|
||||
void CreateLogFile(char* logFileName)
|
||||
{
|
||||
logFile = NULL;
|
||||
logFile = fopen(logFileName, "w");
|
||||
}
|
||||
|
||||
|
||||
/*=============================================================================*
|
||||
* 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 WriteLog(char* format, const char* message)
|
||||
{
|
||||
va_list arg;
|
||||
char tmp[MAX_PRINTLINE_LENGTH];
|
||||
|
||||
if(logFile)
|
||||
{
|
||||
time_t now;
|
||||
struct tm *p;
|
||||
time(&now);
|
||||
p = localtime(&now);
|
||||
char date_string[19];//20/11/2022 08:41:45.955
|
||||
memset(date_string, 0, sizeof(date_string));
|
||||
sprintf(date_string,"%02d/%02d/%4d %02d:%02d:%02d", p->tm_mday, p->tm_mon+1, 1900+p->tm_year ,p->tm_hour,p->tm_min ,p->tm_sec );
|
||||
//get the message
|
||||
//memset(tmp, 0, sizeof(tmp));
|
||||
//va_start(arg, format);
|
||||
//vsprintf(tmp, format, arg);
|
||||
//va_end(arg);
|
||||
memset(tmp, 0, sizeof(date_string) + sizeof(format) + sizeof(message) + 3);
|
||||
sprintf(tmp, "%s %s %s\n", date_string, format, message);
|
||||
|
||||
//----------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 CloseLog(void)
|
||||
{
|
||||
if(logFile)
|
||||
{
|
||||
fclose(logFile);
|
||||
logFile = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//void getTypeinfo(char *type)
|
||||
//{
|
||||
// int ulen = 0,i=0,tempcount=0,asd=0;
|
||||
//
|
||||
// char temp[128]="";
|
||||
// ulen = strlen(type);
|
||||
// asd = ulen-1;
|
||||
// for(i=0;i < ulen;i++)
|
||||
// {
|
||||
// if(type[i] == ';')
|
||||
// {
|
||||
// temp[tempcount] = '\0';
|
||||
// strcpy(excludetypes[typecount].type,temp);
|
||||
// strcpy(temp,"");
|
||||
// tempcount = 0;
|
||||
// typecount = typecount + 1;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
//
|
||||
// temp[tempcount] = type[i];
|
||||
// tempcount = tempcount + 1;
|
||||
// if(i==asd)
|
||||
// {
|
||||
// temp[tempcount] = '\0';
|
||||
// strcpy(excludetypes[typecount].type,temp);
|
||||
// typecount = typecount + 1;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//}
|
||||
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* @file common_itk_util.h
|
||||
* @brief itk warpper utility function
|
||||
* @author James
|
||||
* @history
|
||||
* ===================================================================================
|
||||
* Date Name Description of Change
|
||||
* 09-July-2008 James
|
||||
*/
|
||||
|
||||
#ifndef COMMON_ITK_UTIL
|
||||
#define COMMON_ITK_UTIL
|
||||
|
||||
#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 CreateLogFile(char* logFileName);
|
||||
void WriteLog(char* format, const char* message);
|
||||
void CloseLog(void);
|
||||
void set_bypass(logical bypass);
|
||||
void current_time( date_t * date_tag );
|
||||
//int FindDatasetReferenceExt( tag_t datasettype, const char *datasettype_ref, char ext[10] );
|
||||
//int CompareDate( date_t date1, date_t date2 );
|
||||
//int GetRandomTempFile( char tempFile[256] );
|
||||
//logical IsItemRevisionType( char object_type[WSO_name_size_c + 1] );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,61 @@
|
||||
/**
|
||||
* @addtogroup handler
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file epm_handler_common.h
|
||||
* @brief handler functions declation
|
||||
* @date 2011/4/12
|
||||
* @author Ray
|
||||
* @history
|
||||
* ===================================================================================
|
||||
* Date Name Description
|
||||
* 12-Apr-2011 Ray created
|
||||
*/
|
||||
|
||||
|
||||
#ifndef EPM_HANDLER_COMMON
|
||||
#define EPM_HANDLER_COMMON
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <epm/epm.h>
|
||||
#include <string>
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
#define TC_specification "IMAN_specification"
|
||||
//#define NX_3W_DATASET_TYPE "UGMASTER"
|
||||
//#define NX_2W_DATASET_TYPE "UGPART"
|
||||
//#define DATASET_REF_TYPE "UGPART"
|
||||
|
||||
|
||||
////将流程信息签入版本属性上去
|
||||
//int qtmc_sign_ir(EPM_action_message_t msg);
|
||||
|
||||
int kl_erp_save(EPM_action_message_t msg);
|
||||
int kl_erp_update(EPM_action_message_t msg);
|
||||
int kl_erp_bom(EPM_action_message_t msg);
|
||||
int sap(EPM_action_message_t msg);
|
||||
|
||||
|
||||
|
||||
//user service end
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@ -0,0 +1,36 @@
|
||||
|
||||
/*=================================================================================
|
||||
* @file epm_register_handler.h
|
||||
* @brief itk user exits function declation, to register custom handlers
|
||||
* @date 2009/2/13
|
||||
* @author Ray Li
|
||||
* @history
|
||||
* ===================================================================================
|
||||
* Date Name Description
|
||||
* 13-Feb-2009 Ray created
|
||||
*===================================================================================*/
|
||||
|
||||
|
||||
#ifndef EPM_REGISTER_HANDLER_CUSTOM
|
||||
#define EPM_REGISTER_HANDLER_CUSTOM
|
||||
|
||||
#include <epm/epm.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern DLLAPI int CUST_init_module(int *, va_list);
|
||||
extern DLLAPI int USERSERVICE_custom_register_methods();
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@ -0,0 +1,162 @@
|
||||
/*!
|
||||
* @addtogroup common
|
||||
* \file error_handling.h
|
||||
* \brief 错误处理函数
|
||||
* \date 2008/6/10
|
||||
* \author Ray Li
|
||||
*/
|
||||
|
||||
#ifndef SIMPLE_ERR_H_INCLUDED
|
||||
#define SIMPLE_ERR_H_INCLUDED
|
||||
|
||||
|
||||
#include <itk/mem.h>
|
||||
#include <tc/iman.h>
|
||||
#include <tc/emh.h>
|
||||
#include <pom/pom/pom_errors.h>
|
||||
#include <tc/emh_const.h>
|
||||
#include <tc/tc.h>
|
||||
#include <pom/pom/pom.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#define BUFSIZE 512
|
||||
|
||||
|
||||
//
|
||||
#define HANDLER_ARGUMENT_ERROR EMH_USER_error_base + 1
|
||||
//#define WORKFLOW_NODE_IS_NOT_VALID EMH_USER_error_base + 2
|
||||
|
||||
#define ERROR_STATUS_ERROR EMH_USER_error_base + 2
|
||||
//#define HANDLER_PLACED_INVALID EMH_USER_error_base + 3
|
||||
//
|
||||
////user errors define
|
||||
////<error id="100">在站点文件中缺少 %1$ 配置,或该配置中无数据项</error>
|
||||
//#define ERROR_PREFERENCE_NOT_FOUND (EMH_USER_error_base + 100)
|
||||
|
||||
|
||||
#define DOFREE(obj) \
|
||||
{ \
|
||||
if(obj) \
|
||||
{ \
|
||||
MEM_free(obj); \
|
||||
obj = NULL; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
|
||||
//#define ECHO(X) printf X;
|
||||
#define SYS_LOG(X) IMAN_write_syslog X;
|
||||
#define LOG_ECHO(X) printf X; IMAN_write_syslog X;
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* \def CALL(x)
|
||||
* 打印错误信息
|
||||
*/
|
||||
#define CALL(x) { \
|
||||
int stat; \
|
||||
char *err_string; \
|
||||
if( (stat = (x)) != ITK_ok) \
|
||||
{ \
|
||||
EMH_ask_error_text (stat, &err_string); \
|
||||
LOG_ECHO( ("ERROR: %d ERROR MSG: %s.\n",stat, err_string) ) \
|
||||
LOG_ECHO( ("Function: %s FILE: %s LINE: %d\n", #x, __FILE__, __LINE__ ) ) \
|
||||
MEM_free (err_string); \
|
||||
return (stat); \
|
||||
} \
|
||||
}
|
||||
|
||||
/*!
|
||||
* \def DO(x)
|
||||
* 打印错误信息
|
||||
*/
|
||||
#define DO(x) { \
|
||||
int stat; \
|
||||
char *err_string; \
|
||||
if( (stat = (x)) != POM_ok) \
|
||||
{ \
|
||||
EMH_ask_error_text (stat, &err_string); \
|
||||
printf ("ERROR: %d ERROR MSG: %s.\n", stat, err_string); \
|
||||
printf ("Function: %s FILE: %s LINE: %d\n",#x, __FILE__, __LINE__); \
|
||||
MEM_free (err_string); \
|
||||
} \
|
||||
}
|
||||
|
||||
/*!
|
||||
* \def CALLRNULL(x)
|
||||
* 打印错误信息
|
||||
*/
|
||||
#define CALLRNULL(x) { \
|
||||
int stat; \
|
||||
char *err_string; \
|
||||
if( (stat = (x)) != ITK_ok) \
|
||||
{ \
|
||||
EMH_ask_error_text (stat, &err_string); \
|
||||
printf ("ERROR: %d ERROR MSG: %s.\n", stat, err_string); \
|
||||
printf ("Function: %s FILE: %s LINE: %d\n",#x, __FILE__, __LINE__); \
|
||||
MEM_free (err_string); \
|
||||
return ((char *)NULL); \
|
||||
} \
|
||||
}
|
||||
|
||||
/*!
|
||||
* \def CALL2(x)
|
||||
* 打印错误信息
|
||||
*/
|
||||
#define CALL2(x) { \
|
||||
int stat, n_ifails, *serverities, *ifails, err_count; \
|
||||
char *err_string, **texts; \
|
||||
if( (stat = (x)) != ITK_ok) \
|
||||
{ \
|
||||
printf ("Function: %s FILE: %s LINE: %d\n",#x, __FILE__, __LINE__); \
|
||||
EMH_ask_errors( &n_ifails, (const int**)(&serverities), (const int**)(&ifails), (const char***)(&texts) );\
|
||||
for( err_count=0; err_count<n_ifails; err_count++ ) \
|
||||
{ \
|
||||
printf( "ERROR: %d ERROR MSG: %s.\n", ifails[i], texts[i] ); \
|
||||
} \
|
||||
MEM_free( serverities ); \
|
||||
MEM_free( ifails ); \
|
||||
MEM_free( texts ); \
|
||||
return (stat); \
|
||||
} \
|
||||
} \
|
||||
|
||||
#define CHECK_FILE(x,ret) { \
|
||||
FILE *stream = NULL; \
|
||||
if( (stream = fopen(x,"rb")) == NULL ) { \
|
||||
printf( "%s doesn't exists, please check!\n", x ); \
|
||||
IMAN_write_syslog( "%s doesn't exists, please check!\n", x) ; \
|
||||
ret = -1; \
|
||||
} \
|
||||
else { \
|
||||
fclose(stream); \
|
||||
stream = NULL; \
|
||||
ret = 0; \
|
||||
} \
|
||||
} \
|
||||
|
||||
|
||||
#define CHECK_FILE_NOT_EXISTS(x,ret) { \
|
||||
FILE *stream = NULL; \
|
||||
if( (stream = fopen(x,"rb")) != NULL ) { \
|
||||
fclose(stream); \
|
||||
stream = NULL; \
|
||||
printf( "%s exists, please check!\n", x ); \
|
||||
IMAN_write_syslog( "%s exists, please check!\n", x) ; \
|
||||
ret = -1; \
|
||||
} \
|
||||
else { \
|
||||
ret = 0; \
|
||||
} \
|
||||
} \
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,46 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003-2005 UGS Corporation
|
||||
Unpublished - All Rights Reserved
|
||||
|
||||
File :qtmc_by_pass.cpp
|
||||
Module : user_exits
|
||||
|
||||
|
||||
|
||||
============================================================================================================
|
||||
DATE Name Description of Change
|
||||
30_OTC_2014 mengyawei creation
|
||||
$HISTORY$
|
||||
|
||||
============================================================================================================*/
|
||||
|
||||
#include <tc/tc.h>
|
||||
#include "epm_handler_common.h"
|
||||
|
||||
#include <ict/ict_userservice.h>
|
||||
#include <tccore/custom.h>
|
||||
#include <epm/epm_toolkit_tc_utils.h>
|
||||
#include <tccore/aom.h>
|
||||
#include <tccore/aom_prop.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern "C" int POM_AM__set_application_bypass(logical bypass);
|
||||
|
||||
int qtmc_by_pass(void *retValType)
|
||||
{
|
||||
int ifail = ITK_ok;
|
||||
|
||||
logical bypass = FALSE;
|
||||
|
||||
USERARG_get_logical_argument( &bypass );
|
||||
|
||||
POM_AM__set_application_bypass( bypass );
|
||||
|
||||
return ifail;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -0,0 +1,258 @@
|
||||
#include "util.h"
|
||||
|
||||
int erp_update(tag_t task, string key_str, string pref1, string pref2)
|
||||
{
|
||||
printf("start kl_erp_update\n");
|
||||
tag_t *atts, root_task;
|
||||
int att_cnt;
|
||||
EPM_ask_root_task(task, &root_task);
|
||||
EPM_ask_attachments(root_task, EPM_target_attachment, &att_cnt, &atts);
|
||||
int pref_cnt, pref_cnt2;
|
||||
char **pref_vals, **pref_vals2;
|
||||
PREF_ask_char_values(pref1.c_str(), &pref_cnt, &pref_vals);
|
||||
PREF_ask_char_values(pref2.c_str(), &pref_cnt2, &pref_vals2);
|
||||
vector<Value*> configs;
|
||||
Document doc0, doc1, doc2, doc3, doc4, doc5, doc6, doc7;
|
||||
vector<Document*> vec;
|
||||
vec.push_back(&doc0);
|
||||
vec.push_back(&doc1);
|
||||
vec.push_back(&doc2);
|
||||
vec.push_back(&doc3);
|
||||
vec.push_back(&doc4);
|
||||
vec.push_back(&doc5);
|
||||
vec.push_back(&doc6);
|
||||
vec.push_back(&doc7);
|
||||
|
||||
for (auto i = 0; i<pref_cnt2; i++)
|
||||
{
|
||||
vec[i]->Parse(pref_vals2[i]);
|
||||
configs.push_back(vec[i]);
|
||||
}
|
||||
|
||||
string ip = pref_vals[0];
|
||||
string token_url = ip + "/K3API/Token/Create?authorityCode=" + pref_vals[1];
|
||||
POM_AM__set_application_bypass(true);
|
||||
System::String ^key = convert_to_cstring(key_str.c_str());
|
||||
Testclass ^class1 = gcnew Testclass();
|
||||
string token = ConvertToString(class1->GetToken(convert_to_cstring(token_url.c_str()),key));
|
||||
printf("token:%s\n", token.c_str());
|
||||
string s_url = ip + "/K3API/Material/Update?token=" + token;
|
||||
System::String ^save_url = convert_to_cstring(s_url.c_str());
|
||||
|
||||
for (auto i = 0; i<att_cnt; i++)
|
||||
{
|
||||
int type = -1;
|
||||
if (isTypeOf(atts[i], "KL3_MaterialRevisionMaster"))
|
||||
{
|
||||
type = 0;
|
||||
}
|
||||
else if (isTypeOf(atts[i], "KL3_SemiProductRevisionMaster"))
|
||||
{
|
||||
type = 1;
|
||||
}
|
||||
else if (isTypeOf(atts[i], "KL3_ProductRevisionMaster"))
|
||||
{
|
||||
type = 2;
|
||||
}
|
||||
else if (isTypeOf(atts[i], "KL3_MouldRevisionMaster"))
|
||||
{
|
||||
type = 3;
|
||||
}
|
||||
else if (isTypeOf(atts[i], "KL3_MMaterialRevisionMaster"))
|
||||
{
|
||||
type = 4;
|
||||
}
|
||||
else if (isTypeOf(atts[i], "KL3_GJLRevisionMaster"))
|
||||
{
|
||||
type = 5;
|
||||
}
|
||||
else if (isTypeOf(atts[i], "KL3_VirtualRevisionMaster"))
|
||||
{
|
||||
type = 6;
|
||||
}
|
||||
printf("type:%d\n", type);
|
||||
if (type == -1)
|
||||
continue;
|
||||
string syzt = get_val(atts[i], "kl3_syzt");
|
||||
if (syzt == "½ûÓÃ")
|
||||
continue;
|
||||
int ref_cnt, *levels;
|
||||
tag_t *refs, rev = NULLTAG;
|
||||
char **relations;
|
||||
WSOM_where_referenced(atts[i], 1, &ref_cnt, &levels, &refs, &relations);
|
||||
for (auto j = 0; j<ref_cnt; j++)
|
||||
{
|
||||
if (isTypeOf(refs[j], "ItemRevision"))
|
||||
{
|
||||
rev = refs[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
printf("handle:%s\n", get_val(rev, "object_name"));
|
||||
|
||||
Document doc;
|
||||
doc.SetObject();
|
||||
Document::AllocatorType &al = doc.GetAllocator();
|
||||
Value data(kObjectType);
|
||||
|
||||
if (type != 1 && type != 2 && type != 6)
|
||||
{
|
||||
data.AddMember("Fmaund", 0, al);
|
||||
}
|
||||
else
|
||||
{
|
||||
Value maund(kObjectType);
|
||||
string zldw = get_val(atts[i], "kl3_zldw");
|
||||
maund.AddMember("FNumber", (*configs[3])[zldw.c_str()], al);
|
||||
maund.AddMember("FName", Value().SetString(zldw.c_str(), al), al);
|
||||
data.AddMember("Fmaund", maund, al);
|
||||
}
|
||||
printf("111\n");
|
||||
|
||||
Value manager(kObjectType);
|
||||
manager.AddMember("FName", Value().SetString(pref_vals[2], al), al);
|
||||
manager.AddMember("FNumber", Value().SetString(pref_vals[3], al), al);
|
||||
data.AddMember("FDSManagerID", manager, al);
|
||||
|
||||
data.AddMember("FName", Value().SetString(get_val(rev, "object_name"), al), al);
|
||||
data.AddMember("FNumber", Value().SetString(get_val(rev, "item_id"), al), al);
|
||||
data.AddMember("FModel", Value().SetString(get_val(atts[i], "kl3_item_ggxh"), al), al);
|
||||
|
||||
data.AddMember("FKFPeriod", (type<3 || type>5) ? (Value().SetString(get_val(atts[i], "kl3_bzqt"), al)) : Value().SetString("", al), al);
|
||||
data.AddMember("FISKFPeriod", true, al);
|
||||
|
||||
data.AddMember("FFixLeadTime", (type != 1 && type != 2 && type != 6) ? (Value().SetString(get_val(atts[i], "kl3_gdtql"), al)) : Value().SetString("", al), al);
|
||||
data.AddMember("F_132", (type<3 || type == 6) ? (Value().SetString(get_val(atts[i], "kl3_color"), al)) : Value().SetString("", al), al);
|
||||
|
||||
|
||||
data.AddMember("FErpClsID", get_wlsx(get_val(atts[i], "kl3_item_wlsx"), al, *configs[5]), al);
|
||||
|
||||
string jldwz = get_val(atts[i], "kl3_jldwz");
|
||||
int jldw_index = jldwz.find('/');
|
||||
jldwz = jldw_index != -1 ? jldwz.substr(0, jldw_index) : jldwz;
|
||||
Value &jldw_val = (*configs[4])[jldwz.c_str()];
|
||||
if (!jldw_val.IsNull())
|
||||
{
|
||||
// Value jldw(kObjectType);
|
||||
// jldw.AddMember("FName", Value().SetString(jldwz.c_str(), al), al);
|
||||
// jldw.AddMember("FNumber", Value().SetString(jldw_val["id"].GetString(), al), al);
|
||||
// data.AddMember("FUnitGroupID", jldw, al);
|
||||
data.AddMember("FUnitID", get_jldw(get_val(atts[i], "kl3_jbjldw"), al, jldw_val), al);
|
||||
data.AddMember("FOrderUnitID", get_jldw(get_val(atts[i], "kl3_cgjldw"), al, jldw_val), al);
|
||||
data.AddMember("FSaleUnitID", get_jldw(get_val(atts[i], "kl3_xsjldw"), al, jldw_val), al);
|
||||
data.AddMember("FProductUnitID", get_jldw(get_val(atts[i], "kl3_item_scjldw"), al, jldw_val), al);
|
||||
data.AddMember("FStoreUnitID", get_jldw(get_val(atts[i], "kl3_kcjldw"), al, jldw_val), al);
|
||||
}
|
||||
printf("222\n");
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
data.AddMember("FDefaultLoc", 651, al);
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
data.AddMember("FDefaultLoc", (*configs[1])[get_val(atts[i], "kl3_mrck")], al);
|
||||
|
||||
break;
|
||||
case 3:
|
||||
case 5:
|
||||
data.AddMember("FDefaultLoc", 666, al);
|
||||
break;
|
||||
case 4:
|
||||
data.AddMember("FDefaultLoc", 667, al);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (type == 0)
|
||||
{
|
||||
data.AddMember("FSecInv", Value().SetString(get_val(atts[i], "kl3_aqkcsl"), al), al);
|
||||
data.AddMember("FQtyMin", Value().SetString(get_val(atts[i], "kl3_zxdhl"), al), al);
|
||||
data.AddMember("FBatchAppendQty", Value().SetString(get_val(atts[i], "kl3_plzl"), al), al);
|
||||
data.AddMember("F_112", Value().SetString(get_val(atts[i], "kl3_brand"), al), al);
|
||||
data.AddMember("F_106", Value().SetString(get_val(atts[i], "kl3_dxsl"), al), al);
|
||||
data.AddMember("F_131", Value().SetString(get_val(atts[i], "kl3_clfl"), al), al);
|
||||
|
||||
}
|
||||
if (type == 2)
|
||||
{
|
||||
Value type_id(kObjectType);
|
||||
string wlfl = get_val(atts[i], "kl3_wlfl");
|
||||
type_id.AddMember("FID", (*configs[0])[wlfl.c_str()], al);
|
||||
type_id.AddMember("FName", Value().SetString(wlfl.c_str(), al), al);
|
||||
data.AddMember("FTypeID", type_id, al);
|
||||
data.AddMember("F_112", Value().SetString(get_val(atts[i], "kl3_brand"), al), al);
|
||||
data.AddMember("F_109", Value().SetString(get_val(atts[i], "kl3_bzsj"), al), al);
|
||||
data.AddMember("F_118", Value().SetString(get_val(atts[i], "kl3_bzyf"), al), al);
|
||||
data.AddMember("F_124", Value().SetString(get_val(atts[i], "kl3_cx"), al), al);
|
||||
data.AddMember("F_114", Value().SetString(get_val(atts[i], "kl3_lcrq"), al), al);
|
||||
data.AddMember("F_104", Value().SetString(get_val(atts[i], "kl3_ncl"), al), al);
|
||||
data.AddMember("F_105", Value().SetString(get_val(atts[i], "kl3_yl"), al), al);
|
||||
data.AddMember("F_119", Value().SetString(get_val(atts[i], "kl3_sm"), al), al);
|
||||
data.AddMember("F_106", Value().SetString(get_val(atts[i], "kl3_dxsl"), al), al);
|
||||
data.AddMember("F_133", Value().SetString(get_val(atts[i], "kl3_OTSdhrq"), al), al);
|
||||
data.AddMember("F_134", Value().SetString(get_val(atts[i], "kl3_zjcmc"), al), al);
|
||||
data.AddMember("F_135", Value().SetString(get_val(atts[i], "kl3_lccxmc"), al), al);
|
||||
data.AddMember("F_136", 0, al);
|
||||
data.AddMember("F_138", 0, al);
|
||||
data.AddMember("F_137", Value().SetString(get_val(atts[i], "kl3_cpzt"), al), al);
|
||||
}
|
||||
if (type == 4)
|
||||
{
|
||||
data.AddMember("FSecInv", Value().SetString(get_val(atts[i], "kl3_aqkc"), al), al);
|
||||
data.AddMember("FLowLimit", Value().SetString(get_val(atts[i], "kl3_zdkc"), al), al);
|
||||
data.AddMember("FHighLimit", Value().SetString(get_val(atts[i], "kl3_zgkc"), al), al);
|
||||
}
|
||||
Value data2(kObjectType);
|
||||
data2.AddMember("FNumber", Value().SetString(get_val(rev, "item_id"), al), al);
|
||||
data2.AddMember("Data", data, al);
|
||||
doc.AddMember("Data", data2, al);
|
||||
StringBuffer sb;
|
||||
Writer<StringBuffer> writer(sb);
|
||||
doc.Accept(writer);
|
||||
printf("data:%s\n", sb.GetString());
|
||||
string result = ConvertToString(class1->Send(save_url, convert_to_cstring(sb.GetString()),key));
|
||||
printf("result:%s\n", result.c_str());
|
||||
if(result[0]=='s')
|
||||
{
|
||||
//LOG(INFO) << result;
|
||||
printf("result£º%s\n", result.c_str());
|
||||
}else
|
||||
{
|
||||
//LOG(ERROR) << result;
|
||||
printf("result(ERROR)£º%s\n", result.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
POM_AM__set_application_bypass(false);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int kl_erp_update(EPM_action_message_t msg)
|
||||
{
|
||||
int arg_cnt = TC_number_of_arguments(msg.arguments);
|
||||
string key, pref1, pref2;
|
||||
for (auto i = 0; i<arg_cnt; i++)
|
||||
{
|
||||
char *temp_key, *temp_val;
|
||||
ITK_ask_argument_named_value(TC_next_argument(msg.arguments), &temp_key, &temp_val);
|
||||
if (tc_strcmp(temp_key, "key")==0)
|
||||
{
|
||||
key = temp_val;
|
||||
}
|
||||
else if (tc_strcmp(temp_key, "pref1")==0)
|
||||
{
|
||||
pref1 = temp_val;
|
||||
}
|
||||
else if (tc_strcmp(temp_key, "pref2")==0)
|
||||
{
|
||||
pref2 = temp_val;
|
||||
}
|
||||
}
|
||||
printf("key:%s\n", key.c_str());
|
||||
printf("pref1:%s\n", pref1.c_str());
|
||||
printf("pref2:%s\n", pref2.c_str());
|
||||
return erp_update(msg.task,key,pref1,pref2);
|
||||
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
/**
|
||||
* @defgroup common 公用函数
|
||||
* @defgroup workflow 流程函数
|
||||
* @defgroup bmf 业务扩展
|
||||
* @defgroup service 服务函数
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup common
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief 注册主函数
|
||||
* @date 2014/4/21
|
||||
* @author mengyawei
|
||||
*/
|
||||
|
||||
#pragma warning (disable: 4819)
|
||||
|
||||
/**
|
||||
* @headerfile tcua 头文件
|
||||
*/
|
||||
#include <tc/tc.h>
|
||||
#include <tccore/custom.h>
|
||||
#include <server_exits/user_server_exits.h>
|
||||
#include "error_handling.h"
|
||||
#include "epm_register_handler.h"
|
||||
#include "epm_handler_common.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @fn extern "C" DLLAPI int liborigin_register_callbacks
|
||||
* @return usually return ITK_ok
|
||||
* @brief liborigin customization entry
|
||||
*/
|
||||
DLLAPI int libqtmc_register_callbacks()
|
||||
{
|
||||
int ifail = ITK_ok;
|
||||
|
||||
CALL( ifail = CUSTOM_register_exit(
|
||||
"libqtmc",
|
||||
"USERSERVICE_register_methods",
|
||||
(CUSTOM_EXIT_ftn_t)USERSERVICE_custom_register_methods) );
|
||||
fprintf( stdout, "\n libqtmc registering USERSERVICE_register_methods completed!\n" );
|
||||
|
||||
CALL( ifail = CUSTOM_register_exit(
|
||||
"libqtmc",
|
||||
"USER_gs_shell_init_module",
|
||||
(CUSTOM_EXIT_ftn_t)CUST_init_module));
|
||||
fprintf( stdout, "\n libqtmc registering USER_gs_shell_init_module completed!\n" );
|
||||
|
||||
return ifail;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@ -0,0 +1,8 @@
|
||||
// stdafx.cpp : 只包括标准包含文件的源文件
|
||||
// HEZON_ITK.pch 将作为预编译头
|
||||
// stdafx.obj 将包含预编译类型信息
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: 在 STDAFX.H 中
|
||||
// 引用任何所需的附加头文件,而不是在此文件中引用
|
||||
@ -0,0 +1,15 @@
|
||||
// stdafx.h : 标准系统包含文件的包含文件,
|
||||
// 或是经常使用但不常更改的
|
||||
// 特定于项目的包含文件
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <tchar.h>
|
||||
|
||||
|
||||
|
||||
// TODO: 在此处引用程序需要的其他头文件
|
||||
@ -0,0 +1,146 @@
|
||||
/**
|
||||
* @file string_helper.cpp
|
||||
* @brief string utility functions' implemention
|
||||
* @author James
|
||||
* @history
|
||||
* ===================================================================================
|
||||
* Date Name Description of Change
|
||||
* 09-July-2008 James
|
||||
* 14-Jau-2009 James modify Split functions, add trim blank characters
|
||||
*/
|
||||
#pragma warning(disable:4996)
|
||||
//
|
||||
//#include <stdio.h>
|
||||
//#include <iostream>
|
||||
//#include <windows.h>
|
||||
#include "string_helper.h"
|
||||
|
||||
string TrimString( string strArg )
|
||||
{
|
||||
size_t index1 = 0;
|
||||
index1 = strArg.find_first_not_of( ' ');
|
||||
if( index1 != string::npos )
|
||||
strArg.erase( strArg.begin(), strArg.begin()+index1 );
|
||||
index1 = strArg.find_last_not_of( ' ');
|
||||
if( index1 != string::npos )
|
||||
strArg.erase( strArg.begin() + index1 + 1 );
|
||||
return strArg;
|
||||
}
|
||||
|
||||
void Split( string strArg, char spliter, vector<string> &ans )
|
||||
{
|
||||
ans.clear();
|
||||
size_t index0 = 0;
|
||||
string one_arg;
|
||||
if ( strArg.find_first_not_of(' ') == string.npos )
|
||||
strArg = "";
|
||||
while( strArg.size()>0 )
|
||||
{
|
||||
index0 = strArg.find_first_of( spliter );
|
||||
if( index0 != string::npos )
|
||||
{
|
||||
one_arg = strArg.substr( 0,index0 );
|
||||
strArg = strArg.substr( index0 + 1 );
|
||||
ans.push_back( one_arg );
|
||||
}
|
||||
else
|
||||
{
|
||||
ans.push_back( strArg );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Split( string strArg, string spliter, vector<string> &ans )
|
||||
{
|
||||
|
||||
ans.clear();
|
||||
|
||||
size_t index0;
|
||||
string one_arg;
|
||||
|
||||
if ( strArg.find_first_not_of(" ") == string::npos )
|
||||
strArg = "";
|
||||
|
||||
|
||||
while( strArg.size()>0 )
|
||||
{
|
||||
|
||||
index0 = strArg.find(spliter);
|
||||
|
||||
if( index0 != string::npos )
|
||||
{
|
||||
|
||||
one_arg = strArg.substr( 0, index0 );
|
||||
strArg = strArg.substr( index0 + spliter.size() );
|
||||
|
||||
ans.push_back( one_arg );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
ans.push_back( strArg );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RemoveLiner( string &in, string &out )
|
||||
{
|
||||
char buf[BUFSIZ] = "";
|
||||
for( int i=0; i<(int)in.size(); i++ )
|
||||
{
|
||||
if( in[i] == '\n')
|
||||
continue;
|
||||
else
|
||||
sprintf( buf,"%s%c", buf, in[i] );
|
||||
}
|
||||
out.assign(buf);
|
||||
}
|
||||
|
||||
////Converting a WChar string to a Ansi string
|
||||
//std::string WChar2Ansi(LPCWSTR pwszSrc)
|
||||
//{
|
||||
// int nLen = WideCharToMultiByte(CP_ACP, 0, pwszSrc, -1, NULL, 0, NULL, NULL);
|
||||
//
|
||||
// if (nLen<= 0) return std::string("");
|
||||
//
|
||||
// char* pszDst = new char[nLen];
|
||||
// if (NULL == pszDst) return std::string("");
|
||||
//
|
||||
// WideCharToMultiByte(CP_ACP, 0, pwszSrc, -1, pszDst, nLen, NULL, NULL);
|
||||
// pszDst[nLen -1] = 0;
|
||||
//
|
||||
// std::string strTemp(pszDst);
|
||||
// delete [] pszDst;
|
||||
//
|
||||
// return strTemp;
|
||||
//}
|
||||
//
|
||||
//string ws2s(wstring& inputws){ return WChar2Ansi(inputws.c_str()); }
|
||||
//
|
||||
////Converting a Ansi string to WChar string
|
||||
//std::wstring Ansi2WChar(LPCSTR pszSrc, int nLen)
|
||||
//{
|
||||
// int nSize = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pszSrc, nLen, 0, 0);
|
||||
// if(nSize <= 0) return NULL;
|
||||
//
|
||||
// WCHAR *pwszDst = new WCHAR[nSize+1];
|
||||
// if( NULL == pwszDst) return NULL;
|
||||
//
|
||||
// MultiByteToWideChar(CP_ACP, 0,(LPCSTR)pszSrc, nLen, pwszDst, nSize);
|
||||
// pwszDst[nSize] = 0;
|
||||
//
|
||||
// if( pwszDst[0] == 0xFEFF) // skip Oxfeff
|
||||
// for(int i = 0; i < nSize; i ++)
|
||||
// pwszDst[i] = pwszDst[i+1];
|
||||
//
|
||||
// wstring wcharString(pwszDst);
|
||||
// delete pwszDst;
|
||||
//
|
||||
// return wcharString;
|
||||
//}
|
||||
//
|
||||
//std::wstring s2ws(const string& s){ return Ansi2WChar(s.c_str(),s.size());}
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @file string_helper.h
|
||||
* @brief string utilities to help dealing with string
|
||||
* @author James
|
||||
* @history
|
||||
* ===================================================================================
|
||||
* Date Name Description of Change
|
||||
* 09-July-2008 James
|
||||
*/
|
||||
|
||||
#ifndef STRING_HELPER
|
||||
#define STRING_HELPER
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
string TrimString( string strArg );
|
||||
void Split( string strArg, char spliter, vector<string> &ans );
|
||||
void Split( string strArg, string spliter, vector<string> &ans );
|
||||
void RemoveLiner( string &in, string &out );
|
||||
//string ws2s(wstring& inputws);
|
||||
//wstring s2ws(const string& s);
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,56 @@
|
||||
|
||||
#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 <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 "rapidjson/document.h" // rapidjson's DOM-style API
|
||||
#include "rapidjson/writer.h"
|
||||
#include "rapidjson/stringbuffer.h"
|
||||
#include "rapidjson/prettywriter.h"
|
||||
#include "easylogging++.h"
|
||||
@ -0,0 +1,108 @@
|
||||
#include "util.h"
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
char * get_val(tag_t tag, char *name)
|
||||
{
|
||||
char *val;
|
||||
AOM_UIF_ask_value(tag, name, &val);
|
||||
return val;
|
||||
}
|
||||
char * get_real_val(tag_t tag, char *name)
|
||||
{
|
||||
char *val;
|
||||
AOM_ask_value_string(tag, name, &val);
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Value get_jldw(const char *str, Document::AllocatorType &al,Value &config)
|
||||
{
|
||||
Value val(kObjectType);
|
||||
if(config.HasMember(str))
|
||||
{
|
||||
val.AddMember("FName", Value().SetString(str,al), al);
|
||||
val.AddMember("FNumber",Value().SetString(config[str]["id"].GetString(),al), al);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
Value get_wlsx(string str, Document::AllocatorType &al,Value &config)
|
||||
{
|
||||
Value val(kObjectType);
|
||||
char *name = "", *id = "";
|
||||
if(config.HasMember(str.c_str()))
|
||||
{
|
||||
val.AddMember("FID", Value().SetString(config[str.c_str()].GetString(), al), al);
|
||||
val.AddMember("FName", Value().SetString(str.c_str(), al), al);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
Value get_acct(string str, Document::AllocatorType &al,int type,Value &config)
|
||||
{
|
||||
Value val(kObjectType);
|
||||
|
||||
if(config.HasMember(str.c_str()))
|
||||
{
|
||||
val.AddMember("FName",Value().SetString(config[str.c_str()]["name"].GetString(),al), al);
|
||||
if (type == 0)
|
||||
{
|
||||
val.AddMember("FNumber", Value().SetString(config[str.c_str()]["acct"].GetString(), al), al);
|
||||
}
|
||||
else if (type == 1)
|
||||
{
|
||||
val.AddMember("FNumber", Value().SetString(config[str.c_str()]["sale"].GetString(), al), al);
|
||||
}
|
||||
else
|
||||
{
|
||||
val.AddMember("FNumber", Value().SetString(config[str.c_str()]["cost"].GetString(), al), al);
|
||||
}
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
string getTime()
|
||||
{
|
||||
stringstream ss;
|
||||
time_t t = time(0);
|
||||
tm* local = localtime(&t);
|
||||
ss << local->tm_year + 1900 << '-';
|
||||
|
||||
ss << local->tm_mon + 1 << '-';
|
||||
|
||||
ss << local->tm_mday << ' ';
|
||||
|
||||
ss << local->tm_hour << ':';
|
||||
|
||||
ss << local->tm_min << ':';
|
||||
|
||||
ss << local->tm_sec;
|
||||
return ss.str();
|
||||
}
|
||||
@ -0,0 +1,83 @@
|
||||
#pragma once
|
||||
#using "D:/declib.dll"
|
||||
|
||||
#include "epm_handler_common.h"
|
||||
|
||||
//#include <system.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 <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 "rapidjson/document.h" // rapidjson's DOM-style API
|
||||
#include "rapidjson/writer.h"
|
||||
#include "rapidjson/stringbuffer.h"
|
||||
#include "rapidjson/prettywriter.h"
|
||||
//#include "easylogging++.h"
|
||||
//#ifndef easylog
|
||||
//#define easylog
|
||||
|
||||
//_INITIALIZE_EASYLOGGINGPP
|
||||
//#endif
|
||||
|
||||
//using namespace easyloggingpp;
|
||||
using namespace rapidjson;
|
||||
|
||||
using namespace Testdll;
|
||||
|
||||
using namespace std;
|
||||
|
||||
extern "C" int POM_AM__set_application_bypass(logical bypass);
|
||||
string ConvertToString(System::String^ str);
|
||||
char * get_val(tag_t tag, char *name);
|
||||
char * get_real_val(tag_t tag, char *name);
|
||||
|
||||
bool isTypeOf(tag_t objtag, const char * type_name);
|
||||
Value get_jldw(const char *str, Document::AllocatorType &al,Value &val);
|
||||
Value get_wlsx(string str, Document::AllocatorType &al,Value &val);
|
||||
System::String ^ convert_to_cstring(const char *p);
|
||||
Value get_acct(string str, Document::AllocatorType &al, int type,Value &val);
|
||||
string getTime();
|
||||
@ -0,0 +1,273 @@
|
||||
/**
|
||||
* @file common_itk_util.cpp
|
||||
* @brief itk warpper utility function
|
||||
* @author James
|
||||
* @history
|
||||
* ===================================================================================
|
||||
* Date Name Description of Change
|
||||
* 18-July-2008 James
|
||||
*/
|
||||
|
||||
#pragma warning (disable: 4996)
|
||||
#pragma warning (disable: 4819)
|
||||
|
||||
#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/imantype.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 <tccore/imantype.h>
|
||||
//#include <textsrv/textserver.h>
|
||||
//#include <user_exits/epm_toolkit_utils.h>
|
||||
//#include <ss/ss_errors.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
//#include <io.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
//#include <direct.h>
|
||||
//#include <unistd.h>
|
||||
#include "error_handling.h"
|
||||
#include "common_itk_util.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <io.h>
|
||||
#include <direct.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define ARGS_LENGTH 200
|
||||
#define ARGS_NAME_DEBUG "-debug"
|
||||
#define DEBUG "-debug="
|
||||
#define MAX_PRINTLINE_LENGTH 2000
|
||||
#define MAX_PATH_LENGTH 2000
|
||||
#define MAX_ARGUMENT_LENGTH 400
|
||||
#define MAX_PARAMNAME_LENGTH 50
|
||||
#define MAX_FILE_EXT_LENGTH 10
|
||||
#define TRUE_FLAG 1
|
||||
#define FALSE_FLAG 0
|
||||
#define DETAILLOG 1
|
||||
|
||||
|
||||
FILE* logFile = NULL;
|
||||
|
||||
void set_bypass(logical bypass)
|
||||
{
|
||||
AM__set_application_bypass(bypass);
|
||||
}
|
||||
/*=============================================================================*
|
||||
* 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 );
|
||||
//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);
|
||||
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, "w");
|
||||
|
||||
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 WriteLog(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 CloseLog(void)
|
||||
{
|
||||
if(logFile)
|
||||
{
|
||||
fclose(logFile);
|
||||
logFile = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//void getTypeinfo(char *type)
|
||||
//{
|
||||
// int ulen = 0,i=0,tempcount=0,asd=0;
|
||||
//
|
||||
// char temp[128]="";
|
||||
// ulen = strlen(type);
|
||||
// asd = ulen-1;
|
||||
// for(i=0;i < ulen;i++)
|
||||
// {
|
||||
// if(type[i] == ';')
|
||||
// {
|
||||
// temp[tempcount] = '\0';
|
||||
// strcpy(excludetypes[typecount].type,temp);
|
||||
// strcpy(temp,"");
|
||||
// tempcount = 0;
|
||||
// typecount = typecount + 1;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
//
|
||||
// temp[tempcount] = type[i];
|
||||
// tempcount = tempcount + 1;
|
||||
// if(i==asd)
|
||||
// {
|
||||
// temp[tempcount] = '\0';
|
||||
// strcpy(excludetypes[typecount].type,temp);
|
||||
// typecount = typecount + 1;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//}
|
||||
@ -0,0 +1,31 @@
|
||||
/**
|
||||
* @file common_itk_util.h
|
||||
* @brief itk warpper utility function
|
||||
* @author James
|
||||
* @history
|
||||
* ===================================================================================
|
||||
* Date Name Description of Change
|
||||
* 09-July-2008 James
|
||||
*/
|
||||
|
||||
#ifndef COMMON_ITK_UTIL
|
||||
#define COMMON_ITK_UTIL
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void CreateLogFile(char* FunctionName, char **fullname);
|
||||
void WriteLog(const char* format, ...);
|
||||
void CloseLog(void);
|
||||
void set_bypass(logical bypass);
|
||||
//int FindDatasetReferenceExt( tag_t datasettype, const char *datasettype_ref, char ext[10] );
|
||||
//int CompareDate( date_t date1, date_t date2 );
|
||||
//int GetRandomTempFile( char tempFile[256] );
|
||||
//logical IsItemRevisionType( char object_type[WSO_name_size_c + 1] );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Loading…
Reference in new issue