@ -0,0 +1,63 @@
|
||||
###############################################################################
|
||||
# Set default behavior to automatically normalize line endings.
|
||||
###############################################################################
|
||||
* text=auto
|
||||
|
||||
###############################################################################
|
||||
# Set default behavior for command prompt diff.
|
||||
#
|
||||
# This is need for earlier builds of msysgit that does not have it on by
|
||||
# default for csharp files.
|
||||
# Note: This is only used by command line
|
||||
###############################################################################
|
||||
#*.cs diff=csharp
|
||||
|
||||
###############################################################################
|
||||
# Set the merge driver for project and solution files
|
||||
#
|
||||
# Merging from the command prompt will add diff markers to the files if there
|
||||
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||
# the diff markers are never inserted). Diff markers may cause the following
|
||||
# file extensions to fail to load in VS. An alternative would be to treat
|
||||
# these files as binary and thus will always conflict and require user
|
||||
# intervention with every merge. To do so, just uncomment the entries below
|
||||
###############################################################################
|
||||
#*.sln merge=binary
|
||||
#*.csproj merge=binary
|
||||
#*.vbproj merge=binary
|
||||
#*.vcxproj merge=binary
|
||||
#*.vcproj merge=binary
|
||||
#*.dbproj merge=binary
|
||||
#*.fsproj merge=binary
|
||||
#*.lsproj merge=binary
|
||||
#*.wixproj merge=binary
|
||||
#*.modelproj merge=binary
|
||||
#*.sqlproj merge=binary
|
||||
#*.wwaproj merge=binary
|
||||
|
||||
###############################################################################
|
||||
# behavior for image files
|
||||
#
|
||||
# image files are treated as binary by default.
|
||||
###############################################################################
|
||||
#*.jpg binary
|
||||
#*.png binary
|
||||
#*.gif binary
|
||||
|
||||
###############################################################################
|
||||
# diff behavior for common document formats
|
||||
#
|
||||
# Convert binary document formats to text before diffing them. This feature
|
||||
# is only available from the command line. Turn it on by uncommenting the
|
||||
# entries below.
|
||||
###############################################################################
|
||||
#*.doc diff=astextplain
|
||||
#*.DOC diff=astextplain
|
||||
#*.docx diff=astextplain
|
||||
#*.DOCX diff=astextplain
|
||||
#*.dot diff=astextplain
|
||||
#*.DOT diff=astextplain
|
||||
#*.pdf diff=astextplain
|
||||
#*.PDF diff=astextplain
|
||||
#*.rtf diff=astextplain
|
||||
#*.RTF diff=astextplain
|
@ -0,0 +1,340 @@
|
||||
## 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
|
||||
|
||||
# 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/
|
||||
|
||||
# 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
|
||||
|
||||
# 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
|
||||
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# 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
|
||||
# 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
|
||||
|
||||
# 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
|
||||
*- Backup*.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/
|
||||
|
||||
# JetBrains Rider
|
||||
.idea/
|
||||
*.sln.iml
|
||||
|
||||
# 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
|
@ -0,0 +1,78 @@
|
||||
#include <stdarg.h>
|
||||
#include <tccore/custom.h>
|
||||
#include <server_exits/user_server_exits.h>
|
||||
#include "kutil.h"
|
||||
#include <list>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef list<tag_t> RetData;
|
||||
typedef list<tag_t>::iterator RetDataIterator;
|
||||
typedef map<string, string> SearchCriterionInputs;
|
||||
|
||||
DLLAPI int USERSERVICE_custom_register_methods();
|
||||
DLLAPI int K_invoke_pdm_server(int *decision, va_list args);
|
||||
DLLAPI int USERSERVICE_custom_register_handlers(int* decision, va_list args);
|
||||
|
||||
int Get_New_ID(tag_t item_type_tag, string old_id, string suffix, string& new_item_id);
|
||||
int CONNOR_SIGN_MASTER(EPM_action_message_t msg);
|
||||
int CONNOR_SIGN_DATASET(EPM_action_message_t msg);
|
||||
//int check_form_attribute(EPM_action_message_t msg);
|
||||
//int check_owner(EPM_rule_message_t msg);
|
||||
//int check_release(EPM_rule_message_t msg);
|
||||
void map_insert(map < string, string >* strmap, string index, string x);
|
||||
void init_search_criteria_map(string searchStr, SearchCriterionInputs& searchCriteria);
|
||||
void init_search_criteria_vector(string searchStr, vector<string>& propNames, vector<string>& propValues);
|
||||
int Parse_NX_Template_By_ID(const std::string& itemID, std::string& res);
|
||||
int Read_NX_Image_By_ID(const std::string& itemID, std::string& res);
|
||||
int Download_Dataset_By_UID(const std::string& itemID, std::string& res);
|
||||
int Get_All_SubTypes(const std::string& typeName, std::string& res);
|
||||
int SEARCH_AUTOCODE_NODE(const std::string& typeName, std::string& res);
|
||||
int Get_Uid(const std::string& name, std::string& res);
|
||||
int SEARCH_AUTOCODE_SEGMENT(const std::string& searchStr, std::string& res);
|
||||
int SEARCH_AUTOCODE_USER(const std::string& searchStr, std::string& res);
|
||||
int GET_TREE_AND_LIST_STRING_VALUE(const std::string& searchStr, std::string& res);
|
||||
int GET_NEW_REV_ID(const std::string& typeNameStr, std::string& res);
|
||||
int GET_LOGICAL_PROP_VALUE(const std::string& str, std::string& res);
|
||||
int SEARCH_TREE_OR_LIST_NODE(const std::string& searchStr, std::string& res);
|
||||
int GET_TREE_AND_LIST_STRING_VALUES(const std::string& searchStr, std::string& res);
|
||||
int SEARCH_PARENT_TREE_OR_LIST_NODE(const std::string& searchStr, std::string& res);
|
||||
int ICS_GET_ATTRIBUTES(const std::string& str, std::string& res);
|
||||
int ICS_ATTR_IS_REFERENCE_ATTRIBUTE(const std::string& str, std::string& res);
|
||||
int ICS_ATTR_ASK_PROPERTY(const std::string& str, std::string& res);
|
||||
int ICS_ATTR_ASK_KEYLOV(const std::string& str, std::string& res);
|
||||
int GET_DISPLAY_PROP_VALUE(const std::string& str, std::string& res);
|
||||
int FIND_LOV_BY_NAME(const std::string& str, std::string& res);
|
||||
int GET_REFERENCE_PROP_VALUE(const std::string& str, std::string& res);
|
||||
int QUERY_PART_NO(const std::string& str, std::string& res);
|
||||
int DELETE_RECYCLE_ID(const std::string& str, std::string& res);
|
||||
int ITEM_EXIST(const std::string& str, std::string& res);
|
||||
int ITEM_CREATE(const std::string& str, std::string& res);
|
||||
int ADD_TO_NEWSTUFF(const std::string& uid, std::string& res);
|
||||
int GET_CLASSIFICATION_ID(const std::string& uid, std::string& res);
|
||||
int SEND_ITEM_TO_CLASSIFICATION(const std::string& str, std::string& res);
|
||||
int GET_ITEMTYPE_BY_ID(const std::string& item_id, std::string& res);
|
||||
int GET_REVUID_BY_ID(const std::string& item_id, std::string& res);
|
||||
int ITEM_UPDATE(const std::string& str, std::string& res);
|
||||
int READ_NX_TEMPLATE_BOM(const std::string& itemID, std::string& res);
|
||||
int GET_CLONE_INFO(const std::string& uid, std::string& res);
|
||||
int GET_LATEST_ITEM_REVISION(const std::string& str, std::string& res);
|
||||
int GRANT_PRIVILEGE(const std::string& str, std::string& res);
|
||||
int GET_UOM_TAGS(const std::string& str, std::string& res);
|
||||
int UPDATE_UOM(const std::string& str, std::string& res);
|
||||
int GET_REFERENCE_PROP_VALUE_ARRAY(const std::string& str, std::string& res);
|
||||
int ICS_ATTR_ASK_METRIC_UNIT(const std::string& str, std::string& res);
|
||||
|
||||
#define debug true
|
||||
#define OUTPUT_CODE_ERROR -1
|
||||
#define SPLITTER "&;&"
|
||||
#define SPLIT_SECTION "&SECTION&"
|
||||
#define SPLIT_PROP_STR "&PROP&"
|
||||
#define SPLIT_PROP_NAME_VALUE "&=&"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -0,0 +1,183 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Connor_NX.cpp" />
|
||||
<ClCompile Include="connor_sign_dataset.cpp" />
|
||||
<ClCompile Include="connor_sign_master.cpp" />
|
||||
<ClCompile Include="Download_Dataset_By_UID.cpp" />
|
||||
<ClCompile Include="GET_ALL_SUB_TYPES.cpp" />
|
||||
<ClCompile Include="Get_Uid.cpp" />
|
||||
<ClCompile Include="kutil.cpp" />
|
||||
<ClCompile Include="K_autocode_util.cpp" />
|
||||
<ClCompile Include="K_getComponentPropertyValue.cpp" />
|
||||
<ClCompile Include="K_invoke_pdm_server.cpp" />
|
||||
<ClCompile Include="K_nx_common.cpp" />
|
||||
<ClCompile Include="K_read_nx_bom.cpp" />
|
||||
<ClCompile Include="K_recycle_item_id.cpp" />
|
||||
<ClCompile Include="K_searchClassificationNodes.cpp" />
|
||||
<ClCompile Include="K_searchTreeOrListNodes.cpp" />
|
||||
<ClCompile Include="Top_Down_Design.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Connor_NX.h" />
|
||||
<ClInclude Include="kutil.h" />
|
||||
<ClInclude Include="K_autocode_util.h" />
|
||||
<ClInclude Include="K_recycle_item_id.h" />
|
||||
<ClInclude Include="origin_PropNames.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="..\README.MD" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{B66C17FA-78C8-443E-8239-6E8744560AD7}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>ConnorNX</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<ProjectName>connor_nx_itk</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_WARNINGS;_CONSOLE;IPLIB=none;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>D:\WorkEnvironment\QunFeng\nx_itk\oci;D:\WorkEnvironment\QunFeng\nx_itk\include_cpp;D:\WorkEnvironment\QunFeng\nx_itk\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>D:\WorkEnvironment\QunFeng\nx_itk\lib\*.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>libuser_exits.ar.lib</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="源文件">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="头文件">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="资源文件">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Connor_NX.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="K_invoke_pdm_server.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="kutil.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Top_Down_Design.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Download_Dataset_By_UID.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GET_ALL_SUB_TYPES.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="K_searchClassificationNodes.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Get_Uid.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="K_getComponentPropertyValue.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="K_nx_common.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="K_searchTreeOrListNodes.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="K_recycle_item_id.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="K_autocode_util.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="connor_sign_dataset.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="connor_sign_master.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="K_read_nx_bom.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Connor_NX.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="kutil.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="origin_PropNames.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="K_recycle_item_id.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="K_autocode_util.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="..\README.MD" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -0,0 +1,43 @@
|
||||
#include "Connor_NX.h"
|
||||
using namespace std;
|
||||
|
||||
|
||||
int Download_Dataset_By_UID(const std::string& dataset_uid_ref_ext, std::string& res) {
|
||||
int ifail = ITK_ok;
|
||||
char* object_string = NULL;
|
||||
char *dataset_file = NULL, *original_file_name = NULL;
|
||||
tag_t dataset_tag = NULLTAG;
|
||||
vector<string> split;
|
||||
POM_AM__set_application_bypass(true);
|
||||
WriteLog(debug, "下载数据集:%s", dataset_uid_ref_ext.c_str());
|
||||
if (tc_strlen(dataset_uid_ref_ext.c_str()) == 0) {
|
||||
res.append(("数据集UID不可为空"));
|
||||
ifail = OUTPUT_CODE_ERROR;
|
||||
goto gx_nx_image_end;
|
||||
}
|
||||
Split(dataset_uid_ref_ext, SPLITTER, split);
|
||||
if (split.size() != 3) {
|
||||
res.append(("调用参数错误“UID;引用;后缀”"));
|
||||
ifail = OUTPUT_CODE_ERROR;
|
||||
goto gx_nx_image_end;
|
||||
}
|
||||
ITKCALL(ifail = AOM_string_to_tag(split[0].c_str(), &dataset_tag));
|
||||
if (ifail != ITK_ok || dataset_tag == NULLTAG) {
|
||||
res.append(("未找到数据集: ")).append(split[0]);
|
||||
goto gx_nx_image_end;
|
||||
}
|
||||
ITKCALL(ifail = AOM_ask_value_string(dataset_tag, "object_string", &object_string));
|
||||
WriteLog(debug, "找到数据集:%s", object_string);
|
||||
export_dataset_file(debug, dataset_tag, split[1].c_str(), split[2].c_str(), &dataset_file, &original_file_name);
|
||||
if (dataset_file == NULL) {
|
||||
res.append(("从数据集下载失败: ")).append(object_string);
|
||||
ifail = OUTPUT_CODE_ERROR;
|
||||
goto gx_nx_image_end;
|
||||
}
|
||||
res.append(dataset_file);
|
||||
gx_nx_image_end:
|
||||
POM_AM__set_application_bypass(false);
|
||||
DOFREE(original_file_name);
|
||||
DOFREE(object_string);
|
||||
return ifail;
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
#include "Connor_NX.h"
|
||||
using namespace std;
|
||||
|
||||
|
||||
int Get_All_SubTypes(const std::string& typeNameStr, std::string& res) {
|
||||
int ifail = ITK_ok;
|
||||
tag_t type_tag = NULLTAG;
|
||||
tag_t *all_type_tags = NULL;
|
||||
int type_cnt = 0;
|
||||
vector<string> typeNames;
|
||||
Split(typeNameStr, SPLITTER, typeNames);
|
||||
int exclude_type_name_cnt = typeNames.size()-1;
|
||||
const char** exclude_type_names;
|
||||
char** names = NULL;
|
||||
char** uif_names = NULL;
|
||||
exclude_type_names = (const char**)MEM_alloc(exclude_type_name_cnt * sizeof(const char*));
|
||||
for (int i = 0; i < exclude_type_name_cnt; i++) {
|
||||
string typeName = typeNames[i + 1];
|
||||
exclude_type_names[i] = typeName.c_str(); // (char*)MEM_alloc(typeName.length() * sizeof(char));
|
||||
// tc_strcpy(exclude_type_names[i], typeName.c_str());
|
||||
//printf(">> %s\n", exclude_type_names[i]);
|
||||
}
|
||||
/*ITKCALL(ifail = TCTYPE_ask_type(typeName.c_str(), &type_tag));
|
||||
if (ifail != ITK_ok||type_tag==NULLTAG) {
|
||||
res.append(("未找到对象类型: ")).append(typeName);
|
||||
ifail = OUTPUT_CODE_ERROR;
|
||||
goto get_subtype_end;
|
||||
}
|
||||
ITKCALL(ifail = TCTYPE_ask_subtypes(type_tag, false, &type_cnt, &all_type_tags));*/
|
||||
ITKCALL(ifail = TCTYPE_UIF_find_generically_creatable_business_objects(typeNames[0].c_str(), exclude_type_name_cnt, exclude_type_names, &type_cnt, &all_type_tags, &names, &uif_names));
|
||||
//ITKCALL(ifail = TCTYPE_find_alltypes_for_class(typeName.c_str(), &type_cnt, &all_type_tags));
|
||||
if (ifail != ITK_ok) {
|
||||
res.append(("获取类型失败: ")).append(typeNameStr);
|
||||
goto get_subtype_end;
|
||||
}
|
||||
for (int i = 0; i < type_cnt; i++) {
|
||||
tag_t a_tag = all_type_tags[i];
|
||||
char* type_name = NULL, * dis_name = NULL;
|
||||
ITKCALL(ifail = TCTYPE_ask_name2(a_tag, &type_name));
|
||||
ITKCALL(ifail = TCTYPE_ask_display_name(a_tag, &dis_name));
|
||||
if (type_name != NULL && dis_name != NULL) {
|
||||
res.append(type_name).append("=").append(dis_name).append(SPLITTER);
|
||||
}
|
||||
}
|
||||
|
||||
get_subtype_end:
|
||||
DOFREE(all_type_tags);
|
||||
DOFREE(names);
|
||||
DOFREE(uif_names);
|
||||
return ifail;
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
#include "Connor_NX.h"
|
||||
using namespace std;
|
||||
|
||||
|
||||
int Get_Uid(const std::string& name, std::string& res) {
|
||||
int ifail = ITK_ok;
|
||||
tag_t member_tag = NULLTAG;
|
||||
tag_t user_tag = NULLTAG, role_tag = NULLTAG, group_tag = NULLTAG;
|
||||
char* user_uid = NULL, * role_uid = NULL, * group_uid = NULL;
|
||||
ITKCALL(ifail = POM_ask_member(&member_tag));
|
||||
if (ifail != ITK_ok || member_tag == NULLTAG) {
|
||||
ifail = OUTPUT_CODE_ERROR;
|
||||
res.append("获取当前成员失败");
|
||||
goto get_uid_end;
|
||||
}
|
||||
if (strcmp("user", name.c_str()) == 0) {
|
||||
ITKCALL(ifail = SA_ask_groupmember_user(member_tag, &user_tag));
|
||||
if (ifail != ITK_ok || user_tag == NULLTAG) {
|
||||
ifail = OUTPUT_CODE_ERROR;
|
||||
res.append("获取当前用户失败");
|
||||
goto get_uid_end;
|
||||
}
|
||||
ITK__convert_tag_to_uid(user_tag, &user_uid);
|
||||
res.append(user_uid);
|
||||
}
|
||||
else if (strcmp("role", name.c_str()) == 0) {
|
||||
ITKCALL(ifail = SA_ask_groupmember_role(member_tag, &role_tag));
|
||||
if (ifail != ITK_ok || role_tag == NULLTAG) {
|
||||
ifail = OUTPUT_CODE_ERROR;
|
||||
res.append("获取当前用户角色失败");
|
||||
goto get_uid_end;
|
||||
}
|
||||
ITK__convert_tag_to_uid(role_tag, &role_uid);
|
||||
res.append(role_uid);
|
||||
}
|
||||
else if (strcmp("group", name.c_str()) == 0) {
|
||||
ITKCALL(ifail = SA_ask_groupmember_group(member_tag, &group_tag));
|
||||
if (ifail != ITK_ok || group_tag == NULLTAG) {
|
||||
ifail = OUTPUT_CODE_ERROR;
|
||||
res.append("获取当前用户组失败");
|
||||
goto get_uid_end;
|
||||
}
|
||||
ITK__convert_tag_to_uid(group_tag, &group_uid);
|
||||
res.append(group_uid);
|
||||
}
|
||||
else if(strcmp("parentgroup", name.c_str()) == 0) {
|
||||
tag_t parent_group_tag = NULLTAG;
|
||||
ITKCALL(ifail = SA_ask_groupmember_group(member_tag, &group_tag));
|
||||
if (ifail != ITK_ok || group_tag == NULLTAG) {
|
||||
ifail = OUTPUT_CODE_ERROR;
|
||||
res.append("获取当前用户组失败");
|
||||
goto get_uid_end;
|
||||
}
|
||||
ITKCALL(ifail = AOM_ask_value_tag(group_tag, "parent", &parent_group_tag));
|
||||
if (ifail != ITK_ok) {
|
||||
ifail = OUTPUT_CODE_ERROR;
|
||||
res.append("获取当前用户组的父级组织失败");
|
||||
goto get_uid_end;
|
||||
}
|
||||
if (parent_group_tag != NULLTAG) {
|
||||
ITK__convert_tag_to_uid(parent_group_tag, &group_uid);
|
||||
res.append(group_uid);
|
||||
}
|
||||
}
|
||||
|
||||
get_uid_end:
|
||||
DOFREE(user_uid);
|
||||
DOFREE(group_uid);
|
||||
DOFREE(role_uid);
|
||||
return ifail;
|
||||
}
|
@ -0,0 +1,109 @@
|
||||
#include<stdio.h>
|
||||
#include <string>
|
||||
#include<iostream>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <list>
|
||||
|
||||
|
||||
//tc
|
||||
#include<tccore\custom.h>
|
||||
#include<tc\tc_macros.h>
|
||||
#include<tccore\aom.h>
|
||||
#include<ict\ict_userservice.h>
|
||||
#include<fclasses\tc_string.h>
|
||||
#include<property\prop.h>
|
||||
#include<tccore\item.h>
|
||||
//#include<tc\iman.h>
|
||||
|
||||
#include <tccore\aom_prop.h>
|
||||
#include <epm\epm.h>
|
||||
#include <tccore\grm.h>
|
||||
#include <sa\am.h>
|
||||
#include <ps\ps.h>
|
||||
#include <time.h>
|
||||
#include <tccore\grmtype.h>
|
||||
#include "origin_PropNames.h"
|
||||
#include <pom/enq/enq.h>
|
||||
|
||||
#include<tc\preferences.h>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
//#include <libuserext_exports.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define GET_ID_RETRIES 10
|
||||
#define CYCLE_TIMES 10
|
||||
#define STARTNUMBER 1
|
||||
#define PADNUMBER 4
|
||||
#define RETRY_STRING "10"
|
||||
#define HANDLE_ERROR_S1(E,S) \
|
||||
{ EMH_store_initial_error_s1(EMH_severity_error,(E),(S)); return(E); }
|
||||
|
||||
#define REPORT_IFAIL(M) \
|
||||
ifail?printf("%s : ERROR : ifail = %d\n",M,ifail):printf("%s : Ok\n",M)
|
||||
|
||||
#define HANDLE_ERROR(E) \
|
||||
{ EMH_store_initial_error(EMH_severity_error,(E)); return(E); }
|
||||
|
||||
#define HANDLE_ERROR_S1(E,S) \
|
||||
{ EMH_store_initial_error_s1(EMH_severity_error,(E),(S)); return(E); }
|
||||
|
||||
#define HANDLE_ERROR_AND_RELEASE(E,I) \
|
||||
{ \
|
||||
(void)release_number(I); \
|
||||
EMH_store_initial_error(EMH_severity_error,(E)); \
|
||||
return(E); \
|
||||
}
|
||||
|
||||
#define TEST_ERROR(E) \
|
||||
if ((E) != ITK_ok) return(E);
|
||||
|
||||
#define TEST_POM_ERROR(E) \
|
||||
if ((E) != ITK_ok) HANDLE_ERROR(E)
|
||||
|
||||
#define TEST_ERROR_AND_RELEASE(E,I) \
|
||||
if ((E) != ITK_ok) { (void)release_number(I); return(E); }
|
||||
|
||||
/* Define the number of retries when fetching the next ID. */
|
||||
/* This must be stored in both numeric and string forms. */
|
||||
#define GET_ID_RETRIES 10
|
||||
#define RETRY_STRING "10"
|
||||
|
||||
/* Empty string test macro */
|
||||
#define IS_EMPTY(S) (!(*(S)))
|
||||
|
||||
/* Define the methods by which a new item name can be obtained */
|
||||
#define SEED_METHOD 0
|
||||
#define BUILD_METHOD 1
|
||||
|
||||
/* The following define the maximum index number to be used. *
|
||||
* Note that the actual maximum is one less than MAXNUM. *
|
||||
* NUMERIC_LIMIT must be large enough to store decimal string *
|
||||
* version of MAXNUM plus a NULL terminator. */
|
||||
#define NUMERIC_LIMIT 12
|
||||
#define MAXNUM 0x7FFFFFFF
|
||||
/* define the class for which id and rev is generated */
|
||||
#define CLASS_IS_ITEM 0
|
||||
#define CLASS_IS_DATASET 1
|
||||
|
||||
#define origin_autocode_sequence_exclude_number "origin_autocode_sequence_exclude_number"
|
||||
|
||||
tag_t getCurrentUser();
|
||||
char* filterChar(string str, string filterStr);
|
||||
date_t getCurrentDate();
|
||||
void map_insert(map < string, string >* strmap, string index, string x);
|
||||
int select_id_counter(const char* id_counter, int next_id, tag_t* id_counter_tag, logical* is_new);
|
||||
int load_current_number(tag_t id_counter_tag, const char* id_counter, int* next_id, logical* is_new);
|
||||
//int load_current_number(tag_t id_counter_tag, const char *id_counter, int *next_id, logical *is_new);
|
||||
int get_sequence_no(const char* pattern_code, int length, int start_index, int end_index, int step, int* new_id, const char* code_exclude_character);
|
||||
int generate_num(const char* pattern_code, int length, int new_index, char** generated_num);
|
||||
int filterItemID(const char* filterStr, int new_id);
|
||||
int isContainsStr(char* sourceStr, char* containsStr);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -0,0 +1,223 @@
|
||||
|
||||
#include "Connor_NX.h"
|
||||
|
||||
#define K_GetPrefValue 0
|
||||
#define K_Parse_NX_Template_By_ID 1
|
||||
#define K_Read_NX_Image_By_ID 2
|
||||
#define K_Download_Dataset_By_UID 3
|
||||
#define INPUTCODE_GET_ALL_SUB_TYPES 4
|
||||
#define INPUTCODE_SEARCH_AUTOCODE_NODE 5
|
||||
#define INPUTCODE_GET_UID 6
|
||||
#define INPUTCODE_SEARCH_AUTOCODE_SEGMENT 7
|
||||
#define INPUTCODE_SEARCH_AUTOCODE_USER 8
|
||||
#define INPUTCODE_GET_TREE_AND_LIST_STRING_VALUE 9
|
||||
#define INPUTCODE_GET_NEW_REV_ID 10
|
||||
#define INPUTCODE_GET_LOGICAL_PROP_VALUE 11
|
||||
#define INPUTCODE_SEARCH_TREE_OR_LIST_NODE 12
|
||||
#define INPUTCODE_GET_TREE_AND_LIST_STRING_VALUES 13
|
||||
#define INPUTCODE_SEARCH_PARENT_TREE_OR_LIST_NODE 14
|
||||
#define INPUTCODE_ICS_GET_ATTRIBUTES 15
|
||||
#define INPUTCODE_ICS_ATTR_IS_REFERENCE_ATTRIBUTE 16
|
||||
#define INPUTCODE_ICS_ATTR_ASK_PROPERTY 17
|
||||
#define INPUTCODE_ICS_ATTR_ASK_KEYLOV 18
|
||||
#define INPUTCODE_GET_DISPLAY_PROP_VALUE 19
|
||||
#define INPUTCODE_FIND_LOV_BY_NAME 20
|
||||
#define INPUTCODE_GET_REFERENCE_PROP_VALUE 21
|
||||
#define INPUTCODE_QUERY_PART_NO 22
|
||||
#define INPUTCODE_DELETE_RECYCLE_ID 23
|
||||
#define INPUTCODE_ITEM_EXIST 24
|
||||
#define INPUTCODE_ITEM_CREATE 25
|
||||
#define INPUTCODE_ADD_TO_NEWSTUFF 26
|
||||
#define INPUTCODE_GET_CLASSIFICATION_ID 27
|
||||
#define INPUTCODE_SEND_ITEM_TO_CLASSIFICATION 28
|
||||
#define INPUTCODE_GET_ITEMTYPE_BY_ID 29
|
||||
#define INPUTCODE_GET_REVUID_BY_ID 30
|
||||
#define INPUTCODE_ITEM_UPDATE 31
|
||||
#define INPUTCODE_READ_NX_TEMPLATE_BOM 32
|
||||
#define INPUTCODE_GET_CLONE_INFO 33
|
||||
#define INPUTCODE_GET_LATEST_ITEM_REVISION 34
|
||||
#define INPUTCODE_GRANT_PRIVILEGE 35
|
||||
#define INPUTCODE_GET_UOM_TAGS 36
|
||||
#define INPUTCODE_UPDATE_UOM 37
|
||||
#define INPUTCODE_GET_REFERENCE_PROP_VALUE_ARRAY 38
|
||||
#define INPUTCODE_ICS_ATTR_ASK_METRIC_UNIT 39
|
||||
using namespace std;
|
||||
|
||||
int GetPrefValue(const std::string &pref_name, std::string &prefValue) {
|
||||
int ifail = ITK_ok;
|
||||
int pref_len = 0;
|
||||
char** pref_vals = NULL;
|
||||
printf("查询首选项:%s\n", pref_name.c_str());
|
||||
if (tc_strlen(pref_name.c_str()) == 0) {
|
||||
return ifail;
|
||||
}
|
||||
ITKCALL(ifail = PREF_refresh(pref_name.c_str()));
|
||||
if (ifail != ITK_ok) {
|
||||
prefValue.append(("未配置首选项:")).append(pref_name);
|
||||
return ifail;
|
||||
}
|
||||
ITKCALL(ifail = PREF_ask_char_values(pref_name.c_str(), &pref_len, &pref_vals));
|
||||
for (int i = 0;i < pref_len;i++) {
|
||||
printf(">> %d. %s\n", i + 1, pref_vals[i]);
|
||||
prefValue.append(pref_vals[i]);
|
||||
if (i != pref_len - 1) {
|
||||
prefValue.append(SPLITTER);
|
||||
}
|
||||
}
|
||||
if (ifail != ITK_ok) {
|
||||
prefValue.append(("未配置首选项:")).append(pref_name);
|
||||
}
|
||||
return ifail;
|
||||
}
|
||||
|
||||
DLLAPI int K_invoke_pdm_server(int *decision, va_list args) {
|
||||
int ifail = ITK_ok;
|
||||
// get the input parameters from the va_list:
|
||||
int input_code = va_arg(args, int);
|
||||
char* input_str = va_arg(args, char*);
|
||||
int* output_code = va_arg(args, int*);
|
||||
char** output_str = va_arg(args, char**);
|
||||
// set decision. We'll let other customizations have
|
||||
// a chance to handle this PDM Server call too.
|
||||
*decision = ALL_CUSTOMIZATIONS;
|
||||
|
||||
// I do all intermediate string processing with std::string's
|
||||
// instead of char* strings. Later I'll copy the final
|
||||
// std::string's contents to the char* output_str
|
||||
std::string output_string;
|
||||
|
||||
// pass the input_code to a switch():
|
||||
switch (input_code)
|
||||
{
|
||||
case K_GetPrefValue:
|
||||
*output_code = GetPrefValue(input_str, output_string);
|
||||
break;
|
||||
case K_Read_NX_Image_By_ID:
|
||||
*output_code = Read_NX_Image_By_ID(input_str, output_string);
|
||||
break;
|
||||
case K_Parse_NX_Template_By_ID:
|
||||
*output_code = Parse_NX_Template_By_ID(input_str, output_string);
|
||||
break;
|
||||
case K_Download_Dataset_By_UID:
|
||||
*output_code = Download_Dataset_By_UID(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_GET_ALL_SUB_TYPES:
|
||||
*output_code = Get_All_SubTypes(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_SEARCH_AUTOCODE_NODE:
|
||||
*output_code = SEARCH_AUTOCODE_NODE(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_GET_UID:
|
||||
*output_code = Get_Uid(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_SEARCH_AUTOCODE_SEGMENT:
|
||||
*output_code = SEARCH_AUTOCODE_SEGMENT(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_SEARCH_AUTOCODE_USER:
|
||||
*output_code = SEARCH_AUTOCODE_USER(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_GET_TREE_AND_LIST_STRING_VALUE:
|
||||
*output_code = GET_TREE_AND_LIST_STRING_VALUE(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_GET_NEW_REV_ID:
|
||||
*output_code = GET_NEW_REV_ID(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_GET_LOGICAL_PROP_VALUE:
|
||||
*output_code = GET_LOGICAL_PROP_VALUE(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_SEARCH_TREE_OR_LIST_NODE:
|
||||
*output_code = SEARCH_TREE_OR_LIST_NODE(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_GET_TREE_AND_LIST_STRING_VALUES:
|
||||
*output_code = GET_TREE_AND_LIST_STRING_VALUES(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_SEARCH_PARENT_TREE_OR_LIST_NODE:
|
||||
*output_code = SEARCH_PARENT_TREE_OR_LIST_NODE(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_ICS_GET_ATTRIBUTES:
|
||||
*output_code = ICS_GET_ATTRIBUTES(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_ICS_ATTR_IS_REFERENCE_ATTRIBUTE:
|
||||
*output_code = ICS_ATTR_IS_REFERENCE_ATTRIBUTE(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_ICS_ATTR_ASK_PROPERTY:
|
||||
*output_code = ICS_ATTR_ASK_PROPERTY(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_ICS_ATTR_ASK_KEYLOV:
|
||||
*output_code = ICS_ATTR_ASK_KEYLOV(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_GET_DISPLAY_PROP_VALUE:
|
||||
*output_code = GET_DISPLAY_PROP_VALUE(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_FIND_LOV_BY_NAME:
|
||||
*output_code = FIND_LOV_BY_NAME(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_GET_REFERENCE_PROP_VALUE:
|
||||
*output_code = GET_REFERENCE_PROP_VALUE(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_QUERY_PART_NO:
|
||||
*output_code = QUERY_PART_NO(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_DELETE_RECYCLE_ID:
|
||||
*output_code = DELETE_RECYCLE_ID(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_ITEM_EXIST:
|
||||
*output_code = ITEM_EXIST(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_ITEM_CREATE:
|
||||
*output_code = ITEM_CREATE(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_ADD_TO_NEWSTUFF:
|
||||
*output_code = ADD_TO_NEWSTUFF(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_GET_CLASSIFICATION_ID:
|
||||
*output_code = GET_CLASSIFICATION_ID(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_SEND_ITEM_TO_CLASSIFICATION:
|
||||
*output_code = SEND_ITEM_TO_CLASSIFICATION(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_GET_ITEMTYPE_BY_ID:
|
||||
*output_code = GET_ITEMTYPE_BY_ID(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_GET_REVUID_BY_ID:
|
||||
*output_code = GET_REVUID_BY_ID(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_ITEM_UPDATE:
|
||||
*output_code = ITEM_UPDATE(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_READ_NX_TEMPLATE_BOM:
|
||||
*output_code = READ_NX_TEMPLATE_BOM(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_GET_CLONE_INFO:
|
||||
*output_code = GET_CLONE_INFO(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_GET_LATEST_ITEM_REVISION:
|
||||
*output_code = GET_LATEST_ITEM_REVISION(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_GRANT_PRIVILEGE:
|
||||
*output_code = GRANT_PRIVILEGE(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_GET_UOM_TAGS:
|
||||
*output_code = GET_UOM_TAGS(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_UPDATE_UOM:
|
||||
*output_code = UPDATE_UOM(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_GET_REFERENCE_PROP_VALUE_ARRAY:
|
||||
*output_code = GET_REFERENCE_PROP_VALUE_ARRAY(input_str, output_string);
|
||||
break;
|
||||
case INPUTCODE_ICS_ATTR_ASK_METRIC_UNIT:
|
||||
*output_code = ICS_ATTR_ASK_METRIC_UNIT(input_str, output_string);
|
||||
break;
|
||||
default:
|
||||
*decision = NO_CUSTOMIZATION; // do nothing INPUTCODE_ITEM_UPDATE
|
||||
// code may be meant for another library using PDM Server
|
||||
}
|
||||
// allocate memory for output string and copy
|
||||
// std::string's contents to it:
|
||||
TC_write_syslog("NX Return [%d]: %s", *output_code, output_string.c_str());
|
||||
*output_str =(char*) malloc(sizeof(char) * (output_string.length() + 1));
|
||||
tc_strcpy(*output_str, output_string.c_str());
|
||||
return ifail;
|
||||
}
|
||||
|
@ -0,0 +1,589 @@
|
||||
#include "Connor_NX.h"
|
||||
#include "origin_PropNames.h"
|
||||
#include <list>
|
||||
#include <sa/groupmember.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//void map_insert(map < string, string >* strmap, string index, string x)
|
||||
//{
|
||||
// //printf("map_insert==1 =====\n");
|
||||
// //strmap->insert(map < string, string >::value_type(index, x));
|
||||
// strmap->insert(pair< string, string >(index, x));
|
||||
// // printf("map_insert==2 =====\n");
|
||||
//}
|
||||
|
||||
void init_search_criteria_map(string searchStr, SearchCriterionInputs &searchCriteria) {
|
||||
vector<string> searchStrSplit;
|
||||
// printf("Search AutoCode_Node: %s \n", searchStr.c_str());
|
||||
Split(searchStr, SPLITTER, searchStrSplit);
|
||||
int length = searchStrSplit.size();
|
||||
for (int i = 0; i < length; i++) {
|
||||
string str = searchStrSplit[i];
|
||||
int ind = str.find_first_of('=');
|
||||
if (ind <= 0) {
|
||||
continue;
|
||||
}
|
||||
string s1 = str.substr(0, ind);
|
||||
string s2 = str.substr(ind + 1);
|
||||
map_insert(&searchCriteria, s1, s2);
|
||||
}
|
||||
}
|
||||
|
||||
void init_search_criteria_vector(string searchStr, vector<string> &propNames, vector<string> &propValues) {
|
||||
vector<string> searchStrSplit;
|
||||
// printf("Search AutoCode_Node: %s \n", searchStr.c_str());
|
||||
Split(searchStr, SPLITTER, searchStrSplit);
|
||||
int length = searchStrSplit.size();
|
||||
for (int i = 0; i < length; i++) {
|
||||
string str = searchStrSplit[i];
|
||||
int ind = str.find_first_of('=');
|
||||
if (ind <= 0) {
|
||||
continue;
|
||||
}
|
||||
string s1 = str.substr(0, ind);
|
||||
string s2 = str.substr(ind + 1);
|
||||
propNames.push_back(s1);
|
||||
propValues.push_back(s2);
|
||||
}
|
||||
}
|
||||
|
||||
int SEARCH_AUTOCODE_USER(const std::string& searchStr, std::string& res) {
|
||||
int ifail = ITK_ok;
|
||||
const char* class_name = "Cd9_ClassificationCodeNode";
|
||||
RetData retData;
|
||||
SearchCriterionInputs searchCriteria;
|
||||
|
||||
init_search_criteria_map(searchStr, searchCriteria);
|
||||
//get class id and attr id
|
||||
tag_t class_id = NULLTAG;
|
||||
ITKCALL(POM_class_id_of_class(class_name, &class_id));
|
||||
|
||||
std::map<string, tag_t> prop_to_attrid;
|
||||
std::map<string, string> prop_value_type;
|
||||
for (SearchCriterionInputs::const_iterator searchIter =
|
||||
searchCriteria.begin(); searchIter != searchCriteria.end(); searchIter++) {
|
||||
tag_t attr_id = NULLTAG;
|
||||
ITKCALL(POM_attr_id_of_attr(searchIter->first.c_str(),
|
||||
class_name, &attr_id));
|
||||
|
||||
if (prop_to_attrid.find(searchIter->first) == prop_to_attrid.end()) {
|
||||
prop_to_attrid.insert(make_pair(searchIter->first, attr_id));
|
||||
if (searchIter->first.compare(ClassificationCodeNode_node_name) == 0
|
||||
|| searchIter->first.compare(ClassificationCodeNode_segment) == 0
|
||||
) {
|
||||
prop_value_type.insert(make_pair(searchIter->first,
|
||||
"String"));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//find all instance
|
||||
int n_instances = 0, n_ret_instances = 0;
|
||||
tag_t* instance_tags = NULL, * ret_instances = NULL;
|
||||
ITKCALL(POM_instances_of_class(class_id, FALSE, &n_instances,
|
||||
&instance_tags));
|
||||
if (n_instances > 0)
|
||||
{
|
||||
ITKCALL(POM_load_instances_possible(n_instances, instance_tags, &n_ret_instances, &ret_instances));
|
||||
}
|
||||
|
||||
for (int i = 0; i < n_ret_instances; ++i) {
|
||||
tag_t bo_inst = ret_instances[i];
|
||||
logical is_same = TRUE;
|
||||
|
||||
for (SearchCriterionInputs::const_iterator searchIter =
|
||||
searchCriteria.begin(); searchIter != searchCriteria.end(); searchIter++) {
|
||||
std::map<string, tag_t>::iterator prop_to_attrid_iter =
|
||||
prop_to_attrid.find(searchIter->first);
|
||||
|
||||
std::map<string, string>::iterator prop_value_type_iter =
|
||||
prop_value_type.find(searchIter->first);
|
||||
|
||||
|
||||
if (prop_value_type_iter->second.compare("String") == 0) {
|
||||
char* str_val = NULL;
|
||||
logical is_it_null = FALSE;
|
||||
logical is_it_empty = FALSE;
|
||||
ITKCALL(POM_ask_attr_string(bo_inst, prop_to_attrid_iter->second,
|
||||
&str_val, &is_it_null, &is_it_empty));
|
||||
|
||||
if ((is_it_empty || is_it_null) && ((tc_strlen(searchIter->second.c_str()) == 0) || (searchIter->second.c_str() == NULL)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (tc_strcmp(searchIter->second.c_str(), str_val) != 0) {
|
||||
is_same = FALSE;
|
||||
MEM_free(str_val);
|
||||
break;
|
||||
}
|
||||
MEM_free(str_val);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_same) {
|
||||
tag_t attr_id = NULLTAG;
|
||||
logical* is_it_null = FALSE, * is_it_empty = FALSE;
|
||||
tag_t* values;
|
||||
int targetNum = 0;
|
||||
|
||||
ITKCALL(POM_attr_id_of_attr(ClassificationCodeNode_grant_users, class_name, &attr_id));
|
||||
POM_length_of_attr(bo_inst, attr_id, &targetNum);
|
||||
if (targetNum > 0) {
|
||||
ITKCALL(POM_ask_attr_tags(bo_inst, attr_id, 0, targetNum, &values, &is_it_null, &is_it_empty));
|
||||
for (int i = 0; i < targetNum; i++)
|
||||
{
|
||||
if (values[i] != NULLTAG)
|
||||
{
|
||||
retData.insert(retData.end(), values[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ITKCALL(POM_attr_id_of_attr(ClassificationCodeNode_grant_roles, class_name, &attr_id));
|
||||
POM_length_of_attr(bo_inst, attr_id, &targetNum);
|
||||
if (targetNum > 0) {
|
||||
ITKCALL(POM_ask_attr_tags(bo_inst, attr_id, 0, targetNum, &values, &is_it_null, &is_it_empty));
|
||||
for (int i = 0; i < targetNum; i++)
|
||||
{
|
||||
if (values[i] != NULLTAG)
|
||||
{
|
||||
retData.insert(retData.end(), values[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ITKCALL(POM_attr_id_of_attr(ClassificationCodeNode_grant_groups, class_name, &attr_id));
|
||||
POM_length_of_attr(bo_inst, attr_id, &targetNum);
|
||||
if (targetNum > 0) {
|
||||
ITKCALL(POM_ask_attr_tags(bo_inst, attr_id, 0, targetNum, &values, &is_it_null, &is_it_empty));
|
||||
for (int i = 0; i < targetNum; i++)
|
||||
{
|
||||
if (values[i] != NULLTAG)
|
||||
{
|
||||
retData.insert(retData.end(), values[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MEM_free(is_it_null);
|
||||
MEM_free(is_it_empty);
|
||||
|
||||
}
|
||||
continue;
|
||||
}
|
||||
int arraySize = 0;
|
||||
tag_t* tag_array;
|
||||
USERSERVICE_array_t arrayStruct;
|
||||
arraySize = retData.size();
|
||||
tag_array = (tag_t*)MEM_alloc(arraySize * sizeof(tag_t));
|
||||
//printf("arraySize=======%d\n",arraySize);
|
||||
|
||||
RetDataIterator retDataIterator = retData.begin();
|
||||
for (int i = 0; i < arraySize; i++)
|
||||
{
|
||||
char* uid = NULL;
|
||||
tag_array[i] = static_cast<tag_t>(*retDataIterator);
|
||||
//printf("tag_array[i]=======%u\n",tag_array[i]);
|
||||
ITK__convert_tag_to_uid(tag_array[i], &uid);
|
||||
if (uid != NULL) {
|
||||
res.append(uid).append(SPLITTER);
|
||||
}
|
||||
++retDataIterator;
|
||||
DOFREE(uid);
|
||||
}
|
||||
/*ITKCALL(USERSERVICE_return_tag_array(tag_array, arraySize,
|
||||
&arrayStruct));
|
||||
if (arrayStruct.length != 0) {
|
||||
*((USERSERVICE_array_t*)returnValue) = arrayStruct;
|
||||
}*/
|
||||
|
||||
MEM_free(instance_tags);
|
||||
MEM_free(ret_instances);
|
||||
MEM_free(tag_array);
|
||||
return ifail;
|
||||
}
|
||||
|
||||
int SEARCH_AUTOCODE_SEGMENT(const std::string& searchStr, std::string& res) {
|
||||
int ifail = ITK_ok;
|
||||
const char* class_name = "Cd9_ClassificationCodeNode";
|
||||
RetData retData;
|
||||
SearchCriterionInputs searchCriteria;
|
||||
|
||||
init_search_criteria_map(searchStr, searchCriteria);
|
||||
|
||||
tag_t class_id = NULLTAG;
|
||||
ITKCALL(POM_class_id_of_class(class_name, &class_id));
|
||||
|
||||
std::map<string, tag_t> prop_to_attrid;
|
||||
std::map<string, string> prop_value_type;
|
||||
for (SearchCriterionInputs::const_iterator searchIter =
|
||||
searchCriteria.begin(); searchIter != searchCriteria.end(); searchIter++) {
|
||||
tag_t attr_id = NULLTAG;
|
||||
ITKCALL(POM_attr_id_of_attr(searchIter->first.c_str(),
|
||||
class_name, &attr_id));
|
||||
|
||||
if (prop_to_attrid.find(searchIter->first) == prop_to_attrid.end()) {
|
||||
prop_to_attrid.insert(make_pair(searchIter->first, attr_id));
|
||||
|
||||
if (searchIter->first.compare(ClassificationCodeNode_node_name) == 0) {
|
||||
prop_value_type.insert(make_pair(searchIter->first,
|
||||
"String"));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (searchIter->first.compare(ClassificationCodeNode_grant_users) == 0
|
||||
|| searchIter->first.compare(ClassificationCodeNode_grant_roles) == 0
|
||||
|| searchIter->first.compare(ClassificationCodeNode_grant_groups) == 0
|
||||
) {
|
||||
prop_value_type.insert(make_pair(searchIter->first,
|
||||
"TCComponents"));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
int n_instances = 0, n_ret_instances = 0;
|
||||
tag_t* instance_tags = NULL, * ret_instances = NULL;
|
||||
ITKCALL(POM_instances_of_class(class_id, FALSE, &n_instances,
|
||||
&instance_tags));
|
||||
if (n_instances > 0)
|
||||
{
|
||||
ITKCALL(POM_load_instances_possible(n_instances, instance_tags, &n_ret_instances, &ret_instances));
|
||||
}
|
||||
|
||||
for (int i = 0; i < n_ret_instances; ++i) {
|
||||
tag_t bo_inst = ret_instances[i];
|
||||
logical is_same = TRUE;
|
||||
int nullUserCount = 0;
|
||||
|
||||
for (SearchCriterionInputs::const_iterator searchIter =
|
||||
searchCriteria.begin(); searchIter != searchCriteria.end(); searchIter++) {
|
||||
std::map<string, tag_t>::iterator prop_to_attrid_iter =
|
||||
prop_to_attrid.find(searchIter->first);
|
||||
|
||||
std::map<string, string>::iterator prop_value_type_iter =
|
||||
prop_value_type.find(searchIter->first);
|
||||
|
||||
|
||||
if (prop_value_type_iter->second.compare("String") == 0) {
|
||||
char* str_val = NULL;
|
||||
logical is_it_null = FALSE;
|
||||
logical is_it_empty = FALSE;
|
||||
ITKCALL(POM_ask_attr_string(bo_inst, prop_to_attrid_iter->second,
|
||||
&str_val, &is_it_null, &is_it_empty));
|
||||
|
||||
if ((is_it_empty || is_it_null) && ((tc_strlen(searchIter->second.c_str()) == 0) || (searchIter->second.c_str() == NULL)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (tc_strcmp(searchIter->second.c_str(), str_val) != 0) {
|
||||
is_same = FALSE;
|
||||
MEM_free(str_val);
|
||||
break;
|
||||
}
|
||||
MEM_free(str_val);
|
||||
|
||||
}
|
||||
else {
|
||||
if (prop_value_type_iter->second.compare("TCComponents") == 0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_same) {
|
||||
tag_t attr_id = NULLTAG;
|
||||
logical is_it_null = FALSE, is_it_empty = FALSE;
|
||||
char* strValues = NULL;
|
||||
ITKCALL(POM_attr_id_of_attr(ClassificationCodeNode_segment, class_name, &attr_id));
|
||||
ITKCALL(POM_ask_attr_string(bo_inst, attr_id, &strValues, &is_it_null, &is_it_empty));
|
||||
|
||||
if (tc_strlen(strValues) == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
std::vector< std::string > searched_tags;
|
||||
Split(strValues, ",", searched_tags);
|
||||
for (int i = 0; i < (int)searched_tags.size(); i++)
|
||||
{
|
||||
if (tc_strlen(searched_tags[i].c_str()) > 0)
|
||||
{
|
||||
tag_t ref_obj = NULLTAG;
|
||||
ITKCALL(POM_string_to_tag(searched_tags[i].c_str(), &ref_obj));
|
||||
if (ref_obj != NULLTAG)
|
||||
{
|
||||
retData.insert(retData.end(), ref_obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MEM_free(strValues);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
int arraySize = 0;
|
||||
tag_t* tag_array;
|
||||
USERSERVICE_array_t arrayStruct;
|
||||
arraySize = retData.size();
|
||||
tag_array = (tag_t*)MEM_alloc(arraySize * sizeof(tag_t));
|
||||
//printf("arraySize=======%d\n",arraySize);
|
||||
|
||||
RetDataIterator retDataIterator = retData.begin();
|
||||
for (int i = 0; i < arraySize; i++)
|
||||
{
|
||||
char* uid = NULL;
|
||||
tag_array[i] = static_cast<tag_t>(*retDataIterator);
|
||||
ITK__convert_tag_to_uid(tag_array[i], &uid);
|
||||
if (uid != NULL) {
|
||||
res.append(uid).append(SPLITTER);
|
||||
}
|
||||
DOFREE(uid);
|
||||
//printf("tag_array[i]=======%u\n",tag_array[i]);
|
||||
++retDataIterator;
|
||||
}
|
||||
|
||||
MEM_free(instance_tags);
|
||||
MEM_free(ret_instances);
|
||||
MEM_free(tag_array);
|
||||
return ifail;
|
||||
}
|
||||
|
||||
int SEARCH_AUTOCODE_NODE(const std::string& searchStr, std::string& res) {
|
||||
int ifail = ITK_ok;
|
||||
const char* class_name = "Cd9_ClassificationCodeNode";
|
||||
RetData retData;
|
||||
SearchCriterionInputs searchCriteria;
|
||||
int length = 0, i = 0;
|
||||
std::map<string, tag_t> prop_to_attrid;
|
||||
std::map<string, string> prop_value_type;
|
||||
tag_t class_id = NULLTAG;
|
||||
int n_instances = 0, n_ret_instances = 0;
|
||||
tag_t* instance_tags = NULL, * ret_instances = NULL;
|
||||
tag_t* tag_array = NULL;
|
||||
|
||||
// printf("Search AutoCode_Node: %s \n", searchStr.c_str());
|
||||
init_search_criteria_map(searchStr, searchCriteria);
|
||||
|
||||
ITKCALL(POM_class_id_of_class(class_name, &class_id));
|
||||
|
||||
for (SearchCriterionInputs::const_iterator searchIter =
|
||||
searchCriteria.begin(); searchIter != searchCriteria.end(); searchIter++) {
|
||||
tag_t attr_id = NULLTAG;
|
||||
ITKCALL(POM_attr_id_of_attr(searchIter->first.c_str(),
|
||||
class_name, &attr_id));
|
||||
|
||||
if (prop_to_attrid.find(searchIter->first) == prop_to_attrid.end()) {
|
||||
prop_to_attrid.insert(make_pair(searchIter->first, attr_id));
|
||||
|
||||
if (searchIter->first.compare(ClassificationCodeNode_node_name) == 0
|
||||
|| searchIter->first.compare(ClassificationCodeNode_segment) == 0) {
|
||||
prop_value_type.insert(make_pair(searchIter->first,
|
||||
"String"));
|
||||
continue;
|
||||
}
|
||||
else
|
||||
if (searchIter->first.compare(ClassificationCodeNode_grant_users) == 0
|
||||
|| searchIter->first.compare(ClassificationCodeNode_grant_roles) == 0
|
||||
|| searchIter->first.compare(ClassificationCodeNode_grant_groups) == 0
|
||||
) {
|
||||
prop_value_type.insert(make_pair(searchIter->first,
|
||||
"TCComponents"));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//find all instance
|
||||
|
||||
ITKCALL(POM_instances_of_class(class_id, FALSE, &n_instances,
|
||||
&instance_tags));
|
||||
if (n_instances > 0)
|
||||
{
|
||||
ITKCALL(POM_load_instances_possible(n_instances, instance_tags, &n_ret_instances, &ret_instances));
|
||||
}
|
||||
|
||||
for (int i = 0; i < n_ret_instances; ++i) {
|
||||
tag_t bo_inst = ret_instances[i];
|
||||
logical is_same = TRUE;
|
||||
int nullUserCount = 0;
|
||||
|
||||
for (SearchCriterionInputs::const_iterator searchIter =
|
||||
searchCriteria.begin(); searchIter != searchCriteria.end(); searchIter++) {
|
||||
std::map<string, tag_t>::iterator prop_to_attrid_iter =
|
||||
prop_to_attrid.find(searchIter->first);
|
||||
std::map<string, string>::iterator prop_value_type_iter =
|
||||
prop_value_type.find(searchIter->first);
|
||||
|
||||
//printf("searchIter->first===========%s\n",searchIter->first.c_str());
|
||||
//printf("searchIter->second.c_str()==========%s\n\n",searchIter->second.c_str());
|
||||
if (prop_value_type_iter->second.compare("String") == 0) {
|
||||
char* str_val = NULL;
|
||||
logical is_it_null = FALSE;
|
||||
logical is_it_empty = FALSE;
|
||||
ITKCALL(POM_ask_attr_string(bo_inst, prop_to_attrid_iter->second,
|
||||
&str_val, &is_it_null, &is_it_empty));
|
||||
|
||||
//printf("searchIter->second.c_str()=======%s\n",searchIter->second.c_str());
|
||||
if ((is_it_empty || is_it_null) && ((tc_strlen(searchIter->second.c_str()) == 0) || (searchIter->second.c_str() == NULL)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (tc_strcmp(searchIter->second.c_str(), str_val) != 0) {
|
||||
is_same = FALSE;
|
||||
MEM_free(str_val);
|
||||
break;
|
||||
}
|
||||
MEM_free(str_val);
|
||||
}
|
||||
else {
|
||||
if (prop_value_type_iter->second.compare("TCComponents") == 0) {
|
||||
logical* is_it_null = FALSE, * is_it_empty = FALSE;
|
||||
tag_t* values;
|
||||
int targetNum = 0, m = 0;
|
||||
tag_t currentGroupTag;
|
||||
|
||||
if (tc_strlen(searchIter->second.c_str()) == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ITKCALL(POM_string_to_tag(searchIter->second.c_str(), ¤tGroupTag));
|
||||
if (currentGroupTag == NULLTAG)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
POM_length_of_attr(bo_inst, prop_to_attrid_iter->second, &targetNum);
|
||||
if (targetNum == 0)
|
||||
{
|
||||
nullUserCount = nullUserCount + 1;
|
||||
continue;
|
||||
}
|
||||
if (targetNum > 0) {
|
||||
logical isEqual = FALSE;
|
||||
ITKCALL(POM_ask_attr_tags(bo_inst, prop_to_attrid_iter->second, 0, targetNum, &values, &is_it_null, &is_it_empty));
|
||||
for (int m = 0; m < targetNum; m++)
|
||||
{
|
||||
char* user;
|
||||
ITKCALL(POM_tag_to_string(values[m], &user));
|
||||
if (tc_strcmp(user, searchIter->second.c_str()) == 0)
|
||||
{
|
||||
// printf("searchIter->first.c_str()=======%s\n",searchIter->first.c_str());
|
||||
isEqual = TRUE;
|
||||
continue;
|
||||
}
|
||||
|
||||
//char objectType[TCTYPE_class_name_size_c+1]="";
|
||||
char* objectType = NULL;
|
||||
tag_t typetag;
|
||||
ITKCALL(TCTYPE_ask_object_type(values[m], &typetag));
|
||||
TCTYPE_ask_class_name2(typetag, &objectType);
|
||||
if (tc_strcmp("Group", objectType) != 0)
|
||||
{
|
||||
MEM_free(user);
|
||||
MEM_free(objectType);
|
||||
continue;
|
||||
}
|
||||
MEM_free(objectType);
|
||||
tag_t parent1;
|
||||
char* parentString1;
|
||||
SA_ask_group_parent(currentGroupTag, &parent1);
|
||||
if (parent1 == NULLTAG)
|
||||
{
|
||||
MEM_free(user);
|
||||
continue;
|
||||
}
|
||||
|
||||
ITKCALL(POM_tag_to_string(parent1, &parentString1));
|
||||
if (tc_strcmp(parentString1, user) == 0)
|
||||
{
|
||||
isEqual = TRUE;
|
||||
MEM_free(user);
|
||||
MEM_free(parentString1);
|
||||
continue;
|
||||
}
|
||||
MEM_free(parentString1);
|
||||
tag_t parent2;
|
||||
char* parentString2;
|
||||
SA_ask_group_parent(parent1, &parent2);
|
||||
if (parent2 == NULLTAG)
|
||||
{
|
||||
MEM_free(user);
|
||||
continue;
|
||||
}
|
||||
ITKCALL(POM_tag_to_string(parent2, &parentString2));
|
||||
if (tc_strcmp(parentString2, user) == 0)
|
||||
{
|
||||
isEqual = TRUE;
|
||||
MEM_free(user);
|
||||
MEM_free(parentString2);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
MEM_free(user);
|
||||
MEM_free(parentString2);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
MEM_free(values);
|
||||
MEM_free(is_it_null);
|
||||
MEM_free(is_it_empty);
|
||||
if (isEqual == FALSE)
|
||||
{
|
||||
nullUserCount = nullUserCount + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_same) {
|
||||
// printf("is_same=======%d\n",is_same);
|
||||
if (nullUserCount < 3)
|
||||
{
|
||||
retData.insert(retData.end(), bo_inst);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
{
|
||||
int arraySize = 0;
|
||||
|
||||
USERSERVICE_array_t arrayStruct;
|
||||
arraySize = retData.size();
|
||||
tag_array = (tag_t*)MEM_alloc(arraySize * sizeof(tag_t));
|
||||
//printf("arraySize=======%d\n",arraySize);
|
||||
|
||||
RetDataIterator retDataIterator = retData.begin();
|
||||
for (i = 0; i < arraySize; i++)
|
||||
{
|
||||
char* uid = NULL;
|
||||
tag_array[i] = static_cast<tag_t>(*retDataIterator);
|
||||
ITK__convert_tag_to_uid(tag_array[i], &uid);
|
||||
if (uid != NULL) {
|
||||
res.append(uid).append(SPLITTER);
|
||||
}
|
||||
//printf("tag_array[i]=======%u\n",tag_array[i]);
|
||||
++retDataIterator;
|
||||
DOFREE(uid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
search_autocode_node_end:
|
||||
DOFREE(instance_tags);
|
||||
DOFREE(ret_instances);
|
||||
DOFREE(tag_array);
|
||||
return ifail;
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -0,0 +1,279 @@
|
||||
#include "Connor_NX.h"
|
||||
#include "origin_PropNames.h"
|
||||
#include <sa/groupmember.h>
|
||||
#include <pom/enq/enq.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
const char* getChildrenNodesString(vector<string> propNames, vector<string> propValues, int length)
|
||||
{
|
||||
int ifail = ITK_ok;
|
||||
const char* class_name = "Cd9_CodeRelation";
|
||||
const char* selectTreeNode = "Select Cd9_CodeRelation1";
|
||||
const char* select_nextidAttrs[1] = { CodeRelation_children_nodes };
|
||||
int rows, cols;
|
||||
void*** report = NULL;
|
||||
int i = 0;
|
||||
const char* strValues;
|
||||
|
||||
ITKCALL(POM_enquiry_create(selectTreeNode));
|
||||
ITKCALL(POM_enquiry_add_select_attrs(selectTreeNode, class_name,
|
||||
1, (const char**)select_nextidAttrs));
|
||||
|
||||
if (length == 1)
|
||||
{
|
||||
if (tc_strlen(propValues[0].c_str()) == 0)
|
||||
{
|
||||
ifail = POM_enquiry_set_attr_expr(selectTreeNode, "expr1", class_name, propNames[0].c_str(), POM_enquiry_is_null, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char* temp = propValues[0].c_str();
|
||||
ifail = POM_enquiry_set_string_value(selectTreeNode, "prop1", 1, (const char**)&temp, POM_enquiry_bind_value);
|
||||
ifail = POM_enquiry_set_attr_expr(selectTreeNode, "expr1", class_name, propNames[0].c_str(), POM_enquiry_equal, "prop1");
|
||||
}
|
||||
ifail = POM_enquiry_set_where_expr(selectTreeNode, "expr1");
|
||||
}
|
||||
else {
|
||||
if (tc_strlen(propValues[0].c_str()) == 0)
|
||||
{
|
||||
ifail = POM_enquiry_set_attr_expr(selectTreeNode, "expr1", class_name, propNames[0].c_str(), POM_enquiry_is_null, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char* temp = propValues[0].c_str();
|
||||
ifail = POM_enquiry_set_string_value(selectTreeNode, "prop1", 1, (const char**)&temp, POM_enquiry_bind_value);
|
||||
ifail = POM_enquiry_set_attr_expr(selectTreeNode, "expr1", class_name, propNames[0].c_str(), POM_enquiry_equal, "prop1");
|
||||
}
|
||||
|
||||
if (tc_strlen(propValues[1].c_str()) == 0)
|
||||
{
|
||||
ifail = POM_enquiry_set_attr_expr(selectTreeNode, "expr2", class_name, propNames[1].c_str(), POM_enquiry_is_null, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char* temp = propValues[1].c_str();
|
||||
ifail = POM_enquiry_set_string_value(selectTreeNode, "prop2", 1, (const char**)&temp, POM_enquiry_bind_value);
|
||||
ifail = POM_enquiry_set_attr_expr(selectTreeNode, "expr2", class_name, propNames[1].c_str(), POM_enquiry_equal, "prop2");
|
||||
}
|
||||
POM_enquiry_set_expr(selectTreeNode, "expr", "expr1", POM_enquiry_and, "expr2");
|
||||
ifail = POM_enquiry_set_where_expr(selectTreeNode, "expr");
|
||||
}
|
||||
|
||||
ITKCALL(POM_enquiry_execute(selectTreeNode, &rows, &cols, &report));
|
||||
//printf("nextidRows===============%d\n",rows);
|
||||
if (rows > 0)
|
||||
{
|
||||
strValues = (char*)report[0][0];
|
||||
}
|
||||
else
|
||||
{
|
||||
strValues = "";
|
||||
}
|
||||
POM_enquiry_delete(selectTreeNode);
|
||||
return strValues;
|
||||
}
|
||||
|
||||
int isContainChildrenNode(vector<string> propNames, vector<string>propValues, int length)
|
||||
{
|
||||
int returnValue = 0;;
|
||||
const char* value = getChildrenNodesString(propNames, propValues, length);
|
||||
if (tc_strlen(value) > 0)
|
||||
{
|
||||
returnValue = 1;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
int SEARCH_TREE_OR_LIST_NODE(const std::string& searchStr, std::string& res) {
|
||||
int ifail = ITK_ok;
|
||||
const char* class_name = "Cd9_CodeRelation";
|
||||
int i = 0;
|
||||
int length = 0;
|
||||
vector<string> propNames;
|
||||
vector<string> propValues;
|
||||
//clock_t start, finish;
|
||||
//double duration;
|
||||
//start = clock();
|
||||
|
||||
init_search_criteria_vector(searchStr, propNames, propValues);
|
||||
length = propNames.size();
|
||||
const char* strValues = getChildrenNodesString(propNames, propValues, length);
|
||||
if (tc_strlen(strValues) > 0)
|
||||
{
|
||||
int arraySize = 0;
|
||||
std::vector< std::string > searched_tags;
|
||||
Split(strValues, ",", searched_tags);
|
||||
arraySize = (int)searched_tags.size();
|
||||
for (int i = 0; i < (int)searched_tags.size(); i++)
|
||||
{
|
||||
if (tc_strlen(searched_tags[i].c_str()) > 0)
|
||||
{
|
||||
|
||||
tag_t ref_obj = NULLTAG;
|
||||
ITKCALL(POM_string_to_tag(searched_tags[i].c_str(), &ref_obj));
|
||||
if (ref_obj != NULLTAG)
|
||||
{
|
||||
res.append(searched_tags[i].c_str()).append(SPLITTER);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//finish = clock();
|
||||
//duration = (double)(finish - start) / CLOCKS_PER_SEC;
|
||||
//printf("%f seconds²éѯʱ¼ä\n",duration);
|
||||
propNames.clear();
|
||||
propValues.clear();
|
||||
return ifail;
|
||||
}
|
||||
|
||||
int IS_CONTAIN_CHILD_NODE(const std::string& searchStr, std::string& res)
|
||||
{
|
||||
int ifail = ITK_ok;
|
||||
const char* class_name = "Cd9_CodeRelation";
|
||||
RetData retData;
|
||||
|
||||
vector<string> propNames;
|
||||
vector<string> propValues;
|
||||
int length = 0, i = 0;
|
||||
/*ITKCALL(ifail = USERARG_get_string_array_argument(&length, &propNames));
|
||||
ITKCALL(ifail = USERARG_get_string_array_argument(&length, &propValues));
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
string s1 = (propNames[i]);
|
||||
string s2 = (propValues[i]);
|
||||
}*/
|
||||
init_search_criteria_vector(searchStr, propNames, propValues);
|
||||
length = propNames.size();
|
||||
int isContains = isContainChildrenNode(propNames, propValues, length);
|
||||
char* returnData;
|
||||
returnData = (char*)MEM_alloc(5 * sizeof(char));
|
||||
if (isContains == 1)
|
||||
{
|
||||
tc_strcpy(returnData, "true");
|
||||
}
|
||||
else
|
||||
{
|
||||
tc_strcpy(returnData, "false");
|
||||
}
|
||||
res.append(returnData);
|
||||
propNames.clear();
|
||||
propValues.clear();
|
||||
return ifail;
|
||||
}
|
||||
|
||||
int SEARCH_PARENT_TREE_OR_LIST_NODE(const std::string& searchStr, std::string& res) {
|
||||
int ifail = ITK_ok;
|
||||
const char* class_name = "Cd9_CodeRelation";
|
||||
SearchCriterionInputs searchCriteria;
|
||||
|
||||
init_search_criteria_map(searchStr, searchCriteria);
|
||||
tag_t class_id = NULLTAG;
|
||||
ITKCALL(POM_class_id_of_class(class_name, &class_id));
|
||||
|
||||
std::map<string, tag_t> prop_to_attrid;
|
||||
std::map<string, string> prop_value_type;
|
||||
|
||||
for (SearchCriterionInputs::const_iterator searchIter =
|
||||
searchCriteria.begin(); searchIter != searchCriteria.end(); searchIter++) {
|
||||
tag_t attr_id = NULLTAG;
|
||||
ITKCALL(POM_attr_id_of_attr(searchIter->first.c_str(),
|
||||
class_name, &attr_id));
|
||||
|
||||
if (prop_to_attrid.find(searchIter->first) == prop_to_attrid.end()) {
|
||||
prop_to_attrid.insert(make_pair(searchIter->first, attr_id));
|
||||
|
||||
if (searchIter->first.compare(CodeRelation_children_nodes) == 0
|
||||
|| searchIter->first.compare(CodeRelation_current_node) == 0) {
|
||||
prop_value_type.insert(make_pair(searchIter->first,
|
||||
"String"));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//find all instance
|
||||
int n_instances = 0, n_ret_instances = 0;
|
||||
tag_t* instance_tags = NULL, * ret_instances = NULL;
|
||||
ITKCALL(POM_instances_of_class(class_id, FALSE, &n_instances,
|
||||
&instance_tags));
|
||||
if (n_instances > 0)
|
||||
{
|
||||
ITKCALL(POM_load_instances_possible(n_instances, instance_tags, &n_ret_instances, &ret_instances));
|
||||
}
|
||||
|
||||
for (int i = 0; i < n_ret_instances; ++i) {
|
||||
tag_t bo_inst = ret_instances[i];
|
||||
logical is_same = TRUE;
|
||||
|
||||
for (SearchCriterionInputs::const_iterator searchIter =
|
||||
searchCriteria.begin(); searchIter != searchCriteria.end(); searchIter++) {
|
||||
std::map<string, tag_t>::iterator prop_to_attrid_iter =
|
||||
prop_to_attrid.find(searchIter->first);
|
||||
|
||||
std::map<string, string>::iterator prop_value_type_iter =
|
||||
prop_value_type.find(searchIter->first);
|
||||
|
||||
//printf("searchIter->first===========%s\n",searchIter->first.c_str());
|
||||
//printf("searchIter->second.c_str()==========%s\n\n",searchIter->second.c_str());
|
||||
if (prop_value_type_iter->second.compare("String") == 0) {
|
||||
char* str_val = NULL;
|
||||
logical is_it_null = FALSE;
|
||||
logical is_it_empty = FALSE;
|
||||
ITKCALL(POM_ask_attr_string(bo_inst, prop_to_attrid_iter->second,
|
||||
&str_val, &is_it_null, &is_it_empty));
|
||||
|
||||
if ((is_it_empty || is_it_null) && ((tc_strlen(searchIter->second.c_str()) == 0) || (searchIter->second.c_str() == NULL)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (tc_strcmp(searchIter->second.c_str(), str_val) != 0) {
|
||||
is_same = FALSE;
|
||||
MEM_free(str_val);
|
||||
break;
|
||||
}
|
||||
MEM_free(str_val);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_same) {
|
||||
tag_t attr_id = NULLTAG;
|
||||
logical is_it_null = FALSE, is_it_empty = FALSE;
|
||||
char* strValues = NULL;
|
||||
ITKCALL(POM_attr_id_of_attr(CodeRelation_parent_nodes, class_name, &attr_id));
|
||||
ITKCALL(POM_ask_attr_string(bo_inst, attr_id, &strValues, &is_it_null, &is_it_empty));
|
||||
|
||||
if (is_it_empty || is_it_null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
std::vector< std::string > searched_tags;
|
||||
Split(strValues, ",", searched_tags);
|
||||
for (int i = 0; i < (int)searched_tags.size(); i++)
|
||||
{
|
||||
if (tc_strlen(searched_tags[i].c_str()) > 0)
|
||||
{
|
||||
tag_t ref_obj = NULLTAG;
|
||||
ITKCALL(POM_string_to_tag(searched_tags[i].c_str(), &ref_obj));
|
||||
if (ref_obj != NULLTAG)
|
||||
{
|
||||
res.append(searched_tags[i]).append(SPLITTER);
|
||||
}
|
||||
}
|
||||
}
|
||||
MEM_free(strValues);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
MEM_free(instance_tags);
|
||||
MEM_free(ret_instances);
|
||||
// MEM_free(tag_array);
|
||||
return ifail;
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -0,0 +1,88 @@
|
||||
#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 <tchar.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 <time.h>
|
||||
#include <ae/ae.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <res\reservation.h>
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#include <io.h>
|
||||
#include <direct.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#define DOFREE(obj) \
|
||||
{ \
|
||||
if(obj) \
|
||||
{ \
|
||||
MEM_free(obj); \
|
||||
obj = NULL; \
|
||||
} \
|
||||
}
|
||||
|
||||
extern "C" int POM_AM__set_application_bypass(logical bypass);
|
||||
|
||||
using namespace std;
|
||||
|
||||
void WriteLog(logical debug, const char* format, ...);
|
||||
void set_bypass(logical bypass);
|
||||
char* G2U(const char* gb2312);
|
||||
int getPrefStrings(const char* preference, TC_preference_search_scope_t scope, vector<string>& pref_vec);
|
||||
int export_dataset_file(bool debug, tag_t dataset, const char* ref_name, const char* ext, char** filename, char** original_name);
|
||||
int GetBomView(tag_t rev_tag, const char* viewtype, tag_t* bomView, tag_t* bomBVR, bool debug);
|
||||
int GetBomLinePropString(bool debug, tag_t line, char* propName, int errCode, char** attr_val);
|
||||
void Split(string strArg, char spliter, vector<string>& ans);
|
||||
void Split(string strArg, string spliter, vector<string>& ans);
|
||||
int getPrefStrings2(const char* preference, TC_preference_search_scope_t scope, char splitter, vector<string>& pref_vec);
|
||||
int import_dataset_file(tag_t dataset, const char* ref_name, char* ext, char* fullfilename, char* original_name);
|
||||
int import_dataset_file_binary(tag_t dataset, const char* ref_name, char* ext, char* fullfilename, char* original_name);
|
||||
int readError(bool debug, char* errFilePath, int errCode);
|
||||
void deleteFile(bool debug, char* path);
|
||||
bool CheckType(string config, char* type, char spliter);
|
||||
bool propExist(bool debug, tag_t obj, const char* propName);
|
||||
bool isRev(char* object_type);
|
||||
int GetProcessTargets(bool debug, int att_cnt, tag_t* attachments, vector<tag_t>& targets, char* formType, char splitter);
|
||||
bool inArray(vector<string> types, string type);
|
||||
int getIndexInArray(vector<string> types, string type);
|
||||
int findUser(bool debug, string userStr, tag_t* user_tag);
|
||||
bool isType(tag_t item, char* type);
|
||||
void initUserDir(char* userId);
|
||||
int CreateUserFile(logical debug, const char* FunctionName, char* userId, char** fullname, FILE** file);
|
||||
int WriteToFile(logical debug, FILE* file, const char* format, ...);
|
@ -0,0 +1,169 @@
|
||||
// cd9_TreeAndListCodeNode
|
||||
|
||||
#define TreeAndListCodeNode_uid "uid" // Integer 节点序号
|
||||
|
||||
#define TreeAndListCodeNode_isContainsChildren "isContainsChildren" // Integer 节点序号
|
||||
#define TreeAndListCodeNode_node_index "cd9_node_index" // Integer 节点序号
|
||||
#define TreeAndListCodeNode_node_type "cd9_node_type"// String 节点名称
|
||||
#define TreeAndListCodeNode_node_name "cd9_node_name"// String 节点名称
|
||||
#define TreeAndListCodeNode_node_value "cd9_node_value" // String 节点值
|
||||
#define TreeAndListCodeNode_node_desc "cd9_node_desc" // String 节点描述
|
||||
#define TreeAndListCodeNode_is_root "cd9_is_root"// boolean 是否是根节点
|
||||
#define TreeAndListCodeNode_code_style "cd9_code_style" // String 编码格式
|
||||
#define TreeAndListCodeNode_code_length "cd9_code_length" // int 编码长度
|
||||
#define TreeAndListCodeNode_rule_node "cd9_rule_node" // String 编码格式
|
||||
#define TreeAndListCodeNode_reference_nodes "cd9_reference_nodes" // 引用的节点
|
||||
|
||||
#define TreeAndListCodeNode_is_lock "cd9_is_lock"// boolean 是否锁定
|
||||
#define TreeAndListCodeNode_create_date "cd9_create_date"// Date 创建日期
|
||||
#define TreeAndListCodeNode_last_revise_date "cd9_last_revise_date"// Date 最后修改日期
|
||||
#define TreeAndListCodeNode_create_user "cd9_create_user"// TypeReference 创建者
|
||||
#define TreeAndListCodeNode_last_revise_user "cd9_last_revise_user"// TypeReference 最后修改者
|
||||
|
||||
#define TreeAndListCodeNode_seq_begin_value "cd9_seq_begin_value" // Integer 流水码初始值
|
||||
#define TreeAndListCodeNode_seq_max_value "cd9_seq_max_value" // Integer 流水码最大值
|
||||
#define TreeAndListCodeNode_seq_length "cd9_seq_length" // Integer 流水码长度
|
||||
#define TreeAndListCodeNode_isDefaultSelected "cd9_isDefaultSelected" // boolean是否默认选中
|
||||
#define TreeAndListCodeNode_icsID "cd9_icsID" //对应的分类ID
|
||||
|
||||
// Cd9_CodeRelation
|
||||
#define CodeRelation_parent_nodes "cd9_parent_nodes" // TypeReference 父节点
|
||||
#define CodeRelation_current_node "cd9_current_node" // TypeReference 当前节点
|
||||
#define CodeRelation_children_nodes "cd9_children_nodes" // TypeReference 子节点
|
||||
#define CodeRelation_create_date "cd9_create_date"// Date 创建日期
|
||||
#define CodeRelation_create_user "cd9_create_user"// TypeReference 创建者
|
||||
|
||||
// Cd9_ClassificationCodeNode
|
||||
#define ClassificationCodeNode_node_index "cd9_node_index" // Integer 节点序号
|
||||
#define ClassificationCodeNode_node_name "cd9_node_name"// String 节点名称
|
||||
#define ClassificationCodeNode_segment "cd9_segment"// String 所含码段
|
||||
#define ClassificationCodeNode_create_date "cd9_create_date"// Date 创建日期
|
||||
#define ClassificationCodeNode_last_revise_date "cd9_last_revise_date"// Date 最后修改日期
|
||||
#define ClassificationCodeNode_create_user "cd9_create_user"// TypeReference 创建者
|
||||
#define ClassificationCodeNode_last_revise_user "cd9_last_revise_user"// TypeReference 最后修改者
|
||||
#define ClassificationCodeNode_grant_users "cd9_grant_users"// TypeReference 授权用户
|
||||
#define ClassificationCodeNode_grant_roles "cd9_grant_roles"// TypeReference 授权角色
|
||||
#define ClassificationCodeNode_grant_groups "cd9_grant_groups"// TypeReference 授权组
|
||||
|
||||
// Cd9_CodeSequence
|
||||
#define CodeSequence_seq_node_index "cd9_seq_node_index" // string 流水码码段名称
|
||||
#define CodeSequence_seq_node_name "cd9_seq_node_name" // Integer 流水码初始值
|
||||
#define CodeSequence_seq_begin_value "cd9_seq_begin_value" // Integer 流水码初始值
|
||||
#define CodeSequence_seq_max_value "cd9_seq_max_value" // Integer 流水码最大值
|
||||
#define CodeSequence_seq_length "cd9_seq_length" // Integer 流水码长度
|
||||
#define CodeSequence_seq_step "cd9_seq_step" // Integer 流水码步长
|
||||
#define CodeSequence_seq_exclude_num "cd9_seq_exclude_num" // String 流水码不包含数字
|
||||
#define CodeSequence_is_lock "cd9_is_lock"// boolean 是否锁定
|
||||
#define CodeSequence_create_date "cd9_create_date"// Date 创建日期
|
||||
#define CodeSequence_last_revise_date "cd9_last_revise_date"// Date 最后修改日期
|
||||
#define CodeSequence_create_user "cd9_create_user"// TypeReference 创建者
|
||||
#define CodeSequence_last_revise_user "cd9_last_revise_user"// TypeReference 最后修改者
|
||||
|
||||
// Cd9_CodeCounter
|
||||
#define CodeCounter_index "cd9_index"
|
||||
#define CodeCounter_name "cd9_name"
|
||||
#define CodeCounter_recycleID "cd9_recycleID"
|
||||
#define CodeCounter_isUsed "cd9_isUsed"
|
||||
#define CodeCounter_createDate "cd9_createDate"
|
||||
#define CodeCounter_createUser "cd9_createUser"
|
||||
#define CodeCounter_last_revise_date "cd9_last_revise_date"// Date 最后修改日期
|
||||
#define CodeCounter_last_revise_user "cd9_last_revise_user"
|
||||
|
||||
// Item
|
||||
#define Item_codeDesc "cd9_codeDesc"
|
||||
#define Item_codePattern "cd9_codePattern"
|
||||
#define Item_codeID "cd9_codeID"
|
||||
#define Item_codeRuleName "cd9_codeRuleName"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// cd9_TreeAndListCodeNode
|
||||
|
||||
#define TreeAndListCodeNode_uid "uid" // Integer 节点序号
|
||||
|
||||
#define TreeAndListCodeNode_isContainsChildren "isContainsChildren" // Integer 节点序号
|
||||
#define TreeAndListCodeNode_node_index "cd9_node_index" // Integer 节点序号
|
||||
#define TreeAndListCodeNode_node_type "cd9_node_type"// String 节点名称
|
||||
#define TreeAndListCodeNode_node_name "cd9_node_name"// String 节点名称
|
||||
#define TreeAndListCodeNode_node_value "cd9_node_value" // String 节点值
|
||||
#define TreeAndListCodeNode_node_desc "cd9_node_desc" // String 节点描述
|
||||
#define TreeAndListCodeNode_is_root "cd9_is_root"// boolean 是否是根节点
|
||||
#define TreeAndListCodeNode_code_style "cd9_code_style" // String 编码格式
|
||||
#define TreeAndListCodeNode_code_length "cd9_code_length" // int 编码长度
|
||||
#define TreeAndListCodeNode_rule_node "cd9_rule_node" // String 编码格式
|
||||
#define TreeAndListCodeNode_reference_nodes "cd9_reference_nodes" // 引用的节点
|
||||
|
||||
#define TreeAndListCodeNode_is_lock "cd9_is_lock"// boolean 是否锁定
|
||||
#define TreeAndListCodeNode_create_date "cd9_create_date"// Date 创建日期
|
||||
#define TreeAndListCodeNode_last_revise_date "cd9_last_revise_date"// Date 最后修改日期
|
||||
#define TreeAndListCodeNode_create_user "cd9_create_user"// TypeReference 创建者
|
||||
#define TreeAndListCodeNode_last_revise_user "cd9_last_revise_user"// TypeReference 最后修改者
|
||||
|
||||
#define TreeAndListCodeNode_seq_begin_value "cd9_seq_begin_value" // Integer 流水码初始值
|
||||
#define TreeAndListCodeNode_seq_max_value "cd9_seq_max_value" // Integer 流水码最大值
|
||||
#define TreeAndListCodeNode_seq_length "cd9_seq_length" // Integer 流水码长度
|
||||
#define TreeAndListCodeNode_isDefaultSelected "cd9_isDefaultSelected" // boolean是否默认选中
|
||||
#define TreeAndListCodeNode_icsID "cd9_icsID" //对应的分类ID
|
||||
|
||||
// Cd9_CodeRelation
|
||||
#define CodeRelation_parent_nodes "cd9_parent_nodes" // TypeReference 父节点
|
||||
#define CodeRelation_current_node "cd9_current_node" // TypeReference 当前节点
|
||||
#define CodeRelation_children_nodes "cd9_children_nodes" // TypeReference 子节点
|
||||
#define CodeRelation_create_date "cd9_create_date"// Date 创建日期
|
||||
#define CodeRelation_create_user "cd9_create_user"// TypeReference 创建者
|
||||
|
||||
// Cd9_ClassificationCodeNode
|
||||
#define ClassificationCodeNode_node_index "cd9_node_index" // Integer 节点序号
|
||||
#define ClassificationCodeNode_node_name "cd9_node_name"// String 节点名称
|
||||
#define ClassificationCodeNode_segment "cd9_segment"// String 所含码段
|
||||
#define ClassificationCodeNode_create_date "cd9_create_date"// Date 创建日期
|
||||
#define ClassificationCodeNode_last_revise_date "cd9_last_revise_date"// Date 最后修改日期
|
||||
#define ClassificationCodeNode_create_user "cd9_create_user"// TypeReference 创建者
|
||||
#define ClassificationCodeNode_last_revise_user "cd9_last_revise_user"// TypeReference 最后修改者
|
||||
#define ClassificationCodeNode_grant_users "cd9_grant_users"// TypeReference 授权用户
|
||||
#define ClassificationCodeNode_grant_roles "cd9_grant_roles"// TypeReference 授权角色
|
||||
#define ClassificationCodeNode_grant_groups "cd9_grant_groups"// TypeReference 授权组
|
||||
|
||||
// Cd9_CodeSequence
|
||||
#define CodeSequence_seq_node_index "cd9_seq_node_index" // string 流水码码段名称
|
||||
#define CodeSequence_seq_node_name "cd9_seq_node_name" // Integer 流水码初始值
|
||||
#define CodeSequence_seq_begin_value "cd9_seq_begin_value" // Integer 流水码初始值
|
||||
#define CodeSequence_seq_max_value "cd9_seq_max_value" // Integer 流水码最大值
|
||||
#define CodeSequence_seq_length "cd9_seq_length" // Integer 流水码长度
|
||||
#define CodeSequence_seq_step "cd9_seq_step" // Integer 流水码步长
|
||||
#define CodeSequence_seq_exclude_num "cd9_seq_exclude_num" // String 流水码不包含数字
|
||||
#define CodeSequence_is_lock "cd9_is_lock"// boolean 是否锁定
|
||||
#define CodeSequence_create_date "cd9_create_date"// Date 创建日期
|
||||
#define CodeSequence_last_revise_date "cd9_last_revise_date"// Date 最后修改日期
|
||||
#define CodeSequence_create_user "cd9_create_user"// TypeReference 创建者
|
||||
#define CodeSequence_last_revise_user "cd9_last_revise_user"// TypeReference 最后修改者
|
||||
|
||||
// Cd9_CodeCounter
|
||||
#define CodeCounter_index "cd9_index"
|
||||
#define CodeCounter_name "cd9_name"
|
||||
#define CodeCounter_recycleID "cd9_recycleID"
|
||||
#define CodeCounter_isUsed "cd9_isUsed"
|
||||
#define CodeCounter_createDate "cd9_createDate"
|
||||
#define CodeCounter_createUser "cd9_createUser"
|
||||
#define CodeCounter_last_revise_date "cd9_last_revise_date"// Date 最后修改日期
|
||||
#define CodeCounter_last_revise_user "cd9_last_revise_user"
|
||||
|
||||
// Item
|
||||
#define Item_codeDesc "cd9_codeDesc"
|
||||
#define Item_codePattern "cd9_codePattern"
|
||||
#define Item_codeID "cd9_codeID"
|
||||
#define Item_codeRuleName "cd9_codeRuleName"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma once
|
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="lib/commons-io-2.6.jar"/>
|
||||
<classpathentry kind="lib" path="lib/jfxrt.jar"/>
|
||||
<classpathentry kind="lib" path="lib/jfxswt.jar"/>
|
||||
<classpathentry kind="lib" path="lib/NXOpen.jar"/>
|
||||
<classpathentry kind="lib" path="lib/NXOpenUF.jar"/>
|
||||
<classpathentry kind="lib" path="lib/NXOpenUI.jar"/>
|
||||
<classpathentry kind="lib" path="jsonlib/commons-beanutils-1.7.0.jar"/>
|
||||
<classpathentry kind="lib" path="jsonlib/commons-collections-3.2.jar"/>
|
||||
<classpathentry kind="lib" path="jsonlib/commons-lang-2.4.jar"/>
|
||||
<classpathentry kind="lib" path="jsonlib/commons-logging-1.1.jar"/>
|
||||
<classpathentry kind="lib" path="jsonlib/ezmorph-1.0.4.jar"/>
|
||||
<classpathentry kind="lib" path="jsonlib/jdom.jar"/>
|
||||
<classpathentry kind="lib" path="jsonlib/json-lib-2.2.2-jdk15.jar"/>
|
||||
<classpathentry kind="lib" path="jsonlib/json-lib-2.2.3-jdk13.jar"/>
|
||||
<classpathentry kind="lib" path="lib/axis.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-discovery-0.2.jar"/>
|
||||
<classpathentry kind="lib" path="lib/org.apache.commons.logging_1.2.0.v20180409-1502.jar"/>
|
||||
<classpathentry kind="lib" path="lib/saaj.jar"/>
|
||||
<classpathentry kind="lib" path="jsonlib/javax.wsdl_1.6.2.v201012040545.jar"/>
|
||||
<classpathentry kind="lib" path="lib/jaxrpc.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
@ -0,0 +1 @@
|
||||
/bin/
|
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>NX_Connor_QF</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1,10 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/org/tempuri/ErpWebService.java=UTF-8
|
||||
encoding//src/org/tempuri/ErpWebServiceLocator.java=UTF-8
|
||||
encoding//src/org/tempuri/ErpWebServiceSoap.java=UTF-8
|
||||
encoding//src/org/tempuri/ErpWebServiceSoapStub.java=UTF-8
|
||||
encoding//src/service/KWebService.java=UTF-8
|
||||
encoding//src/service/KWebServicePortBindingStub.java=UTF-8
|
||||
encoding//src/service/KWebServiceService.java=UTF-8
|
||||
encoding//src/service/KWebServiceServiceLocator.java=UTF-8
|
||||
encoding/TopDownDesignUI.dlx=UTF-8
|
@ -0,0 +1,15 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
@ -0,0 +1,91 @@
|
||||
package nx_connor;
|
||||
|
||||
import com.sun.javafx.util.Logging;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.application.Platform;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.stage.Stage;
|
||||
import sun.util.logging.PlatformLogger.Level;
|
||||
|
||||
public abstract class KFXPanel extends Application {
|
||||
|
||||
static {
|
||||
Platform.setImplicitExit(false);
|
||||
Logging.getCSSLogger().setLevel(Level.OFF);
|
||||
}
|
||||
|
||||
public KFXPanel(Stage dialog) throws Exception {
|
||||
setParentDialog(dialog);
|
||||
initUI();
|
||||
}
|
||||
|
||||
public KFXPanel(Stage dialog, Class<?> c, String css) throws Exception {
|
||||
setParentDialog(dialog);
|
||||
this.cssForm = c.getResource(css).toExternalForm();
|
||||
initUI();
|
||||
}
|
||||
|
||||
protected Scene scene;
|
||||
protected Parent root;
|
||||
protected String cssForm;
|
||||
protected Stage parentDialog;
|
||||
|
||||
public void setParentDialog(Stage dialog) {
|
||||
this.parentDialog = dialog;
|
||||
if(dialog!=null) {
|
||||
dialog.getIcons().add(new Image(KMain.class.getResourceAsStream("teamcenter_app_128.gif")));
|
||||
}
|
||||
}
|
||||
|
||||
public Stage getParentDialog() {
|
||||
return this.parentDialog;
|
||||
}
|
||||
|
||||
public Parent getRoot() {
|
||||
return root;
|
||||
}
|
||||
|
||||
public Scene getScene() {
|
||||
if (scene == null) {
|
||||
scene = new Scene(root);
|
||||
scene.setFill(null);
|
||||
}
|
||||
return scene;
|
||||
}
|
||||
|
||||
public abstract Object getController();
|
||||
|
||||
protected void initUI() throws Exception {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader();
|
||||
String resource = this.getClass().getSimpleName() + ".fxml";
|
||||
// System.out.println("Load Resource: "+resource);
|
||||
fxmlLoader.setLocation(this.getClass().getResource(resource));
|
||||
fxmlLoader.setController(getController());
|
||||
root = fxmlLoader.load();
|
||||
// controller = fxmlLoader.getController();
|
||||
// primaryStage.initStyle(StageStyle.TRANSPARENT);
|
||||
if (cssForm != null) {
|
||||
root.getStylesheets().add(cssForm);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
initUI();
|
||||
primaryStage.setScene(getScene());
|
||||
primaryStage.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Run as javafx application to test ui
|
||||
*
|
||||
* @param args
|
||||
*/
|
||||
// public static void main(String[] args) {
|
||||
// launch(args);
|
||||
// }
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
package nx_connor;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import nx_connor.autcocode.AutoCode;
|
||||
import nx_connor.bomcopy.BomCopy;
|
||||
import nx_connor.bomcopy2.BomCopy2;
|
||||
import nx_connor.util.KUtil;
|
||||
import nxopen.NXException;
|
||||
import nxopen.NXMessageBox.DialogType;
|
||||
import nxopen.Session;
|
||||
import nxopen.SessionFactory;
|
||||
import nxopen.UFSession;
|
||||
import nxopen.UI;
|
||||
|
||||
public class KMain {
|
||||
|
||||
public static Session theSession = null;
|
||||
public static UI theUI = null;
|
||||
public static UFSession theUFSession = null;
|
||||
public static final String APP_PATH;
|
||||
|
||||
public static final String SPLIT_SECTION = "&SECTION&";
|
||||
public static final String SPLIT_PROP_STR = "&PROP&";
|
||||
public static final String SPLIT_PROP_NAME_VALUE = "&=&";
|
||||
public static final String SPLITTER = "&;&";
|
||||
|
||||
public static final String COMMAND_TOP_DOWN_DESIGN_NX = "TOP-DOWN-DESIGN-NX";
|
||||
public static final String COMMAND_TOP_DOWN_DESIGN_FX = "TOP-DOWN-DESIGN";
|
||||
public static final String COMMAND_AUTOCODE = "AUTOCODE";
|
||||
public static final int INPUTCODE_GetPrefValue = 0;
|
||||
public static final int INPUTCODE_Parse_NX_Template_By_ID = 1;
|
||||
public static final int INPUTCODE_Read_NX_Image_By_ID = 2;
|
||||
public static final int INPUTCODE_Download_Dataset_By_UID = 3;
|
||||
public static final int INPUTCODE_GET_ALL_SUB_TYPES = 4;
|
||||
public static final int INPUTCODE_SEARCH_AUTOCODE_NODE = 5;
|
||||
public static final int INPUTCODE_GET_UID = 6;
|
||||
public static final int INPUTCODE_SEARCH_AUTOCODE_SEGMENT = 7;
|
||||
public static final int INPUTCODE_SEARCH_AUTOCODE_USER = 8;
|
||||
public static final int INPUTCODE_GET_TREE_AND_LIST_STRING_VALUE = 9;
|
||||
public static final int INPUTCODE_GET_NEW_REV_ID = 10;
|
||||
public static final int INPUTCODE_GET_LOGICAL_PROP_VALUE = 11;
|
||||
public static final int INPUTCODE_SEARCH_TREE_OR_LIST_NODE = 12;
|
||||
public static final int INPUTCODE_GET_TREE_AND_LIST_STRING_VALUES = 13;
|
||||
public static final int INPUTCODE_SEARCH_PARENT_TREE_OR_LIST_NODE = 14;
|
||||
public static final int INPUTCODE_ICS_GET_ATTRIBUTES = 15;
|
||||
// public static final int INPUTCODE_ICS_ATTR_IS_REFERENCE_ATTRIBUTE = 16;
|
||||
public static final int INPUTCODE_ICS_ATTR_ASK_PROPERTY = 17;
|
||||
public static final int INPUTCODE_ICS_ATTR_ASK_KEYLOV = 18;
|
||||
public static final int INPUTCODE_GET_DISPLAY_PROP_VALUE = 19;
|
||||
public static final int INPUTCODE_FIND_LOV_BY_NAME = 20;
|
||||
public static final int INPUTCODE_GET_REFERENCE_PROP_VALUE = 21;
|
||||
public static final int INPUTCODE_QUERY_PART_NO = 22;
|
||||
public static final int INPUTCODE_DELETE_RECYCLE_ID = 23;
|
||||
public static final int INPUTCODE_ITEM_EXIST = 24;
|
||||
public static final int INPUTCODE_ITEM_CREATE = 25;
|
||||
public static final int INPUTCODE_ADD_TO_NEWSTUFF = 26;
|
||||
public static final int INPUTCODE_GET_CLASSIFICATION_ID = 27;
|
||||
public static final int INPUTCODE_SEND_ITEM_TO_CLASSIFICATION = 28;
|
||||
public static final int INPUTCODE_GET_ITEMTYPE_BY_ID = 29;
|
||||
public static final int INPUTCODE_GET_REVUID_BY_ID = 30;
|
||||
public static final int INPUTCODE_ITEM_UPDATE = 31;
|
||||
public static final int INPUTCODE_READ_NX_TEMPLATE_BOM = 32;
|
||||
public static final int INPUTCODE_GET_CLONE_INFO = 33;
|
||||
public static final int INPUTCODE_GET_LATEST_ITEM_REVISION = 34;
|
||||
public static final int INPUTCODE_GRANT_PRIVILEGE = 35;
|
||||
public static final int INPUTCODE_GET_UOM_TAGS = 36;
|
||||
public static final int INPUTCODE_UPDATE_UOM = 37;
|
||||
public static final int INPUTCODE_GET_REFERENCE_PROP_VALUE_ARRAY = 38;
|
||||
public static final int INPUTCODE_ICS_ATTR_ASK_METRIC_UNIT = 39;
|
||||
|
||||
static {
|
||||
//APP_PATH = KMain.class.getProtectionDomain().getCodeSource().getLocation().getPath();
|
||||
String path = KMain.class.getProtectionDomain().getCodeSource()
|
||||
.getLocation().getPath();
|
||||
APP_PATH = path.substring(1, path.lastIndexOf('/')+1);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws NXException, java.rmi.RemoteException {
|
||||
theSession = (Session) SessionFactory.get("Session");
|
||||
theUI = (UI) SessionFactory.get("UI");
|
||||
theUFSession = (UFSession) SessionFactory.get("UFSession");
|
||||
|
||||
KUtil.LOG("---------------------------------------------------------------------");
|
||||
KUtil.LOG("NX12_Connor");
|
||||
KUtil.LOG("Args: \n- "+Arrays.toString(args));
|
||||
KUtil.LOG("---------------------------------------------------------------------");
|
||||
int argCnt = args == null ? 0 : args.length;
|
||||
if (argCnt == 0) {
|
||||
return;
|
||||
}else if(argCnt==1) {
|
||||
args = args[0].split("#");
|
||||
}
|
||||
String commandName = args[0].toUpperCase();
|
||||
try {
|
||||
switch (commandName) {
|
||||
case COMMAND_TOP_DOWN_DESIGN_NX:
|
||||
BomCopy.copyFromTemplate(args, false);
|
||||
break;
|
||||
case COMMAND_TOP_DOWN_DESIGN_FX:
|
||||
BomCopy2.copyFromTemplate(args);
|
||||
break;
|
||||
case COMMAND_AUTOCODE:
|
||||
AutoCode.runAutoCode(args);
|
||||
break;
|
||||
default:
|
||||
KUtil.LOG("Unknown Command: " + commandName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
KUtil.LOGERROR(ex);
|
||||
theUI.nxmessageBox().show("´íÎó", DialogType.ERROR, ex.getMessage());
|
||||
}
|
||||
KUtil.LOG("---------------------------------------------------------------------");
|
||||
KUtil.LOG("NX12_Connor Complete");
|
||||
KUtil.LOG("---------------------------------------------------------------------");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,137 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.effect.*?>
|
||||
<?import javafx.geometry.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import java.lang.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.layout.BorderPane?>
|
||||
|
||||
<StackPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<children>
|
||||
<SplitPane dividerPositions="0.25, 0.7" prefHeight="160.0" prefWidth="200.0">
|
||||
<items>
|
||||
<AnchorPane prefHeight="200.0" prefWidth="200.0">
|
||||
<children>
|
||||
<TreeView fx:id="treeView" prefHeight="200.0" prefWidth="200.0" style="-fx-background-insets: 0;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane prefHeight="200.0" prefWidth="200.0">
|
||||
<children>
|
||||
<TabPane prefHeight="200.0" prefWidth="200.0" tabClosingPolicy="UNAVAILABLE" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<tabs>
|
||||
<Tab text="编码树">
|
||||
<content>
|
||||
<TreeTableView fx:id="treeTableView" prefHeight="200.0" prefWidth="200.0">
|
||||
<columnResizePolicy>
|
||||
<TreeTableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
|
||||
</columnResizePolicy>
|
||||
<columns>
|
||||
<TreeTableColumn fx:id="treeTableCol_Name" minWidth="150.0" prefWidth="185.0" text="码段名称" />
|
||||
<TreeTableColumn fx:id="treeTableCol_Value" minWidth="120.0" prefWidth="49.0" text="码值" />
|
||||
<TreeTableColumn fx:id="treeTableCol_Note" minWidth="80.0" prefWidth="84.0" text="备注" />
|
||||
</columns>
|
||||
</TreeTableView>
|
||||
</content>
|
||||
</Tab>
|
||||
</tabs>
|
||||
</TabPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<GridPane>
|
||||
<children>
|
||||
<Label text="特征码:" />
|
||||
<Label text="特征码长度" GridPane.rowIndex="2" />
|
||||
<Label text="版本:" GridPane.rowIndex="5" />
|
||||
<Label text="名称:" GridPane.rowIndex="7" />
|
||||
<TextField fx:id="tf_FeatureCode" editable="false" GridPane.rowIndex="1" />
|
||||
<TextField fx:id="tf_FeatureCodeLength" editable="false" GridPane.rowIndex="3" />
|
||||
<TextField fx:id="tf_RevisionID" editable="false" GridPane.rowIndex="6" />
|
||||
<TextField fx:id="tf_Name" GridPane.rowIndex="8" />
|
||||
<TabPane prefHeight="200.0" prefWidth="200.0" tabClosingPolicy="UNAVAILABLE" GridPane.rowIndex="11">
|
||||
<tabs>
|
||||
<Tab text="对象属性">
|
||||
<content>
|
||||
<ScrollPane fitToHeight="true" fitToWidth="true" layoutX="-14.0" layoutY="-6.0" prefHeight="200.0" prefWidth="200.0">
|
||||
<content>
|
||||
<GridPane fx:id="gridPane_ObjectProps" hgap="10.0" vgap="10.0">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="NEVER" minWidth="10.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" vgrow="NEVER" />
|
||||
</rowConstraints>
|
||||
<padding>
|
||||
<Insets bottom="8.0" left="8.0" right="8.0" top="8.0" />
|
||||
</padding>
|
||||
</GridPane>
|
||||
</content>
|
||||
</ScrollPane>
|
||||
</content>
|
||||
</Tab>
|
||||
<Tab text="分类属性">
|
||||
<content>
|
||||
<ScrollPane fitToHeight="true" fitToWidth="true" layoutX="-23.0" prefHeight="200.0" prefWidth="200.0">
|
||||
<content>
|
||||
<GridPane fx:id="gridPane_ClassProps" hgap="10.0" vgap="10.0">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="NEVER" minWidth="10.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
<ColumnConstraints hgrow="NEVER" minWidth="10.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" vgrow="NEVER" />
|
||||
</rowConstraints>
|
||||
<padding>
|
||||
<Insets bottom="8.0" left="8.0" right="8.0" top="8.0" />
|
||||
</padding>
|
||||
</GridPane>
|
||||
</content>
|
||||
</ScrollPane>
|
||||
</content>
|
||||
</Tab>
|
||||
</tabs>
|
||||
<GridPane.margin>
|
||||
<Insets bottom="5.0" top="5.0" />
|
||||
</GridPane.margin>
|
||||
</TabPane>
|
||||
<CheckBox fx:id="cb_FeatureCode" mnemonicParsing="false" visible="false" GridPane.rowIndex="4" />
|
||||
<FlowPane alignment="TOP_RIGHT" hgap="10.0" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="12">
|
||||
<children>
|
||||
<Button mnemonicParsing="false" onAction="#createBtnClicked" text=" 新建 " />
|
||||
<Button mnemonicParsing="false" onAction="#cancelBtnClicked" text=" 取消 " />
|
||||
</children>
|
||||
</FlowPane>
|
||||
</children>
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
</columnConstraints>
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" vgrow="NEVER" />
|
||||
<RowConstraints minHeight="10.0" vgrow="NEVER" />
|
||||
<RowConstraints minHeight="10.0" vgrow="NEVER" />
|
||||
<RowConstraints minHeight="10.0" vgrow="NEVER" />
|
||||
<RowConstraints minHeight="0.0" prefHeight="0.0" vgrow="NEVER" />
|
||||
<RowConstraints minHeight="10.0" vgrow="NEVER" />
|
||||
<RowConstraints minHeight="10.0" vgrow="NEVER" />
|
||||
<RowConstraints minHeight="10.0" vgrow="NEVER" />
|
||||
<RowConstraints minHeight="10.0" vgrow="NEVER" />
|
||||
<RowConstraints minHeight="10.0" vgrow="NEVER" />
|
||||
<RowConstraints minHeight="10.0" vgrow="NEVER" />
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="ALWAYS" />
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="NEVER" />
|
||||
</rowConstraints>
|
||||
</GridPane>
|
||||
</items>
|
||||
</SplitPane>
|
||||
<AnchorPane fx:id="cover" prefHeight="200.0" prefWidth="200.0" visible="false">
|
||||
<children>
|
||||
<ProgressIndicator fx:id="progressBar" prefHeight="35.0" prefWidth="35.0" AnchorPane.bottomAnchor="7.0" AnchorPane.leftAnchor="7.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</children>
|
||||
</StackPane>
|
@ -0,0 +1,17 @@
|
||||
package nx_connor.autcocode;
|
||||
|
||||
|
||||
import javafx.stage.Stage;
|
||||
import nx_connor.KFXPanel;
|
||||
|
||||
public class AutoCodeDialog extends KFXPanel {
|
||||
|
||||
public AutoCodeDialog(Stage dialog) throws Exception {
|
||||
super(dialog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getController() {
|
||||
return new AutoCodeDialogController(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package nx_connor.autcocode.bean;
|
||||
|
||||
public abstract class AbstractAutoCodeBean {
|
||||
|
||||
public PackCodeNodeInfo packCodeNodeInfo;
|
||||
public AbstractAutoCodeBean parentTreeData;
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package nx_connor.autcocode.bean;
|
||||
|
||||
public class AutoCodeListBean {
|
||||
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package nx_connor.autcocode.bean;
|
||||
|
||||
import javafx.scene.image.Image;
|
||||
import nx_connor.autcocode.manager.AutoCodeManagerPropertyName;
|
||||
import nx_connor.util.KUtil;
|
||||
|
||||
public class AutoCodeTreeBean extends AbstractAutoCodeBean{
|
||||
|
||||
private Image image;
|
||||
|
||||
public Image getImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
public AutoCodeTreeBean(PackCodeNodeInfo packCodeNodeInfo) {
|
||||
this.packCodeNodeInfo = packCodeNodeInfo;
|
||||
this.image = KUtil.getImageByType(packCodeNodeInfo.getNode_type());
|
||||
if(packCodeNodeInfo.is_lock) {
|
||||
this.image = KUtil.getImageByType(AutoCodeManagerPropertyName.LockName);
|
||||
}
|
||||
}
|
||||
|
||||
public AutoCodeTreeBean(TCComponent tcComponent, String nodeName, String nodeType) throws Exception {
|
||||
this.image = KUtil.getImageByType(nodeType);
|
||||
if ((tcComponent != null)
|
||||
&& (tcComponent.getLogicalProperty(AutoCodeManagerPropertyName.TreeAndListCodeNode_is_lock))) {
|
||||
this.image = KUtil.getImageByType(AutoCodeManagerPropertyName.LockName);
|
||||
}
|
||||
this.packCodeNodeInfo = new PackCodeNodeInfo();
|
||||
packCodeNodeInfo.setNode_name(nodeName);
|
||||
packCodeNodeInfo.setNodeComponent(tcComponent);
|
||||
packCodeNodeInfo.setNode_type(nodeType);
|
||||
}
|
||||
|
||||
public AutoCodeTreeBean(TCComponent tccomponent, String displayTypeName, String realTypeName,
|
||||
String node_type) {
|
||||
this.image = KUtil.getImageByType(AutoCodeManagerPropertyName.ComponentName);
|
||||
PackCodeNodeInfo packCodeNodeInfo = new PackCodeNodeInfo();
|
||||
packCodeNodeInfo.setNode_name(displayTypeName);
|
||||
packCodeNodeInfo.setRealTypeName(realTypeName);
|
||||
packCodeNodeInfo.setNodeComponent(tccomponent);
|
||||
packCodeNodeInfo.setNode_type(node_type);
|
||||
this.packCodeNodeInfo = packCodeNodeInfo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return packCodeNodeInfo == null ? "null"
|
||||
: packCodeNodeInfo.getNode_name() + (KUtil.isEmpty(packCodeNodeInfo.getRealTypeName()) ? ""
|
||||
: (" (" + packCodeNodeInfo.getRealTypeName() + ")"));
|
||||
}
|
||||
|
||||
public void setParentTreeData(AutoCodeTreeBean parentTreeData) {
|
||||
this.parentTreeData = parentTreeData;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package nx_connor.autcocode.bean;
|
||||
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.property.StringProperty;
|
||||
import javafx.scene.image.Image;
|
||||
import nx_connor.autcocode.manager.AutoCodeManagerPropertyName;
|
||||
import nx_connor.util.KUtil;
|
||||
|
||||
public class AutoCodeTreeTableBean extends AbstractAutoCodeBean{
|
||||
|
||||
public StringProperty name = new SimpleStringProperty("1");
|
||||
public StringProperty value = new SimpleStringProperty("2");
|
||||
public StringProperty note = new SimpleStringProperty("3");
|
||||
private Image image;
|
||||
|
||||
public Image getImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
public AutoCodeTreeTableBean(String name, String value, String note) {
|
||||
super();
|
||||
this.name.setValue(name);
|
||||
this.value.setValue(value);
|
||||
this.note.setValue(note);
|
||||
}
|
||||
|
||||
public AutoCodeTreeTableBean(AbstractAutoCodeBean segmentNode, PackCodeNodeInfo packCodeNodeInfo) {
|
||||
this.packCodeNodeInfo = packCodeNodeInfo;
|
||||
this.parentTreeData = segmentNode;
|
||||
this.image = KUtil.getImageByType(packCodeNodeInfo.getNode_type());
|
||||
if (packCodeNodeInfo.is_lock) {
|
||||
this.image = KUtil.getImageByType(AutoCodeManagerPropertyName.LockName);
|
||||
}
|
||||
this.name.setValue(packCodeNodeInfo.getNode_name());
|
||||
this.value.setValue(packCodeNodeInfo.getNode_value());
|
||||
this.note.setValue(packCodeNodeInfo.getNode_desc());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package nx_connor.autcocode.bean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class CNClassPropBean {
|
||||
// ICSFormate
|
||||
public int propID;
|
||||
public String propDisName;
|
||||
public String relValue;
|
||||
public String displayValue;
|
||||
|
||||
public int attrType;
|
||||
public boolean isLov;
|
||||
public HashMap<String, String> lovMapping;
|
||||
public List<String> keyList;
|
||||
public int intsize = 0;
|
||||
public int floatsize = 0;
|
||||
public String formate;
|
||||
|
||||
public CNClassPropBean(ICSAdminClassAttribute icsAttr) throws Exception{
|
||||
this.propID = icsAttr.getAttributeId();
|
||||
this.propDisName = icsAttr.getName();
|
||||
ICSFormat format1 = icsAttr.getFormat1();
|
||||
ICSFormat format2 = icsAttr.getFormat2();
|
||||
this.formate = format2.getDisplayString();
|
||||
if (format1.isReal()) {
|
||||
floatsize = format2.getFlagB();
|
||||
intsize = format2.getFlagC();
|
||||
}
|
||||
|
||||
this.attrType = format1.getType();
|
||||
ICSKeyLov lov1 = format1.getKeyLov();
|
||||
|
||||
lov1 = (lov1 == null ? format2.getKeyLov() : lov1);
|
||||
lovMapping = new HashMap<>();
|
||||
keyList = new ArrayList<>();
|
||||
if (lov1 != null) {
|
||||
this.isLov = true;
|
||||
String[] keys = lov1.getKeys();
|
||||
for (String key : keys) {
|
||||
String value = lov1.getValueOfKey(key);
|
||||
lovMapping.put(value, key);
|
||||
keyList.add(value);
|
||||
}
|
||||
} else {
|
||||
this.isLov = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return propDisName + ":";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package nx_connor.autcocode.bean;
|
||||
public class ClassProperty {
|
||||
private int propertyID;
|
||||
private String value;
|
||||
|
||||
public ClassProperty() {
|
||||
|
||||
}
|
||||
|
||||
public ClassProperty(int propertyID, String value) {
|
||||
this.propertyID = propertyID;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getPropertyID() {
|
||||
return propertyID;
|
||||
}
|
||||
|
||||
public void setPropertyID(int propertyID) {
|
||||
this.propertyID = propertyID;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package nx_connor.autcocode.bean;
|
||||
|
||||
import nx_connor.KMain;
|
||||
import nx_connor.util.KUtil;
|
||||
|
||||
public class ICSAdminClassAttribute {
|
||||
|
||||
public int propID;
|
||||
|
||||
public ICSAdminClassAttribute(int propID) {
|
||||
super();
|
||||
this.propID = propID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (obj != null && (obj instanceof ICSAdminClassAttribute)) {
|
||||
return propID == ((ICSAdminClassAttribute) obj).propID;
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
public boolean isReferenceAttribute() throws Exception {
|
||||
return "ÐͺŹæ¸ñ".equals(getName());
|
||||
// String resp = KUtil.callITK(KMain.INPUTCODE_ICS_ATTR_IS_REFERENCE_ATTRIBUTE, propID + "");
|
||||
// return "true".equalsIgnoreCase(resp);
|
||||
}
|
||||
|
||||
public int getAttributeId() {
|
||||
return propID;
|
||||
}
|
||||
|
||||
public String getName() throws Exception {
|
||||
return KUtil.callITK(KMain.INPUTCODE_ICS_ATTR_ASK_PROPERTY, propID + KMain.SPLITTER + "NAME");
|
||||
}
|
||||
|
||||
public String getMetricUnit(String classId) throws Exception {
|
||||
return KUtil.callITK(KMain.INPUTCODE_ICS_ATTR_ASK_METRIC_UNIT, classId + KMain.SPLITTER + propID);
|
||||
}
|
||||
|
||||
public ICSFormat getFormat1() throws Exception {
|
||||
return new ICSFormat(KUtil.callITK(KMain.INPUTCODE_ICS_ATTR_ASK_PROPERTY, propID + KMain.SPLITTER + "FORMAT1"));
|
||||
}
|
||||
|
||||
public ICSFormat getFormat2() throws Exception {
|
||||
return new ICSFormat(KUtil.callITK(KMain.INPUTCODE_ICS_ATTR_ASK_PROPERTY, propID + KMain.SPLITTER + "FORMAT2"));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,153 @@
|
||||
package nx_connor.autcocode.bean;
|
||||
|
||||
public class ICSFormat {
|
||||
private int m_format;
|
||||
private ICSKeyLov m_lov;
|
||||
private int m_formatType = -99;
|
||||
|
||||
public static final int UNDEFINED = -99;
|
||||
public static final int LIST = -1;
|
||||
public static final int STRING = 0;
|
||||
public static final int INTEGER = 1;
|
||||
public static final int REAL = 2;
|
||||
public static final int DATE = 3;
|
||||
public static final int TIMERANGE = 4;
|
||||
public static final int SEARCH = 1;
|
||||
public static final int STORE = 2;
|
||||
public static final int READ = 3;
|
||||
public static final int SEARCH_READ = 4;
|
||||
public static final int MIN_DATE_FORMAT = 30000;
|
||||
public static final int MAX_DATE_FORMAT = 30014;
|
||||
|
||||
public ICSFormat(String var1) throws Exception {
|
||||
this.m_format = Integer.parseInt(var1);
|
||||
if (this.m_format < 0) {
|
||||
this.m_lov = ICSKeyLov.getICSKeyLov(this.m_format);
|
||||
// if (this.m_lov == null) {
|
||||
// this.m_lov = new ICSKeyLov();
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
public ICSKeyLov getKeyLov() {
|
||||
return this.m_lov;
|
||||
}
|
||||
|
||||
public boolean isString() {
|
||||
return this.m_format > 0 && this.m_format / 10000 == 0;
|
||||
}
|
||||
|
||||
public boolean isInteger() {
|
||||
return this.m_format > 0 && this.m_format / 10000 == 1;
|
||||
}
|
||||
|
||||
public boolean isDate() {
|
||||
return this.m_format > 0 && this.m_format / 10000 == 3;
|
||||
}
|
||||
|
||||
public boolean isTimeRange() {
|
||||
return this.m_format > 0 && this.m_format / 10000 == 4;
|
||||
}
|
||||
|
||||
public boolean isList() {
|
||||
return this.m_format < 0;
|
||||
}
|
||||
|
||||
|
||||
public boolean isReal() {
|
||||
return this.m_format > 0 && this.m_format / 10000 == 2;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
if (this.isList()) {
|
||||
this.m_formatType = -1;
|
||||
} else if (this.isString()) {
|
||||
this.m_formatType = 0;
|
||||
} else if (this.isInteger()) {
|
||||
this.m_formatType = 1;
|
||||
} else if (this.isReal()) {
|
||||
this.m_formatType = 2;
|
||||
} else if (this.isDate()) {
|
||||
this.m_formatType = 3;
|
||||
} else if (this.isTimeRange()) {
|
||||
this.m_formatType = 4;
|
||||
} else {
|
||||
this.m_formatType = -99;
|
||||
}
|
||||
|
||||
return this.m_formatType;
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return this.m_format < 0 ? 30 : this.m_format % 100;
|
||||
}
|
||||
|
||||
public int getFlagA() {
|
||||
return this.m_format < 0 ? 0 : this.m_format % 10000 / 1000;
|
||||
}
|
||||
|
||||
public int getFlagB() {
|
||||
return this.m_format < 0 ? 0 : this.m_format % 1000 / 100;
|
||||
}
|
||||
|
||||
public int getFlagC() {
|
||||
if (this.m_format < 0) {
|
||||
return 0;
|
||||
} else {
|
||||
byte var1 = 0;
|
||||
byte var2 = 0;
|
||||
if (this.getFlagA() > 0) {
|
||||
var1 = 1;
|
||||
}
|
||||
|
||||
if (this.m_formatType == 2) {
|
||||
var2 = 1;
|
||||
}
|
||||
|
||||
return this.getSize() - this.getFlagB() - var1 - var2;
|
||||
}
|
||||
}
|
||||
|
||||
public String getDisplayString() {
|
||||
if (this.m_format < 0) {
|
||||
this.m_formatType = -1;
|
||||
return "POPUP(" + this.m_format + ")";
|
||||
} else if (this.m_format == 0) {
|
||||
return "";
|
||||
} else {
|
||||
int var1;
|
||||
if (this.m_format > 0 && this.m_format < 10000) {
|
||||
var1 = this.getSize();
|
||||
this.m_formatType = 0;
|
||||
if (var1 == 99) {
|
||||
var1 = 256;
|
||||
}
|
||||
|
||||
return "STRING(" + var1 + ")";
|
||||
} else if (this.m_format >= 10000 && this.m_format < 20000) {
|
||||
this.m_formatType = 1;
|
||||
var1 = this.getSize();
|
||||
if (this.getFlagA() > 0) {
|
||||
--var1;
|
||||
}
|
||||
|
||||
return "INTEGER(" + var1 + ")";
|
||||
} else if (this.m_format >= 20000 && this.m_format < 30000) {
|
||||
this.m_formatType = 2;
|
||||
var1 = this.getFlagB();
|
||||
int var2 = this.getFlagC();
|
||||
return "REAL(" + var2 + "." + var1 + ")";
|
||||
} else if (this.m_format >= 30000 && this.m_format < 40000) {
|
||||
this.m_formatType = 3;
|
||||
var1 = this.getSize();
|
||||
return "DATE(" + var1 + ")";
|
||||
} else if (this.m_format >= 40000) {
|
||||
this.m_formatType = 4;
|
||||
var1 = this.getSize();
|
||||
return "TIME RANGE(" + var1 + ")";
|
||||
} else {
|
||||
return "Invalid Format";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package nx_connor.autcocode.bean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nx_connor.KMain;
|
||||
import nx_connor.util.KUtil;
|
||||
|
||||
public class ICSKeyLov {
|
||||
|
||||
public String[] keys;
|
||||
public String[] values;
|
||||
|
||||
|
||||
public ICSKeyLov(String[] keys, String[] values) {
|
||||
this.keys = keys;
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
public static ICSKeyLov getICSKeyLov(int m_format) throws Exception{
|
||||
String keylovStr = KUtil.callITK(KMain.INPUTCODE_ICS_ATTR_ASK_KEYLOV, ""+m_format);
|
||||
if(KUtil.isEmpty(keylovStr)) {
|
||||
return null;
|
||||
}
|
||||
String[] split = keylovStr.split(KMain.SPLITTER);
|
||||
int len = KUtil.getLen(split);
|
||||
List<String> k = new ArrayList<String>();
|
||||
List<String> v = new ArrayList<String>();
|
||||
for(int i=0;i<len;i++) {
|
||||
String[] ss = split[i].split("=");
|
||||
if(KUtil.getLen(ss)!=2) {
|
||||
continue;
|
||||
}
|
||||
String key = ss[0];
|
||||
String value = ss[1];
|
||||
if(!KUtil.isEmpty(key)&&!k.contains(key)) {
|
||||
k.add(key);
|
||||
v.add(value);
|
||||
}
|
||||
}
|
||||
return new ICSKeyLov(k.toArray(new String[] {}), v.toArray(new String[] {}));
|
||||
}
|
||||
|
||||
public String[] getKeys() {
|
||||
return this.keys;
|
||||
}
|
||||
|
||||
|
||||
public String[] getValues() {
|
||||
return this.values;
|
||||
}
|
||||
|
||||
public String getValueOfKey(String key) {
|
||||
int len = KUtil.getLen(keys);
|
||||
for(int i=0;i<len;i++){
|
||||
if(keys[i].equals(key)) {
|
||||
return values[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
package nx_connor.autcocode.bean;
|
||||
|
||||
|
||||
public class PackCodeNodeInfo {
|
||||
private TCComponent nodeComponent;
|
||||
private String realTypeName;
|
||||
|
||||
private String node_name = "";
|
||||
private String node_type = "";
|
||||
public String node_value = "";
|
||||
public String node_desc = "";
|
||||
public String code_style = "";
|
||||
public String rule_node = "";
|
||||
// boolean
|
||||
public boolean is_root=false;
|
||||
public boolean is_lock=false;
|
||||
public boolean isDefaultSelected=false;
|
||||
public boolean isContainsChildren=false;
|
||||
// date
|
||||
public String create_date = "";
|
||||
public String last_revise_date = "";
|
||||
// user
|
||||
public String create_user = "";
|
||||
public String last_revise_user = "";
|
||||
public TCComponent getNodeComponent() {
|
||||
return nodeComponent;
|
||||
}
|
||||
public void setNodeComponent(TCComponent nodeComponent) {
|
||||
this.nodeComponent = nodeComponent;
|
||||
}
|
||||
public String getRealTypeName() {
|
||||
return realTypeName;
|
||||
}
|
||||
public void setRealTypeName(String realTypeName) {
|
||||
this.realTypeName = realTypeName;
|
||||
}
|
||||
public String getNode_name() {
|
||||
return node_name;
|
||||
}
|
||||
public void setNode_name(String node_name) {
|
||||
this.node_name = node_name;
|
||||
}
|
||||
public String getNode_type() {
|
||||
return node_type;
|
||||
}
|
||||
public void setNode_type(String node_type) {
|
||||
this.node_type = node_type;
|
||||
}
|
||||
public String getNode_value() {
|
||||
return node_value;
|
||||
}
|
||||
public void setNode_value(String node_value) {
|
||||
this.node_value = node_value;
|
||||
}
|
||||
public String getNode_desc() {
|
||||
return node_desc;
|
||||
}
|
||||
public void setNode_desc(String node_desc) {
|
||||
this.node_desc = node_desc;
|
||||
}
|
||||
public String getCode_style() {
|
||||
return code_style;
|
||||
}
|
||||
public void setCode_style(String code_style) {
|
||||
this.code_style = code_style;
|
||||
}
|
||||
public String getRule_node() {
|
||||
return rule_node;
|
||||
}
|
||||
public void setRule_node(String rule_node) {
|
||||
this.rule_node = rule_node;
|
||||
}
|
||||
public boolean isIs_root() {
|
||||
return is_root;
|
||||
}
|
||||
public void setIs_root(boolean is_root) {
|
||||
this.is_root = is_root;
|
||||
}
|
||||
public boolean isIs_lock() {
|
||||
return is_lock;
|
||||
}
|
||||
public void setIs_lock(boolean is_lock) {
|
||||
this.is_lock = is_lock;
|
||||
}
|
||||
public boolean isDefaultSelected() {
|
||||
return isDefaultSelected;
|
||||
}
|
||||
public void setDefaultSelected(boolean isDefaultSelected) {
|
||||
this.isDefaultSelected = isDefaultSelected;
|
||||
}
|
||||
public boolean isContainsChildren() {
|
||||
return isContainsChildren;
|
||||
}
|
||||
public void setContainsChildren(boolean isContainsChildren) {
|
||||
this.isContainsChildren = isContainsChildren;
|
||||
}
|
||||
public String getCreate_date() {
|
||||
return create_date;
|
||||
}
|
||||
public void setCreate_date(String create_date) {
|
||||
this.create_date = create_date;
|
||||
}
|
||||
public String getLast_revise_date() {
|
||||
return last_revise_date;
|
||||
}
|
||||
public void setLast_revise_date(String last_revise_date) {
|
||||
this.last_revise_date = last_revise_date;
|
||||
}
|
||||
public String getCreate_user() {
|
||||
return create_user;
|
||||
}
|
||||
public void setCreate_user(String create_user) {
|
||||
this.create_user = create_user;
|
||||
}
|
||||
public String getLast_revise_user() {
|
||||
return last_revise_user;
|
||||
}
|
||||
public void setLast_revise_user(String last_revise_user) {
|
||||
this.last_revise_user = last_revise_user;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
package nx_connor.autcocode.bean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nx_connor.KMain;
|
||||
import nx_connor.util.KUtil;
|
||||
|
||||
public class TCComponent {
|
||||
|
||||
public String uid;
|
||||
private String objectString;
|
||||
public TCComponent(String uid) {
|
||||
super();
|
||||
this.uid = uid;
|
||||
this.objectString = uid;
|
||||
}
|
||||
|
||||
public boolean getLogicalProperty(String propName) throws Exception {
|
||||
if (KUtil.isEmpty(propName) || KUtil.isEmpty(uid)) {
|
||||
return false;
|
||||
}
|
||||
return "true".equalsIgnoreCase(
|
||||
KUtil.callITK(KMain.INPUTCODE_GET_LOGICAL_PROP_VALUE, uid + KMain.SPLITTER + propName));
|
||||
}
|
||||
|
||||
public void setObjectString(String objectString) {
|
||||
this.objectString = objectString;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return objectString;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public int compareTo(TCComponent o) {
|
||||
// if(o==null) {
|
||||
// return 1;
|
||||
// }
|
||||
// return uid.compareTo(o.uid);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (obj != null && (obj instanceof TCComponent)) {
|
||||
if (uid == null) {
|
||||
return ((TCComponent) obj).uid == null;
|
||||
} else {
|
||||
return uid.equals(((TCComponent) obj).uid);
|
||||
}
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
public String getProperty(String propName) throws Exception {
|
||||
if(KUtil.isEmpty(propName)) {
|
||||
return "";
|
||||
}
|
||||
return KUtil.callITK(KMain.INPUTCODE_GET_DISPLAY_PROP_VALUE, uid + KMain.SPLITTER + propName);
|
||||
}
|
||||
|
||||
public String[] getProperties(String[] propNames) throws Exception {
|
||||
int len = KUtil.getLen(propNames);
|
||||
String[] values = new String[len];
|
||||
for (int i = 0; i < len; i++) {
|
||||
values[i] = KUtil.callITK(KMain.INPUTCODE_GET_DISPLAY_PROP_VALUE, uid + KMain.SPLITTER + propNames[i]);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
public TCComponent getReferenceProperty(String propName) throws Exception {
|
||||
String uid = KUtil.callITK(KMain.INPUTCODE_GET_REFERENCE_PROP_VALUE, this.uid + KMain.SPLITTER + propName);
|
||||
if (!KUtil.isEmpty(uid)) {
|
||||
return new TCComponent(uid);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<TCComponent> getReferenceListProperty(String propName) throws Exception {
|
||||
String resp = KUtil.callITK(KMain.INPUTCODE_GET_REFERENCE_PROP_VALUE_ARRAY, this.uid + KMain.SPLITTER + propName);
|
||||
String[] uids = KUtil.isEmpty(resp)?null:resp.split(KMain.SPLITTER);
|
||||
int uidCnt = KUtil.getLen(uids);
|
||||
List<TCComponent> res = new ArrayList<TCComponent>();
|
||||
for(int i=0; i<uidCnt; i++) {
|
||||
String uid = uids[i];
|
||||
if(!KUtil.isEmpty(uid)) {
|
||||
res.add(new TCComponent(uid));
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public TCComponent getLatestItemRevision() throws Exception {
|
||||
String uid = KUtil.callITK(KMain.INPUTCODE_GET_LATEST_ITEM_REVISION, this.uid);
|
||||
if (!KUtil.isEmpty(uid)) {
|
||||
return new TCComponent(uid);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package nx_connor.autcocode.bean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nx_connor.KMain;
|
||||
import nx_connor.util.KUtil;
|
||||
|
||||
public class TCComponentListOfValues {
|
||||
|
||||
public String[] realValues;
|
||||
public String[] displayValues;
|
||||
|
||||
public TCComponentListOfValues(String[] realValues, String[] displayValues) {
|
||||
this.realValues = realValues;
|
||||
this.displayValues = displayValues;
|
||||
}
|
||||
|
||||
public static TCComponentListOfValues findLOVByName(String lovName) throws Exception{
|
||||
String str = KUtil.callITK(KMain.INPUTCODE_FIND_LOV_BY_NAME, lovName);
|
||||
if(KUtil.isEmpty(str)) {
|
||||
return null;
|
||||
}
|
||||
List<String> realValues = new ArrayList<String>();
|
||||
List<String> displayValues = new ArrayList<String>();
|
||||
String[] split = str.split(KMain.SPLITTER);
|
||||
int len = KUtil.getLen(split);
|
||||
for(int i=0;i<len;i++) {
|
||||
String s = split[i];
|
||||
int ind = s.indexOf('=');
|
||||
if(ind<1) {
|
||||
continue;
|
||||
}
|
||||
String realValue = s.substring(0, ind);
|
||||
String displayValue = s.substring(ind+1);
|
||||
if(!realValues.contains(realValue)) {
|
||||
realValues.add(realValue);
|
||||
displayValues.add(displayValue);
|
||||
}
|
||||
}
|
||||
if(realValues.size()>0) {
|
||||
return new TCComponentListOfValues(realValues.toArray(new String[] {}), displayValues.toArray(new String[] {}));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package nx_connor.autcocode.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import nx_connor.KMain;
|
||||
import nx_connor.autcocode.xmlutil.CNCompontent;
|
||||
import nx_connor.autcocode.xmlutil.CNPart;
|
||||
import nx_connor.autcocode.xmlutil.CNPartList;
|
||||
import nx_connor.autcocode.xmlutil.CNProperty;
|
||||
import nx_connor.autcocode.xmlutil.CNXmlUtil;
|
||||
import nx_connor.util.KUtil;
|
||||
|
||||
public class AutoCodeConfigController {
|
||||
|
||||
public static final String PREF_CNPARTLIST = "Autocode_OptionFile_option"; // QKa9EIUaZUQMmD
|
||||
public static final String PREF_SEQUENCEMAP = "LP_sequenceMapping";
|
||||
public CNPartList cnPartList;
|
||||
public HashMap<String, Integer> connor_SequenceNameMapping = new HashMap<String, Integer>();
|
||||
public List<String> connor_PatterValueList = new ArrayList<String>();
|
||||
|
||||
public AutoCodeConfigController() {
|
||||
readConfigs();
|
||||
}
|
||||
|
||||
protected void readConfigs() {
|
||||
// readSequenceMap();
|
||||
readCNPartList();
|
||||
}
|
||||
|
||||
protected void readSequenceMap() {
|
||||
KUtil.LOG("LOAD SEQUENCE MAP");
|
||||
try {
|
||||
String prefValStr = KUtil.callITK(KMain.INPUTCODE_GetPrefValue, PREF_SEQUENCEMAP);
|
||||
if (KUtil.isEmpty(prefValStr)) {
|
||||
return;
|
||||
}
|
||||
String[] patternNames = prefValStr.split(KMain.SPLITTER);
|
||||
int len = patternNames.length;
|
||||
for (int i = 0; i < len; i++) {
|
||||
String patternNameString = patternNames[i];
|
||||
System.out.println(">> " + patternNameString);
|
||||
String[] patterNamesStrings = patternNameString.split("@");
|
||||
if (patterNamesStrings != null && patterNamesStrings.length == 2) {
|
||||
Integer index = 1;
|
||||
try {
|
||||
index = Integer.parseInt(patterNamesStrings[1]);
|
||||
this.connor_SequenceNameMapping.put(patterNamesStrings[0], index);
|
||||
} catch (Exception var15) {
|
||||
var15.printStackTrace();
|
||||
KUtil.LOGERROR(var15);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
KUtil.LOGERROR(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void readCNPartList() {
|
||||
KUtil.LOG("LOAD CNPARTLIST");
|
||||
try {
|
||||
String puid = KUtil.callITK(KMain.INPUTCODE_GetPrefValue, PREF_CNPARTLIST);
|
||||
if (KUtil.isEmpty(puid)) {
|
||||
return;
|
||||
}
|
||||
String filePath = KUtil.dowloadFileByUID(puid, "XMLRendering", "xml");
|
||||
// String filePath = KUtil.callITK(KMain.INPUTCODE_Download_Dataset_By_UID,
|
||||
// puid + KMain.SPLITTER + "XMLRendering" + KMain.SPLITTER + "xml");
|
||||
this.cnPartList = (CNPartList) CNXmlUtil.xmlToBean(filePath, CNPartList.class);
|
||||
List<CNPart> partList = cnPartList.getPartList();
|
||||
for (int i = 0; i < partList.size(); i++) {
|
||||
KUtil.LOG(partList.get(i).getType());
|
||||
for (CNCompontent comp : partList.get(i).getCompontentList()) {
|
||||
KUtil.LOG(comp.getType() + " - " + comp.getCompententType());
|
||||
for (CNProperty prop : comp.getPropertyList()) {
|
||||
KUtil.LOG(">> " + prop.getDisplayName());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
KUtil.LOGERROR(e);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package nx_connor.autcocode.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import nx_connor.KMain;
|
||||
import nx_connor.autcocode.AutoCodeDialogController;
|
||||
import nx_connor.autcocode.bean.AutoCodeTreeBean;
|
||||
import nx_connor.autcocode.bean.TCComponent;
|
||||
import nx_connor.autcocode.manager.AutoCodeManagerPropertyName;
|
||||
import nx_connor.util.KUtil;
|
||||
|
||||
public class AutoCodeItemTypeController {
|
||||
|
||||
protected AutoCodeDialogController dialogController;
|
||||
|
||||
public AutoCodeItemTypeController(AutoCodeDialogController autoCodeDialogController) {
|
||||
this.dialogController = autoCodeDialogController;
|
||||
}
|
||||
|
||||
public List<AutoCodeTreeBean> getAllTypes(String[] typeNames, String[] excludeTypeNames) throws Exception {
|
||||
List<AutoCodeTreeBean> res = new ArrayList<AutoCodeTreeBean>();
|
||||
int len = typeNames == null ? 0 : typeNames.length;
|
||||
List<String> addedTypes = new ArrayList<String>();
|
||||
for (int i = 0; i < len; i++) {
|
||||
String typeName = typeNames[i];
|
||||
if (KUtil.isEmpty(typeName)) {
|
||||
continue;
|
||||
}
|
||||
StringBuilder input = new StringBuilder();
|
||||
input.append(typeName);
|
||||
int excludeCnt = excludeTypeNames == null ? 0 : excludeTypeNames.length;
|
||||
// for (int j = 0; j < excludeCnt; j++) {
|
||||
// input.append(KMain.SPLITTER).append(excludeTypeNames[j]);
|
||||
// }
|
||||
String output = KUtil.callITK(KMain.INPUTCODE_GET_ALL_SUB_TYPES, input.toString());
|
||||
if (KUtil.isEmpty(output)) {
|
||||
continue;
|
||||
}
|
||||
String[] split = output.split(KMain.SPLITTER);
|
||||
int cnt = split.length;
|
||||
for (int j = 0; j < cnt; j++) {
|
||||
String[] typeNameSplit = split[j].split("=");
|
||||
if (typeNameSplit.length != 2) {
|
||||
continue;
|
||||
}
|
||||
String name = typeNameSplit[0];
|
||||
if (addedTypes.contains(name) || name.contains("0")) { // Fnd0 Mfg0
|
||||
continue;
|
||||
}
|
||||
addedTypes.add(name);
|
||||
String disName = typeNameSplit[1];
|
||||
AutoCodeTreeBean bean = new AutoCodeTreeBean(null, disName, name, AutoCodeManagerPropertyName.ItemName);
|
||||
TCComponent[] comps = searchAutoCodeNode(bean);
|
||||
if (comps != null && comps.length > 0) {
|
||||
res.add(bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public TCComponent[] searchAutoCodeSegment(AutoCodeTreeBean bean) throws Exception {
|
||||
HashMap<String, String> map = new HashMap<String, String>();
|
||||
String nodeName = bean.packCodeNodeInfo.getNode_name();
|
||||
map.put(AutoCodeManagerPropertyName.ClassificationCodeNode_node_name, nodeName);
|
||||
return KUtil.searchComponentFromITK(KMain.INPUTCODE_SEARCH_AUTOCODE_SEGMENT, map);
|
||||
}
|
||||
|
||||
public TCComponent[] searchAutoCodeNode(AutoCodeTreeBean bean) throws Exception {
|
||||
HashMap<String, String> map = new HashMap<String, String>();
|
||||
String nodeName = bean.packCodeNodeInfo.getNode_name();
|
||||
map.put(AutoCodeManagerPropertyName.ClassificationCodeNode_node_name, nodeName);
|
||||
map.put(AutoCodeManagerPropertyName.ClassificationCodeNode_grant_groups, dialogController.groupUid);
|
||||
map.put(AutoCodeManagerPropertyName.ClassificationCodeNode_grant_roles, dialogController.roleUid);
|
||||
map.put(AutoCodeManagerPropertyName.ClassificationCodeNode_grant_users, dialogController.userUid);
|
||||
return KUtil.searchComponentFromITK(KMain.INPUTCODE_SEARCH_AUTOCODE_NODE, map);
|
||||
}
|
||||
}
|
@ -0,0 +1,380 @@
|
||||
package nx_connor.autcocode.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.scene.control.TreeItem;
|
||||
import javafx.scene.control.TreeTableView;
|
||||
import javafx.scene.image.ImageView;
|
||||
import nx_connor.KMain;
|
||||
import nx_connor.autcocode.AutoCodeDialogController;
|
||||
import nx_connor.autcocode.bean.AbstractAutoCodeBean;
|
||||
import nx_connor.autcocode.bean.AutoCodeTreeBean;
|
||||
import nx_connor.autcocode.bean.AutoCodeTreeTableBean;
|
||||
import nx_connor.autcocode.bean.PackCodeNodeInfo;
|
||||
import nx_connor.autcocode.bean.TCComponent;
|
||||
import nx_connor.autcocode.manager.AutoCodeManagerPropertyName;
|
||||
import nx_connor.util.KUtil;
|
||||
|
||||
public class AutoCodeTreeTableViewController {
|
||||
|
||||
private AutoCodeDialogController dialogController;
|
||||
protected String showItemType = "";
|
||||
protected boolean isFilterType = false;
|
||||
protected TreeTableView<AutoCodeTreeTableBean> treeTableView;
|
||||
|
||||
public AutoCodeTreeTableViewController(AutoCodeDialogController autoCodeDialogController) throws Exception {
|
||||
this.dialogController = autoCodeDialogController;
|
||||
this.treeTableView = dialogController.treeTableView;
|
||||
initTree();
|
||||
}
|
||||
|
||||
protected void initTree() throws Exception {
|
||||
Platform.runLater(() -> {
|
||||
AutoCodeTreeTableBean rootBean = new AutoCodeTreeTableBean("root", "", "");
|
||||
TreeItem<AutoCodeTreeTableBean> root;
|
||||
dialogController.treeTableView.setRoot(root = getTreeItem(rootBean, false));
|
||||
dialogController.treeTableView.setShowRoot(false);
|
||||
root.setExpanded(true);
|
||||
});
|
||||
// 选择监听
|
||||
dialogController.treeTableView.getSelectionModel().selectedItemProperty()
|
||||
.addListener(new ChangeListener<TreeItem<AutoCodeTreeTableBean>>() {
|
||||
@Override
|
||||
public void changed(ObservableValue<? extends TreeItem<AutoCodeTreeTableBean>> arg0,
|
||||
TreeItem<AutoCodeTreeTableBean> arg1, TreeItem<AutoCodeTreeTableBean> newValue) {
|
||||
if (newValue == null) {
|
||||
return;
|
||||
}
|
||||
new Thread(() -> {
|
||||
dialogController.setProgressVisible(true);
|
||||
try {
|
||||
dialogController.showAutoCodeProp(newValue);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
dialogController.Err(e);
|
||||
}
|
||||
dialogController.setProgressVisible(false);
|
||||
}).start();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public TreeItem<AutoCodeTreeTableBean> getTreeItem(AutoCodeTreeTableBean child, boolean needExpand) {
|
||||
ImageView image = child.getImage() == null ? null : new ImageView(child.getImage());
|
||||
TreeItem<AutoCodeTreeTableBean> treeItem = new TreeItem<AutoCodeTreeTableBean>(child, image);
|
||||
if (!needExpand) {
|
||||
return treeItem;
|
||||
}
|
||||
treeItem.expandedProperty().addListener(new ChangeListener<Boolean>() {
|
||||
@Override
|
||||
public void changed(ObservableValue<? extends Boolean> arg0, Boolean oldValue, Boolean newValue) {
|
||||
if (!newValue) {
|
||||
return;
|
||||
}
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
expandNode(treeItem);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
dialogController.Err(e);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
});
|
||||
treeItem.getChildren().add(new TreeItem<AutoCodeTreeTableBean>(null));
|
||||
return treeItem;
|
||||
}
|
||||
|
||||
protected void expandNode(TreeItem<AutoCodeTreeTableBean> treeItem) throws Exception {
|
||||
KUtil.LOG("展开节点:" + treeItem);
|
||||
if (treeItem == null) {
|
||||
return;
|
||||
}
|
||||
if(treeItem.getChildren().size()!=1||treeItem.getChildren().get(0).getValue()!=null) {
|
||||
return;
|
||||
}
|
||||
treeItem.getChildren().clear();
|
||||
AbstractAutoCodeBean segmentNode = treeItem.getValue();
|
||||
if (segmentNode == null) {
|
||||
return;
|
||||
}
|
||||
TCComponent autoCodeDataComponent = segmentNode.packCodeNodeInfo.getNodeComponent();
|
||||
HashMap<String, String> hashMap = new HashMap<String, String>();
|
||||
String parentStr = "";
|
||||
parentStr = getParentStr(segmentNode, parentStr);
|
||||
if (autoCodeDataComponent != null) {
|
||||
hashMap.put(AutoCodeManagerPropertyName.CodeRelation_current_node, autoCodeDataComponent.uid);
|
||||
hashMap.put(AutoCodeManagerPropertyName.CodeRelation_parent_node, parentStr);
|
||||
} else {
|
||||
hashMap.put(AutoCodeManagerPropertyName.CodeRelation_parent_node, "");
|
||||
hashMap.put(AutoCodeManagerPropertyName.CodeRelation_current_node, "");
|
||||
}
|
||||
String parentStr2 = "";
|
||||
if (autoCodeDataComponent != null) {
|
||||
if (parentStr.trim().length() == 0) {
|
||||
parentStr2 = autoCodeDataComponent.uid;
|
||||
} else {
|
||||
parentStr2 = parentStr + "," + autoCodeDataComponent.uid;
|
||||
}
|
||||
} else {
|
||||
parentStr2 = parentStr;
|
||||
}
|
||||
List<PackCodeNodeInfo> packCodeNodeInfos = searchTreeORListNodeInfos(hashMap, parentStr2,
|
||||
AutoCodeManagerPropertyName.searchTreeAndListCodeNodePropNames);
|
||||
int nodeCnt = packCodeNodeInfos == null ? 0 : packCodeNodeInfos.size();
|
||||
String realTypeName = segmentNode.packCodeNodeInfo.getRealTypeName();
|
||||
KUtil.LOG("找到节点数量:" + nodeCnt);
|
||||
for (int i = 0; i < nodeCnt; i++) {
|
||||
PackCodeNodeInfo packCodeNodeInfo = packCodeNodeInfos.get(i);
|
||||
packCodeNodeInfo.setRealTypeName(realTypeName);
|
||||
KUtil.LOG(">> " + packCodeNodeInfo.getNode_name());
|
||||
Platform.runLater(() -> {
|
||||
AutoCodeTreeTableBean bean = new AutoCodeTreeTableBean(segmentNode, packCodeNodeInfo);
|
||||
treeItem.getChildren().add(getTreeItem(bean, bean.packCodeNodeInfo.isContainsChildren));
|
||||
});
|
||||
}
|
||||
Platform.runLater(() -> {
|
||||
treeTableView.refresh();
|
||||
});
|
||||
// initTreeOrListMouseClick();
|
||||
// AbstractTreeData selectedData = treeViewOperation.getSelectedTreeNode(treeView.treeViewer);
|
||||
// if (selectedData == null) {
|
||||
// return;
|
||||
// }
|
||||
// if (selectedData.getPackCodeNodeInfo().getNodeComponent() == null) {
|
||||
// return;
|
||||
// }
|
||||
// if ((selectedData.getPackCodeNodeInfo().is_lock)) {
|
||||
// return;
|
||||
// }
|
||||
// String currentNodeDesc = "";
|
||||
// String currentNodeValue = "";
|
||||
// String name = "";
|
||||
// // 得到编码相关信息
|
||||
// getCodeInfo(selectedData);
|
||||
//
|
||||
// KUtil.LOG(">>>>>>>><<<<<<<");
|
||||
// getClassANDPropertyInfo(selectedData);
|
||||
//
|
||||
// name = selectedData.getPackCodeNodeInfo().getNode_name();
|
||||
// icoTreeData = selectedData;
|
||||
// currentNodeValue = replaceSpecialValue(selectedData.getPackCodeNodeInfo().node_value);
|
||||
// if (currentNodeValue.length() > 0) {
|
||||
// currentNodeDesc = currentNodeValue + "::" + selectedData.getPackCodeNodeInfo().getNode_name();
|
||||
// }
|
||||
// if (currentNodeValue.trim().length() > 0) {
|
||||
// pattern = pattern + " " + currentNodeValue + " ";
|
||||
// }
|
||||
// if (currentNodeDesc.trim().length() > 0) {
|
||||
// codeDesc = codeDesc + currentNodeDesc;
|
||||
// }
|
||||
// if (!TCPreferenceUitl.isTrueTCPreferenceValue(session, origin_isItemNameTextDefaultNull)) {
|
||||
// nameText.setText(name);
|
||||
// selectName = name;
|
||||
// KUtil.LOG("1----------------" + name);
|
||||
// String itemTypeString = tccomponentitemtype.getType();
|
||||
// } else {
|
||||
// nameText.setText("");
|
||||
// }
|
||||
// getFinalPattern();
|
||||
// idText.setText(finalPattern);
|
||||
// setIDPatternTextIsCanEdit();
|
||||
// idLengthText.setText(String.valueOf(idText.getText().replace(" ", "").trim().length()));
|
||||
// DescText.setText(codeDesc);
|
||||
// setMidComposite();
|
||||
|
||||
}
|
||||
|
||||
public void loadAutoCodeTreeTable(TreeItem<AutoCodeTreeBean> autoCodeTreeItem) throws Exception {
|
||||
AutoCodeTreeBean autoCodeTreeNode = autoCodeTreeItem.getValue();
|
||||
TCComponent selectedSegmentTCComponent = autoCodeTreeNode.packCodeNodeInfo.getNodeComponent();
|
||||
if (selectedSegmentTCComponent == null) {
|
||||
return;
|
||||
}
|
||||
Platform.runLater(() -> {
|
||||
treeTableView.getRoot().getChildren().clear();
|
||||
});
|
||||
if (selectedSegmentTCComponent.getLogicalProperty(AutoCodeManagerPropertyName.TreeAndListCodeNode_is_lock)) {
|
||||
return;
|
||||
}
|
||||
if ((autoCodeTreeNode.packCodeNodeInfo.getNode_type().equals(AutoCodeManagerPropertyName.TreeName))
|
||||
|| (autoCodeTreeNode.packCodeNodeInfo.getNode_type().equals(AutoCodeManagerPropertyName.ListName))) {
|
||||
String realType = autoCodeTreeNode.packCodeNodeInfo.getRealTypeName();
|
||||
KUtil.LOG("Select Type: " + realType);
|
||||
dialogController.setSelectedItemType(realType);
|
||||
}
|
||||
// 加载编码树
|
||||
if (autoCodeTreeNode.packCodeNodeInfo.getNode_type().equals(AutoCodeManagerPropertyName.TreeName)) {
|
||||
setTreeNodes(autoCodeTreeItem);
|
||||
}
|
||||
}
|
||||
|
||||
protected void setTreeNodes(TreeItem<AutoCodeTreeBean> autoCodeTreeItem) throws Exception {
|
||||
AutoCodeTreeBean segmentNode = autoCodeTreeItem.getValue();
|
||||
if (segmentNode == null) {
|
||||
return;
|
||||
}
|
||||
TCComponent autoCodeDataComponent = segmentNode.packCodeNodeInfo.getNodeComponent();
|
||||
HashMap<String, String> hashMap = new HashMap<String, String>();
|
||||
String parentStr = "";
|
||||
parentStr = getParentStr(segmentNode, parentStr);
|
||||
if (autoCodeDataComponent != null) {
|
||||
hashMap.put(AutoCodeManagerPropertyName.CodeRelation_current_node, autoCodeDataComponent.uid);
|
||||
hashMap.put(AutoCodeManagerPropertyName.CodeRelation_parent_node, parentStr);
|
||||
} else {
|
||||
hashMap.put(AutoCodeManagerPropertyName.CodeRelation_parent_node, "");
|
||||
hashMap.put(AutoCodeManagerPropertyName.CodeRelation_current_node, "");
|
||||
}
|
||||
String parentStr2 = "";
|
||||
if (autoCodeDataComponent != null) {
|
||||
if (parentStr.trim().length() == 0) {
|
||||
parentStr2 = autoCodeDataComponent.uid;
|
||||
} else {
|
||||
parentStr2 = parentStr + "," + autoCodeDataComponent.uid;
|
||||
}
|
||||
} else {
|
||||
parentStr2 = parentStr;
|
||||
}
|
||||
List<PackCodeNodeInfo> packCodeNodeInfos = searchTreeORListNodeInfos(hashMap, parentStr2,
|
||||
AutoCodeManagerPropertyName.searchTreeAndListCodeNodePropNames);
|
||||
int nodeCnt = packCodeNodeInfos == null ? 0 : packCodeNodeInfos.size();
|
||||
String realTypeName = segmentNode.packCodeNodeInfo.getRealTypeName();
|
||||
for (int i = 0; i < nodeCnt; i++) {
|
||||
PackCodeNodeInfo packCodeNodeInfo = packCodeNodeInfos.get(i);
|
||||
packCodeNodeInfo.setRealTypeName(realTypeName);
|
||||
Platform.runLater(() -> {
|
||||
AutoCodeTreeTableBean bean = new AutoCodeTreeTableBean(segmentNode, packCodeNodeInfo);
|
||||
treeTableView.getRoot().getChildren().add(getTreeItem(bean, bean.packCodeNodeInfo.isContainsChildren));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private List<PackCodeNodeInfo> searchTreeORListNodeInfos(HashMap<String, String> hashMap, String parentString,
|
||||
String[] returnPropertyNames) throws Exception {
|
||||
List<PackCodeNodeInfo> packCodeNodeInfos = new ArrayList<PackCodeNodeInfo>();
|
||||
TCComponent[] searchTCcomponents = KUtil.searchComponentFromITK(KMain.INPUTCODE_SEARCH_TREE_OR_LIST_NODE,
|
||||
hashMap);
|
||||
packCodeNodeInfos = getTreeORListNodeInfos(searchTCcomponents, parentString, returnPropertyNames);
|
||||
return packCodeNodeInfos;
|
||||
}
|
||||
|
||||
public String[] getTreeAndListStringValues(TCComponent[] components, String[] propNames, String parentString)
|
||||
throws Exception {
|
||||
StringBuilder inputStr = new StringBuilder();
|
||||
inputStr.append(parentString);
|
||||
int compCnt = KUtil.getLen(components);
|
||||
for (int i = 0; i < compCnt; i++) {
|
||||
inputStr.append(KMain.SPLITTER);
|
||||
inputStr.append(components[i].uid);
|
||||
}
|
||||
inputStr.append(KMain.SPLITTER);
|
||||
inputStr.append(KMain.SPLIT_SECTION);
|
||||
int paramCnt = KUtil.getLen(propNames);
|
||||
for (int i = 0; i < paramCnt; i++) {
|
||||
inputStr.append(KMain.SPLITTER);
|
||||
inputStr.append(propNames[i]);
|
||||
}
|
||||
String returnValues = KUtil.callITK(KMain.INPUTCODE_GET_TREE_AND_LIST_STRING_VALUES, inputStr.toString());
|
||||
return returnValues.split("@@");
|
||||
}
|
||||
|
||||
private String getStringValue(String value) {
|
||||
if ((value == null) || (value.equalsIgnoreCase("null"))) {
|
||||
return "";
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
private List<PackCodeNodeInfo> getTreeORListNodeInfos(TCComponent[] searchTCcomponents, String parentString,
|
||||
String[] returnPropertyNames) throws Exception {
|
||||
List<PackCodeNodeInfo> packCodeNodeInfos = new ArrayList<PackCodeNodeInfo>();
|
||||
if (searchTCcomponents != null && searchTCcomponents.length > 0) {
|
||||
String[] stringValues = getTreeAndListStringValues(searchTCcomponents, returnPropertyNames, parentString);
|
||||
if (stringValues == null) {
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < stringValues.length; i++) {
|
||||
String[] values = stringValues[i].split("&&");
|
||||
PackCodeNodeInfo packCodeNodeInfo = new PackCodeNodeInfo();
|
||||
if ((values != null) && (values.length > 0)) {
|
||||
if (returnPropertyNames.equals(AutoCodeManagerPropertyName.searchTreeAndListCodeNodePropNames)) {
|
||||
packCodeNodeInfo.setNodeComponent(searchTCcomponents[i]);
|
||||
packCodeNodeInfo.setNode_name(getStringValue(values[0]));
|
||||
packCodeNodeInfo.setNode_type(getStringValue(values[1]));
|
||||
packCodeNodeInfo.setNode_value(getStringValue(values[2]));
|
||||
packCodeNodeInfo.setNode_desc(getStringValue(values[3]));
|
||||
packCodeNodeInfo.setCode_style(getStringValue(values[4]));
|
||||
packCodeNodeInfo.setRule_node(getStringValue(values[5]));
|
||||
if (values[6].equalsIgnoreCase("yes")) {
|
||||
packCodeNodeInfo.setIs_root(true);
|
||||
}
|
||||
if (values[7].equalsIgnoreCase("yes")) {
|
||||
packCodeNodeInfo.setIs_lock(true);
|
||||
}
|
||||
if (values[8].equalsIgnoreCase("yes")) {
|
||||
packCodeNodeInfo.setDefaultSelected(true);
|
||||
}
|
||||
packCodeNodeInfo.setCreate_date(getStringValue(values[9]));
|
||||
packCodeNodeInfo.setLast_revise_date(getStringValue(values[10]));
|
||||
packCodeNodeInfo.setCreate_user(getStringValue(values[11]));
|
||||
packCodeNodeInfo.setLast_revise_user(getStringValue(values[12]));
|
||||
if (values[13].equalsIgnoreCase("yes")) {
|
||||
packCodeNodeInfo.setContainsChildren(true);
|
||||
}
|
||||
} else {
|
||||
packCodeNodeInfo.setNodeComponent(searchTCcomponents[i]);
|
||||
packCodeNodeInfo.setNode_name(getStringValue(values[0]));
|
||||
packCodeNodeInfo.setNode_type(getStringValue(values[1]));
|
||||
if (values[2].equalsIgnoreCase("yes")) {
|
||||
packCodeNodeInfo.setIs_root(true);
|
||||
}
|
||||
if (values[3].equalsIgnoreCase("yes")) {
|
||||
packCodeNodeInfo.setIs_lock(true);
|
||||
}
|
||||
if (values[4].equalsIgnoreCase("yes")) {
|
||||
packCodeNodeInfo.setContainsChildren(true);
|
||||
}
|
||||
}
|
||||
packCodeNodeInfos.add(packCodeNodeInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return packCodeNodeInfos;
|
||||
}
|
||||
|
||||
public String getParentStr(AbstractAutoCodeBean treeData, String parentStr) {
|
||||
// KUtil.LOG("i am in getParentStr == " + parentStr);
|
||||
if (treeData != null) {
|
||||
AbstractAutoCodeBean parentData = treeData.parentTreeData;
|
||||
if ((parentData != null) && ((parentData.packCodeNodeInfo.getNodeComponent() != null))) {
|
||||
// KUtil.LOG("parentData.getPackCodeNodeInfo() " +
|
||||
// parentData.packCodeNodeInfo.getNode_name());
|
||||
if (parentData.packCodeNodeInfo.getNodeComponent() != null) {
|
||||
// KUtil.LOG("i am not null");
|
||||
}
|
||||
if (parentStr.length() > 0) {
|
||||
parentStr = parentData.packCodeNodeInfo.getNodeComponent().uid + "," + parentStr;
|
||||
} else {
|
||||
parentStr = parentData.packCodeNodeInfo.getNodeComponent().uid;
|
||||
}
|
||||
parentStr = getParentStr(parentData, parentStr);
|
||||
// KUtil.LOG("parentStr AAA === " + parentStr);
|
||||
}
|
||||
} else {
|
||||
// KUtil.LOG(" treeDtae =null");
|
||||
}
|
||||
if (parentStr.toString().endsWith(",")) {
|
||||
parentStr = parentStr.substring(0, parentStr.length() - 1).toString();
|
||||
}
|
||||
return parentStr;
|
||||
}
|
||||
}
|
@ -0,0 +1,339 @@
|
||||
package nx_connor.autcocode.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.scene.control.Alert.AlertType;
|
||||
import javafx.scene.control.TreeItem;
|
||||
import javafx.scene.image.ImageView;
|
||||
import nx_connor.KMain;
|
||||
import nx_connor.autcocode.AutoCodeDialogController;
|
||||
import nx_connor.autcocode.bean.AutoCodeTreeBean;
|
||||
import nx_connor.autcocode.bean.PackCodeNodeInfo;
|
||||
import nx_connor.autcocode.bean.TCComponent;
|
||||
import nx_connor.autcocode.manager.AutoCodeConstants;
|
||||
import nx_connor.autcocode.manager.AutoCodeManagerPropertyName;
|
||||
import nx_connor.util.KUtil;
|
||||
|
||||
public class AutoCodeTreeViewController {
|
||||
|
||||
private AutoCodeDialogController dialogController;
|
||||
protected String showItemType = "";
|
||||
protected boolean isFilterType = false;
|
||||
|
||||
public AutoCodeTreeViewController(AutoCodeDialogController autoCodeDialogController) throws Exception {
|
||||
this.dialogController = autoCodeDialogController;
|
||||
initTree();
|
||||
}
|
||||
|
||||
protected void initTree() throws Exception {
|
||||
AutoCodeTreeBean rootBean = new AutoCodeTreeBean(null, "编码分类", AutoCodeManagerPropertyName.ComponentName);
|
||||
Platform.runLater(()->{
|
||||
dialogController.treeView.setRoot(getTreeItem(rootBean, true));
|
||||
});
|
||||
// 选择监听
|
||||
dialogController.treeView.getSelectionModel().selectedItemProperty()
|
||||
.addListener(new ChangeListener<TreeItem<AutoCodeTreeBean>>() {
|
||||
@Override
|
||||
public void changed(ObservableValue<? extends TreeItem<AutoCodeTreeBean>> arg0,
|
||||
TreeItem<AutoCodeTreeBean> arg1, TreeItem<AutoCodeTreeBean> newValue) {
|
||||
if (newValue == null) {
|
||||
return;
|
||||
}
|
||||
new Thread(() -> {
|
||||
dialogController.setProgressVisible(true);
|
||||
try {
|
||||
dialogController.showAutoCodeList(newValue);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
dialogController.Err(e);
|
||||
}
|
||||
dialogController.setProgressVisible(false);
|
||||
}).start();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public TreeItem<AutoCodeTreeBean> getTreeItem(AutoCodeTreeBean child, boolean needExpand) {
|
||||
ImageView image = child.getImage() == null ? null : new ImageView(child.getImage());
|
||||
TreeItem<AutoCodeTreeBean> treeItem = new TreeItem<AutoCodeTreeBean>(child, image);
|
||||
if (!needExpand) {
|
||||
return treeItem;
|
||||
}
|
||||
treeItem.expandedProperty().addListener(new ChangeListener<Boolean>() {
|
||||
@Override
|
||||
public void changed(ObservableValue<? extends Boolean> arg0, Boolean oldValue, Boolean newValue) {
|
||||
if (!newValue) {
|
||||
return;
|
||||
}
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
expandNode(treeItem);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
});
|
||||
treeItem.getChildren().add(new TreeItem<AutoCodeTreeBean>(null));
|
||||
return treeItem;
|
||||
}
|
||||
|
||||
public void expandNode(TreeItem<AutoCodeTreeBean> treeItem) {
|
||||
if (treeItem == null) {
|
||||
return;
|
||||
}
|
||||
if (treeItem.getChildren().size() != 1 || treeItem.getChildren().get(0).getValue() != null) {
|
||||
return;
|
||||
}
|
||||
AutoCodeTreeBean bean = treeItem.getValue();
|
||||
long timeStart = System.nanoTime();
|
||||
dialogController.setProgressVisible(true);
|
||||
try {
|
||||
KUtil.LOG("Expand Node: " + treeItem.getValue());
|
||||
Platform.runLater(() -> {
|
||||
treeItem.getChildren().clear();
|
||||
});
|
||||
String nodeType = bean.packCodeNodeInfo.getNode_type();
|
||||
if (AutoCodeManagerPropertyName.ComponentName.equals(nodeType)) {
|
||||
expandTopNode(treeItem);
|
||||
} else if (AutoCodeManagerPropertyName.ItemName.equals(nodeType)) {
|
||||
expandItemNode(treeItem);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
KUtil.LOGERROR(e);
|
||||
KUtil.showFXMessage(dialogController.dialog.getParentDialog(), "加载节点失败", AlertType.ERROR, e.getMessage());
|
||||
}
|
||||
long timeEnd = System.nanoTime();
|
||||
KUtil.LOG("Load Node Time: " + treeItem.getValue() + " -> " + (timeEnd - timeStart) / 1000000);
|
||||
dialogController.setProgressVisible(false);
|
||||
}
|
||||
|
||||
protected void expandItemNode(TreeItem<AutoCodeTreeBean> treeItem) throws Exception {
|
||||
boolean isShow = false;
|
||||
AutoCodeTreeBean bean = treeItem.getValue();
|
||||
HashMap<String, String> map = new HashMap<String, String>();
|
||||
map.put(AutoCodeManagerPropertyName.ClassificationCodeNode_node_name, bean.packCodeNodeInfo.getNode_name());
|
||||
TCComponent[] tcComponents = KUtil.searchComponentFromITK(KMain.INPUTCODE_SEARCH_AUTOCODE_SEGMENT, map);
|
||||
if (tcComponents == null || tcComponents.length == 0) {
|
||||
return;
|
||||
}
|
||||
List<TCComponent> showSegments = new ArrayList<TCComponent>();
|
||||
map.put(AutoCodeManagerPropertyName.ClassificationCodeNode_segment, "");
|
||||
TCComponent[] userComponents = KUtil.searchComponentFromITK(KMain.INPUTCODE_SEARCH_AUTOCODE_USER, map);
|
||||
String parentGroupUid = KUtil.callITK(KMain.INPUTCODE_GET_UID, "parentgroup");
|
||||
TCComponent parentGroup = KUtil.isEmpty(parentGroupUid) ? null : new TCComponent(parentGroupUid);
|
||||
int userComponentsCount = KUtil.getLen(userComponents);
|
||||
for (int i = 0; i < userComponentsCount; i++) {
|
||||
TCComponent u = userComponents[i];
|
||||
if (u.equals(dialogController.currentUser) || u.equals(dialogController.currentGroup)
|
||||
|| u.equals(dialogController.currentRole)) {
|
||||
isShow = true;
|
||||
break;
|
||||
}
|
||||
if (u.equals(parentGroup)) {
|
||||
isShow = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isShow) {
|
||||
int tcComponentsCount = KUtil.getLen(tcComponents);
|
||||
for (int i = 0; i < tcComponentsCount; i++) {
|
||||
isShow = false;
|
||||
TCComponent cc = tcComponents[i];
|
||||
if (cc == null) {
|
||||
continue;
|
||||
}
|
||||
String segmentName = cc.uid;
|
||||
HashMap<String, String> ccMap = new HashMap<String, String>();
|
||||
ccMap.put(AutoCodeManagerPropertyName.ClassificationCodeNode_node_name,
|
||||
bean.packCodeNodeInfo.getNode_name());
|
||||
ccMap.put(AutoCodeManagerPropertyName.ClassificationCodeNode_segment, segmentName);
|
||||
TCComponent[] ccUserComponents = KUtil.searchComponentFromITK(KMain.INPUTCODE_SEARCH_AUTOCODE_USER,
|
||||
ccMap);
|
||||
int ccUserCount = KUtil.getLen(ccUserComponents);
|
||||
if (ccUserCount == 0) {
|
||||
continue;
|
||||
}
|
||||
for (int j = 0; j < ccUserCount; j++) {
|
||||
TCComponent u = ccUserComponents[j];
|
||||
if (u == null) {
|
||||
continue;
|
||||
}
|
||||
if (u.equals(dialogController.currentUser) || u.equals(dialogController.currentGroup)
|
||||
|| u.equals(dialogController.currentRole)) {
|
||||
isShow = true;
|
||||
break;
|
||||
}
|
||||
if (u.equals(parentGroup)) {
|
||||
isShow = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isShow) {
|
||||
showSegments.add(cc);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int tcComponentsCount = KUtil.getLen(tcComponents);
|
||||
for (int i = 0; i < tcComponentsCount; i++) {
|
||||
TCComponent cc = tcComponents[i];
|
||||
if (cc != null) {
|
||||
showSegments.add(cc);
|
||||
}
|
||||
}
|
||||
}
|
||||
int segCnt = showSegments.size();
|
||||
if (segCnt == 0) {
|
||||
return;
|
||||
}
|
||||
String realTypeName = bean.packCodeNodeInfo.getRealTypeName();
|
||||
for (int i = 0; i < segCnt; i++) {
|
||||
TCComponent seg = showSegments.get(i);
|
||||
PackCodeNodeInfo packCodeNodeInfo = getTreeAndListStringValue(seg,
|
||||
AutoCodeManagerPropertyName.searchTreeAndListCodeNodePropNames);
|
||||
packCodeNodeInfo.setRealTypeName(realTypeName);
|
||||
AutoCodeTreeBean childBean = new AutoCodeTreeBean(packCodeNodeInfo);
|
||||
if (!packCodeNodeInfo.is_root) {
|
||||
continue;
|
||||
} else {
|
||||
setParentTreeNode(bean, childBean);
|
||||
}
|
||||
Platform.runLater(() -> {
|
||||
treeItem.getChildren().add(getTreeItem(childBean, packCodeNodeInfo.isContainsChildren));
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setParentTreeNode(AutoCodeTreeBean parentBean, AutoCodeTreeBean childBean) throws Exception {
|
||||
TCComponent[] tccomponents = null;
|
||||
HashMap<String, String> hashMap = new HashMap<String, String>();
|
||||
if (childBean.packCodeNodeInfo.getNodeComponent() != null) {
|
||||
hashMap.put(AutoCodeManagerPropertyName.CodeRelation_current_node,
|
||||
childBean.packCodeNodeInfo.getNodeComponent().uid);
|
||||
tccomponents = KUtil.searchComponentFromITK(KMain.INPUTCODE_SEARCH_PARENT_TREE_OR_LIST_NODE, hashMap);
|
||||
} else {
|
||||
tccomponents = null;
|
||||
}
|
||||
if (tccomponents != null && tccomponents.length > 0) {
|
||||
AutoCodeTreeBean childrenNode2 = childBean;
|
||||
for (int k = tccomponents.length - 1; k >= 0; k--) {
|
||||
if (tccomponents[k] == null) {
|
||||
continue;
|
||||
}
|
||||
PackCodeNodeInfo packCodeNodeInfo = getTreeAndListStringValue(
|
||||
tccomponents[k], AutoCodeManagerPropertyName.searchTreeAndListCodeNodePropNames);
|
||||
AutoCodeTreeBean treeData = new AutoCodeTreeBean(packCodeNodeInfo);
|
||||
childrenNode2.setParentTreeData(treeData);
|
||||
childrenNode2 = treeData;
|
||||
}
|
||||
childrenNode2.setParentTreeData(parentBean);
|
||||
}
|
||||
}
|
||||
|
||||
private String getStringValue(String value) {
|
||||
if ((value == null) || (value.equalsIgnoreCase("null"))) {
|
||||
return "";
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
protected PackCodeNodeInfo getTreeAndListStringValue(TCComponent seg, String[] propNames) throws Exception {
|
||||
PackCodeNodeInfo packCodeNodeInfo = new PackCodeNodeInfo();
|
||||
StringBuilder inputStr = new StringBuilder();
|
||||
inputStr.append(seg.uid);
|
||||
int paramCnt = KUtil.getLen(propNames);
|
||||
for (int i = 0; i < paramCnt; i++) {
|
||||
inputStr.append(KMain.SPLITTER);
|
||||
inputStr.append(propNames[i]);
|
||||
}
|
||||
String returnValues = KUtil.callITK(KMain.INPUTCODE_GET_TREE_AND_LIST_STRING_VALUE, inputStr.toString());
|
||||
String[] values = KUtil.isEmpty(returnValues) ? null : returnValues.split("&&");
|
||||
if ((values != null) && (values.length > 0)) {
|
||||
if (propNames.equals(AutoCodeManagerPropertyName.searchTreeAndListCodeNodePropNames)) {
|
||||
packCodeNodeInfo.setNodeComponent(seg);
|
||||
packCodeNodeInfo.setNode_name(getStringValue(values[0]));
|
||||
packCodeNodeInfo.setNode_type(getStringValue(values[1]));
|
||||
packCodeNodeInfo.setNode_value(getStringValue(values[2]));
|
||||
packCodeNodeInfo.setNode_desc(getStringValue(values[3]));
|
||||
packCodeNodeInfo.setCode_style(getStringValue(values[4]));
|
||||
packCodeNodeInfo.setRule_node(getStringValue(values[5]));
|
||||
if (values[6].equalsIgnoreCase("yes")) {
|
||||
packCodeNodeInfo.setIs_root(true);
|
||||
}
|
||||
if (values[7].equalsIgnoreCase("yes")) {
|
||||
packCodeNodeInfo.setIs_lock(true);
|
||||
}
|
||||
if (values[8].equalsIgnoreCase("yes")) {
|
||||
packCodeNodeInfo.setDefaultSelected(true);
|
||||
}
|
||||
packCodeNodeInfo.setCreate_date(getStringValue(values[9]));
|
||||
packCodeNodeInfo.setLast_revise_date(getStringValue(values[10]));
|
||||
packCodeNodeInfo.setCreate_user(getStringValue(values[11]));
|
||||
packCodeNodeInfo.setLast_revise_user(getStringValue(values[12]));
|
||||
if (values[13].equalsIgnoreCase("yes")) {
|
||||
packCodeNodeInfo.setContainsChildren(true);
|
||||
}
|
||||
} else {
|
||||
packCodeNodeInfo.setNodeComponent(seg);
|
||||
packCodeNodeInfo.setNode_name(getStringValue(values[0]));
|
||||
packCodeNodeInfo.setNode_type(getStringValue(values[1]));
|
||||
if (values[2].equalsIgnoreCase("yes")) {
|
||||
packCodeNodeInfo.setIs_root(true);
|
||||
}
|
||||
if (values[3].equalsIgnoreCase("yes")) {
|
||||
packCodeNodeInfo.setIs_lock(true);
|
||||
}
|
||||
if (values[4].equalsIgnoreCase("yes")) {
|
||||
packCodeNodeInfo.setContainsChildren(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return packCodeNodeInfo;
|
||||
}
|
||||
|
||||
protected void expandTopNode(TreeItem<AutoCodeTreeBean> topNode) throws Exception {
|
||||
String prefValueStr = KUtil.callITK(KMain.INPUTCODE_GetPrefValue, "Connor_load_only_item_types");
|
||||
String[] itemTypeNames;
|
||||
if (!KUtil.isEmpty(prefValueStr)) {
|
||||
itemTypeNames = prefValueStr.split(KMain.SPLITTER);
|
||||
} else {
|
||||
itemTypeNames = AutoCodeConstants.as1;
|
||||
}
|
||||
// String prefValStr = KUtil.callITK(KMain.INPUTCODE_GetPrefValue, PREF_SEQUENCEMAP); //AutoCodeConstants.as2
|
||||
List<AutoCodeTreeBean> allTypes = dialogController.autoCodeItemTypeController.getAllTypes(itemTypeNames,
|
||||
AutoCodeConstants.as2);
|
||||
int size = allTypes == null ? 0 : allTypes.size();
|
||||
List<Integer> remove = new ArrayList<Integer>();
|
||||
if(dialogController.filterType.size()>0) {
|
||||
for(int i=0;i<size;i++) {
|
||||
String typeName = allTypes.get(i).packCodeNodeInfo.getRealTypeName();
|
||||
if(!dialogController.filterType.contains(typeName)) {
|
||||
remove.add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
KUtil.LOG("过滤类型:"+remove);
|
||||
int removeCnt = remove.size();
|
||||
for(int i=removeCnt-1;i>=0;i--) {
|
||||
allTypes.remove(remove.get(i).intValue());
|
||||
}
|
||||
int size2 = allTypes.size();
|
||||
Platform.runLater(() -> {
|
||||
for (int i = 0; i < size2; i++) {
|
||||
topNode.getChildren().add(getTreeItem(allTypes.get(i), true));
|
||||
}
|
||||
if(size2==1) {
|
||||
topNode.getChildren().get(0).setExpanded(true);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
/**
|
||||
* @author tyl
|
||||
* @Action ini
|
||||
* 2011-3-15
|
||||
*/
|
||||
package nx_connor.autcocode.controller;
|
||||
|
||||
import nx_connor.KMain;
|
||||
import nx_connor.util.KUtil;
|
||||
|
||||
public class GetCodeNumber {
|
||||
|
||||
public static void delete_recycleID(String itemID) throws Exception {
|
||||
// Object[] params = { counterName, itemID };
|
||||
if ((itemID == null) || (itemID.length() == 0)) {
|
||||
return;
|
||||
}
|
||||
itemID = itemID.replace(" ", "").trim();
|
||||
KUtil.callITK(KMain.INPUTCODE_DELETE_RECYCLE_ID, itemID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param patternCode
|
||||
* @param codeLength
|
||||
* @param startIndex
|
||||
* @param endIndex
|
||||
* @param increaseStep
|
||||
* @return
|
||||
* @throws ServiceException
|
||||
*/
|
||||
public static String getCodeNumber(String patternCode, int codeLength, int startIndex, int maxValue,
|
||||
int increaseStep, String excludeStr) throws Exception {
|
||||
if (maxValue == startIndex) {
|
||||
return String.valueOf(maxValue);
|
||||
}
|
||||
if (startIndex < 1) {
|
||||
startIndex = 1;
|
||||
}
|
||||
if (maxValue < startIndex) {
|
||||
return String.valueOf(startIndex);
|
||||
}
|
||||
codeLength = String.valueOf(maxValue).length();
|
||||
StringBuilder input = new StringBuilder();
|
||||
input.append(patternCode.replace(" ", "").trim());
|
||||
input.append(KMain.SPLITTER);
|
||||
input.append(codeLength);
|
||||
input.append(KMain.SPLITTER);
|
||||
input.append(startIndex);
|
||||
input.append(KMain.SPLITTER);
|
||||
input.append(maxValue);
|
||||
input.append(KMain.SPLITTER);
|
||||
input.append(increaseStep);
|
||||
input.append(KMain.SPLITTER);
|
||||
input.append(excludeStr);
|
||||
// String[] params = { patternCode.replace(" ", "").trim(), codeLength, startIndex, maxValue, increaseStep,
|
||||
// excludeStr };
|
||||
return KUtil.callITK(KMain.INPUTCODE_QUERY_PART_NO, input.toString());
|
||||
// String str = "";
|
||||
// str = (String) userService.call("queryPartNo", params);
|
||||
// return str;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package nx_connor.autcocode.manager;
|
||||
|
||||
public interface AutoCodeConstants {
|
||||
// AutoCode
|
||||
public static final String AutoCode_APPLICATION_ID = "cn.com.origin.autocode";
|
||||
|
||||
public static final String AutoCodeCodeView_ID = "cn.com.origin.autocode.views.AutoCodeView";
|
||||
public static final String AutoCodeCodeView_Name = "编码规则";
|
||||
|
||||
public static final String AutoCodeItemTypeView_ID = "cn.com.origin.autocode.views.AutoCodeItemTypeView";
|
||||
public static final String AutoCodeItemTypeView_Name = "零组件";
|
||||
|
||||
public static final String AutoCodeGroupView_ID = "cn.com.origin.autocode.views.AutoCodeGroupView";
|
||||
public static final String AutoCodeGroupView_Name = "人员指派";
|
||||
|
||||
public static final String AutoCodeSegmentView_ID = "cn.com.origin.autocodemanager.views.AutoCodeSegmentView";
|
||||
public static final String AutoCodeSegmentView_Name = "编码规则";
|
||||
|
||||
|
||||
|
||||
public static final String as1[] = { "Item" ,"Part","Design"};//
|
||||
// public static final String as2[] = { "Part", "Design", "PSSignal", "PSConnection", "Schedule", "ScheduleTask", "Architecture", "AllocationMap", "CAEItem", "CAEBCItem", "CAEConnItem", "CAELoadItem", "MEOP", "MEProcess", "MEWorkarea", "MEContext", "MEGenericBOP", "MEProductBOP",
|
||||
// "Vendor", "BidPackage", "SwDesignComp", "PhysicalPart", "ChangeItem", "ParmDef", "ParmDefBCD", "ParmDefBitDef", "ParmDefBool", "ParmDefDate", "ParmDefDbl", "ParmDefHex", "ParmDefInt", "ParmDefSED", "ParmDefStr", "ParmGrpVal", "CalParm", "ParmGrpDef" };
|
||||
|
||||
// public static final String as1[] = { "Item", "Drawing" };"Part", "Design",
|
||||
public static final String as2[] = { "EngChange", "PSSignal" }; //, "BidPackage", "SwDesignComp", "PhysicalPart", "ChangeItem", "ParmDef", "ParmDefBCD", "ParmDefBitDef", "ParmDefBool", "ParmDefDate", "ParmDefDbl", "ParmDefHex", "ParmDefInt", "ParmDefSED", "ParmDefStr", "ParmGrpVal", "CalParm", "ParmGrpDef"
|
||||
|
||||
// , "PSConnection", "Schedule", "ScheduleTask", "Architecture", "AllocationMap", "CAEItem", "CAEBCItem", "CAEConnItem", "CAELoadItem", "MEOP", "MEProcess", "MEWorkarea", "MEContext", "MEGenericBOP", "MEProductBOP",
|
||||
// "Vendor"
|
||||
// public static final String startWithTypes[]={"SJ3_"};
|
||||
// public static final String startWithTypes[] = {};
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package nx_connor.autcocode.manager;
|
||||
|
||||
public interface AutoCodeManagerImageKey {
|
||||
public static final String ICONSPATH = "icons/";
|
||||
public static final String HOME_IMAGE = ICONSPATH + "home_data.png";
|
||||
|
||||
public static final String CODE_IMAGE = ICONSPATH + "code_16.png";
|
||||
public static final String CODEGROUP_IMAGE = ICONSPATH + "folder_16.png";
|
||||
|
||||
public static final String NODEVALUE_IMAGE = ICONSPATH + "nodevalue_16.png";
|
||||
public static final String CODENODE_IMAGE = ICONSPATH + "codenode_16.png";
|
||||
|
||||
public static final String TREE_IMAGE = ICONSPATH + "tree_16.png";
|
||||
public static final String TREENODE_IMAGE = ICONSPATH + "treenode_16.png";
|
||||
|
||||
public static final String LIST_IMAGE = ICONSPATH + "list_16.png";
|
||||
public static final String LISTNODE_IMAGE = ICONSPATH + "listproperty_16.png";
|
||||
public static final String LISTVALUE_IMAGE = ICONSPATH + "listvalue_16.png";
|
||||
|
||||
public static final String OK_IMAGE = ICONSPATH + "ok_16.png";
|
||||
public static final String CLOSE_IMAGE = ICONSPATH + "close_16.png";
|
||||
|
||||
public static final String IMPORT_IMAGE = ICONSPATH + "import_16.png";
|
||||
public static final String EXPORT_IMAGE = ICONSPATH + "export_16.png";
|
||||
|
||||
public static final String ORGANIZATION_IMAGE = ICONSPATH + "organization_16.png";
|
||||
public static final String GROUP_IMAGE = ICONSPATH + "group_16.png";
|
||||
public static final String ROLE_IMAGE = ICONSPATH + "role_16.png";
|
||||
public static final String PERSON_IMAGE = ICONSPATH + "person_16.png";
|
||||
|
||||
public static final String ITEM_IMAGE = ICONSPATH + "item_16.png";
|
||||
|
||||
public static final String LOCK_IMAGE = ICONSPATH + "lock_16.png";
|
||||
public static final String UNLOCK_IMAGE = ICONSPATH + "unlock_16.png";
|
||||
|
||||
public static final String EDIT_IMAGE = ICONSPATH + "edit_16.png";
|
||||
public static final String REMOVE_IMAGE = ICONSPATH + "remove_16.png";
|
||||
public static final String DELETE_IMAGE = ICONSPATH + "delete_16.png";
|
||||
|
||||
public static final String SEQ_IMAGE = ICONSPATH + "seq_16.png";
|
||||
public static final String ADD_IMAGE = ICONSPATH + "add.png";
|
||||
|
||||
}
|
@ -0,0 +1,151 @@
|
||||
package nx_connor.autcocode.manager;
|
||||
|
||||
public interface AutoCodeManagerPropertyName {
|
||||
// Cd9_TreeAndListCodeNode
|
||||
public final static String TreeAndListCodeNode_isContainsChildren = "isContainsChildren" ;// 是否包含子节点
|
||||
public final static String TreeAndListCodeNode_uid = "uid" ;// uid
|
||||
public final static String TreeAndListCodeNode_node_index = "cd9_node_index"; // Integer 节点序号
|
||||
public final static String TreeAndListCodeNode_node_type = "cd9_node_type";// String 节点名称
|
||||
public final static String TreeAndListCodeNode_node_name = "cd9_node_name";// String 节点名称
|
||||
public final static String TreeAndListCodeNode_node_value = "cd9_node_value"; // String 节点值
|
||||
public final static String TreeAndListCodeNode_node_desc = "cd9_node_desc"; // String 节点描述
|
||||
public final static String TreeAndListCodeNode_code_style = "cd9_code_style"; // String 编码格式
|
||||
public final static String TreeAndListCodeNode_code_length = "cd9_code_length"; // int 编码长度
|
||||
public final static String TreeAndListCodeNode_is_root = "cd9_is_root";// boolean 是否是根节点
|
||||
public final static String TreeAndListCodeNode_rule_node = "cd9_rule_node";// boolean 是否是根节点
|
||||
public final static String TreeAndListCodeNode_reference_nodes = "cd9_reference_nodes"; // 引用的节点
|
||||
|
||||
public final static String TreeAndListCodeNode_is_lock = "cd9_is_lock";// boolean 是否锁定
|
||||
public final static String TreeAndListCodeNode_create_date = "cd9_create_date";// Date 创建日期
|
||||
public final static String TreeAndListCodeNode_last_revise_date = "cd9_last_revise_date";// Date 最后修改日期
|
||||
public final static String TreeAndListCodeNode_create_user = "cd9_create_user";// TypeReference 创建者
|
||||
public final static String TreeAndListCodeNode_last_revise_user = "cd9_last_revise_user";// TypeReference 最后修改者
|
||||
|
||||
public final static String TreeAndListCodeNode_seq_begin_value = "cd9_seq_begin_value"; // Integer 流水码初始值
|
||||
public final static String TreeAndListCodeNode_seq_max_value = "cd9_seq_max_value"; // Integer 流水码最大值
|
||||
public final static String TreeAndListCodeNode_seq_length = "cd9_seq_length"; // Integer 流水码长度
|
||||
public final static String TreeAndListCodeNode_isDefaultSelected = "cd9_isDefaultSelected"; // boolean 是否为默认选中(针对列表)
|
||||
|
||||
String[] searchTreeAndListCodeNodePropNames = {
|
||||
AutoCodeManagerPropertyName.TreeAndListCodeNode_node_name,
|
||||
AutoCodeManagerPropertyName.TreeAndListCodeNode_node_type,
|
||||
AutoCodeManagerPropertyName.TreeAndListCodeNode_node_value,
|
||||
AutoCodeManagerPropertyName.TreeAndListCodeNode_node_desc,
|
||||
AutoCodeManagerPropertyName.TreeAndListCodeNode_code_style,
|
||||
AutoCodeManagerPropertyName.TreeAndListCodeNode_rule_node,
|
||||
|
||||
AutoCodeManagerPropertyName.TreeAndListCodeNode_is_root,
|
||||
AutoCodeManagerPropertyName.TreeAndListCodeNode_is_lock,
|
||||
AutoCodeManagerPropertyName.TreeAndListCodeNode_isDefaultSelected,
|
||||
|
||||
AutoCodeManagerPropertyName.TreeAndListCodeNode_create_date,
|
||||
AutoCodeManagerPropertyName.TreeAndListCodeNode_last_revise_date,
|
||||
|
||||
AutoCodeManagerPropertyName.TreeAndListCodeNode_create_user,
|
||||
AutoCodeManagerPropertyName.TreeAndListCodeNode_last_revise_user,
|
||||
AutoCodeManagerPropertyName.TreeAndListCodeNode_isContainsChildren
|
||||
};
|
||||
|
||||
String[] searchSegmentPropNames = {
|
||||
AutoCodeManagerPropertyName.TreeAndListCodeNode_node_name,
|
||||
AutoCodeManagerPropertyName.TreeAndListCodeNode_node_type,
|
||||
AutoCodeManagerPropertyName.TreeAndListCodeNode_is_root,
|
||||
AutoCodeManagerPropertyName.TreeAndListCodeNode_is_lock,
|
||||
AutoCodeManagerPropertyName.TreeAndListCodeNode_isContainsChildren
|
||||
};
|
||||
|
||||
// Cd9_CodeRelation
|
||||
public final static String CodeRelation_parent_node = "cd9_parent_nodes"; // TypeReference 父节点
|
||||
public final static String CodeRelation_current_node = "cd9_current_node"; // TypeReference 当前节点
|
||||
public final static String CodeRelation_children_nodes = "cd9_children_nodes"; // TypeReference 子节点
|
||||
|
||||
public final static String CodeRelation_create_date = "cd9_create_date";// Date 创建日期
|
||||
public final static String CodeRelation_create_user = "cd9_create_user";// TypeReference 创建者
|
||||
|
||||
// Cd9_ClassificationCodeNode
|
||||
public final static String ClassificationCodeNode_node_index = "cd9_node_index"; // Integer 节点序号
|
||||
public final static String ClassificationCodeNode_node_name = "cd9_node_name";// String 节点名称
|
||||
public final static String ClassificationCodeNode_segment = "cd9_segment";// String 所含码段
|
||||
public final static String ClassificationCodeNode_create_date = "cd9_create_date";// Date 创建日期
|
||||
public final static String ClassificationCodeNode_last_revise_date = "cd9_last_revise_date";// Date 最后修改日期
|
||||
public final static String ClassificationCodeNode_create_user = "cd9_create_user";// TypeReference 创建者
|
||||
public final static String ClassificationCodeNode_last_revise_user = "cd9_last_revise_user";// TypeReference 最后修改者
|
||||
public final static String ClassificationCodeNode_grant_users = "cd9_grant_users";// TypeReference 授权用户
|
||||
public final static String ClassificationCodeNode_grant_roles = "cd9_grant_roles";// TypeReference 授权角色
|
||||
public final static String ClassificationCodeNode_grant_groups = "cd9_grant_groups";// TypeReference 授权组
|
||||
|
||||
// type
|
||||
public final static String ItemName = "item";
|
||||
public final static String RootNodeName = "root";
|
||||
public final static String TreeName = "tree";
|
||||
public final static String ListName = "list";
|
||||
public final static String CodeGroupName = "codeGroup";
|
||||
public final static String TreeNodeName = "treeNode";
|
||||
public final static String ListPropertyNodeName = "listPropertyNode";
|
||||
public final static String ListPropertyValueNodeName = "listPropertyValueNode";
|
||||
|
||||
public final static String ComponentName = "component";
|
||||
public final static String OrganizationName = "organization";
|
||||
public final static String SegmentName = "segment";
|
||||
public final static String GroupName = "group";
|
||||
public final static String RoleName = "role";
|
||||
public final static String UserName = "user";
|
||||
public final static String LockName = "lock";
|
||||
public final static String AddChildrenTreeNodeName = "AddChildrenTreeNode";
|
||||
public final static String AddTreeNodeName = "AddTreeNode";
|
||||
public final static String AddRuleRootNodeName = "AddRuleRootNode";
|
||||
public final static String AddRuleGroupNodeName = "AddRuleGroupNode";
|
||||
|
||||
// Item
|
||||
public final static String Item_Desc = "object_desc";
|
||||
public final static String Item_generateID = "cd9_generateID";
|
||||
public final static String Item_codeDesc = "cd9_codeDesc";
|
||||
public final static String Item_isLock = "cd9_isLock";
|
||||
public final static String Item_codePattern = "cd9_codePattern";
|
||||
public final static String Item_codeRuleName = "cd9_codeRuleName";
|
||||
public final static String Item_codeID = "cd9_codeID";
|
||||
public final static String Item_codeStyle = "cd9_codeStyle";
|
||||
public final static String Item_uom_tag = "uom_tag";
|
||||
|
||||
|
||||
|
||||
// Item Revision
|
||||
public final static String ItemRevision_isLock = "cd9_isLock";
|
||||
|
||||
// codeStyle
|
||||
public final static String Code_seq = "[L]";
|
||||
public final static String Code_pattern = "[T]";
|
||||
public final static String Code_year2 = "[YY]";
|
||||
public final static String Code_year4 = "[YYYY]";
|
||||
public final static String Code_mouth2 = "[MM]";
|
||||
public final static String Code_mouth1 = "[M]";
|
||||
public final static String Code_date2 = "[DD]";
|
||||
public final static String Code_date1 = "[D]";
|
||||
|
||||
// Cd9_CodeCounter
|
||||
public final static String CodeCounter_index = "cd9_index";
|
||||
public final static String CodeCounter_name = "cd9_name";
|
||||
public final static String CodeCounter_recycleID = "cd9_recycleID";
|
||||
public final static String CodeCounter_isUsed = "cd9_isUsed";
|
||||
public final static String CodeCounter_createDate = "cd9_createDate";
|
||||
public final static String CodeCounter_createUser = "cd9_createUser";
|
||||
public final static String CodeCounter_last_revise_date = "cd9_last_revise_date";// Date 最后修改日期
|
||||
public final static String CodeCounter_last_revise_user = "cd9_last_revise_user";
|
||||
|
||||
// Cd9_CodeNextID
|
||||
public final static String Counter_name = "cd9_name";
|
||||
public final static String Counter_nextID = "cd9_nextID";
|
||||
|
||||
// 有关导入导出
|
||||
public final static String CodeClassfication = "CodeClassfication";
|
||||
public final static String CodeTree = "CodeTree";
|
||||
public final static String CodeListName = "CodeListName";
|
||||
public final static String CodeListValue = "CodeListValue";
|
||||
|
||||
// public final static String[] TreeAndListCodeNode_Titles = { "层号", "类型", "名称", "码值", "备注", "编码样式", "编码长度", "流水码初始值", "流水码最大值", "是否为根节点", "是否锁定", "创建日期", "最后修改日期", "创建者", "最后修改者" };
|
||||
|
||||
public final static String[] TreeAndListCodeNode_Titles = { "层号", "类型", "名称", "码值", "备注", "是否为默认值", "编码样式", "编码长度", "流水码初始值", "流水码最大值", "是否为根节点", "是否锁定", "创建日期", "最后修改日期", "创建者", "最后修改者" };
|
||||
public final static String[] ClassificationCodeNode_Titles = { "层号", "类型", "名称", "码值", "备注", "编码格式", "是否为根节点", "是否锁定", "创建日期", "最后修改日期", "创建者", "最后修改者" };
|
||||
public final static String[] CodeSequence_Titles = { "层号", "名称", "初始值", "最大值", "长度", "步长", "不包含数字", "是否锁定", "创建日期", "最后修改日期", "创建者", "最后修改者" };
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package nx_connor.autcocode.manager;
|
||||
|
||||
/**
|
||||
* @author river
|
||||
*
|
||||
*/
|
||||
public interface AutoCodeManangerConstants {
|
||||
// autocodemannager
|
||||
public static final String AutoCodeMananger_APPLICATION_ID = "cn.com.origin.autocodemanager";
|
||||
public static final String AutoCodeManagerView_ID = "cn.com.origin.autocodemanager.views.AutoCodeSegmentView";
|
||||
public static final String AutoCodeManagerView_Name = "编码管理";
|
||||
public static final String AutoCodeManagerTreeCodeView_ID = "cn.com.origin.autocodemanager.views.AutoCodeTreeCodeView";
|
||||
public static final String AutoCodeManagerTreeCodeView_Name = "编码树";
|
||||
public static final String AutoCodeManagerListCodeView_ID = "cn.com.origin.autocodemanager.views.AutoCodeListCodeView";
|
||||
public static final String AutoCodeManagerListCodeView_Name = "列表";
|
||||
|
||||
// public static final String AutoCodeTreeCodeView_ID = "cn.com.origin.autocodemanager.views.AutoCodeTreeCodeView";
|
||||
// public static final String AutoCodeTreeCodeView_Name = "编码树";
|
||||
|
||||
// public static final String AutoCodeListCodeView_ID = "cn.com.origin.autocodemanager.views.AutoCodeListCodeView";
|
||||
// public static final String AutoCodeListCodeView_Name = "列表";
|
||||
|
||||
|
||||
public static final String AutoCodeManangerShowNoneView_Name = "";
|
||||
public static final String AutoCodeManangerShowNoneView_ID = "cn.com.origin.autocodemanager.views.ShowNoneView";
|
||||
|
||||
public static final String AutoCodeStyleView_ID = "cn.com.origin.autocodemanager.views.AutoCodeStyleView";
|
||||
public static final String AutoCodeStyleView_Name = "样式设置";
|
||||
|
||||
public static final String AutoCodeManagerGroupView_ID = "cn.com.origin.autocodemanager.views.AutoCodeGroupView";
|
||||
public static final String AutoCodeTestView_ID = "cn.com.origin.autocodemanager.views.AutoCodeTestView";
|
||||
public static final String AutoCodeTestView_Name = "编码验证";
|
||||
|
||||
}
|
After Width: | Height: | Size: 332 B |
After Width: | Height: | Size: 699 B |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 681 B |
After Width: | Height: | Size: 454 B |
After Width: | Height: | Size: 726 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 616 B |
After Width: | Height: | Size: 906 B |
After Width: | Height: | Size: 672 B |