Windchill常用开发全套整合
Windchill常用命令和客制化

Windchill 常用命令和客制化windchill wt.load.util.CSV2XML -input -output -root d:\moduleswindchill markets.CSV2XML -input -output -rootwindchill wt.load.util.CSV2XML -root e:\windchill wt.load.LoadFromFile -u[user name] -p[password] -d d:\modules\users.xml -CONT_PATH /Container=Software/wt.pdmlink.PDMLinkProduct= windchill wt.load.LoadFromFile -u[user name] -p[password] -d d:\modules\users.xml -CONT_PATH /Container=Software/wt.inf.library.WTLibrary=windchill wt.load.LoadFromFile -u wcadmin -p wcadmin -d e:\LoadDoc.xml -CONT_PATH /Container=ptc/wt.pdmlink.PDMLinkProduct=路由器_P1windchill wt.load.LoadFromFile -u wcadmin -p wcadmin -d E:\WMDocumentReview.xml -CONT_PATH /Container=ptcwindchill com.ptc.windchill.partslink.AdminApp -reloadenumCustomizeant -f MakeJar.xmlResourceBuild wt.project.RoleRB trueenumVerify <fully_qualified_EnumClassname>[<language>][<country>][<variant>]例如:enumVerify wt.lifecycle.State fr CAjava wt.util.resource.ResourceBundleUtil wt.part.partModelRBxconfmanager -p用命令导入ldif:windchill engine.util.LDAPImport -dir E:\PTC\Windchill_8.0 -ldiffileE:\PTC\IE_JDBCAdapter\jdbc.ldif将Windchill的核心class文件打包为jar文件命令:makejar.bat 或者 Windchill wt.tools.boot.MakeJar jar=wt.jarconfig=wt.jar.config 或者 Windchill wt.tools.boot.MakeJar jar=wt.jar处理多字节:在wt.properties最后添加wt.db.maxBytesPerChar=3wt.db.encoding=UTF8或者<Property name="wt.db.maxBytesPerChar" overridable="true"targetFile="codebase/wt.properties" value="3"/>JavaGen.sh registry false false true false falseJavaGen registry false false true false false产生CAD代理工作服务: i486_nt\obj\WorkDaemon.exe -InstallD:\Eclipse\eclipse.exe -vm D:\j2sdk1.4.2_06\jre\bin\javaw -vmargs -Xms256M -Xmx512M Attribute Type Logical ID Belong To Catalog------------------------------------------------------------------------------------------------------Extended Type String RootLocalID String persistInfo.objectIdentifier RoothelperName String SearchableNumber String number PartOracle 命令导出命令(全量导出):exp system/system@wind file=f:\wind.dmp full=y statistics=noneexp system/system@wind file=f:\wind.dmp owner=(PDM1,PDM2) statistics=none exp pdm8/pdm8@wind tables=(table1,table2)(增量导出):exp system/system@wind file=f:\wind.dmp inctype=incremental导入命令:imp system/system@wind file=f:\wind.dmp full=y ignore=yimp system/system@wind file=f:\wind(PDMLink).dmp fromuser=PDMLinktouser=PDMLink ignore=yimp system/system@wind file=f:\wind(PDMLink).dmp fromuser=PDM1 touser=PDM2 rows=y indexes=y显示当前连接用户:show user查看数据库的表空间:select * from dba_tablespaces;显示常用的系统文件的视图:v$database,v$datafile,v$logfile,v$controlfile,v$parameter快速清空一个大表:truncate table table_name;查询数据库实例:select * from v$instance;将查询的结果导入到文本文件中:SQL>spool c:\abcd.txt;SQL>select * from table;SQL>spool off;修改字段大小:alter table table_name modify (field_name varchar2(100));修改表名:alter table old_table_name rename to new_table_name;找数据库表的主键字段的名称:select * from user_constraints where constraint_type='P' and table_name='TABLE_NAME';如果导出时出现942的错误,那是进行升级后没有执行:SQL>conn / as sysdba;SQL>%Oracle_home%\rdbms\admin\catexp.sql;删除用户下的所有对象:set linesize 50set pagesize 500spool drop_object.sqlselect 'drop '||object_type||' '||object_name||';' from user_objects;spool off@drop_object.sql;Oracle监听器启动:lsnrctl startOracle监听器停止:lsnrctl stopOracle实例启动:使用sysdba身份登录,输入:startupOracle实例停止:使用sysdba身份登录,输入:shutdown创建远程连接:create database link pdmlink_wind connect to pdm_migration identified by migchangeme using 'fan-10'(pdmlink_wind连接名称、pdm_migration用户名、migchangeme密码、fan-10连接字符串)使用链接:select * from wtpart@pdmlink_windselect a.CLASSNAMEA2A2,a.IDA2A2,b.CLASSNAMEA2A2,b.IDA2A2 where wtpart a,pdmlink_wind.wtpart b where a.IDA2A2=b.IDA2A2;改变使用者口令:alter user pdm identified by pdm;停止OEM:oemctl stop oms sysman/passwd比较表结构:SELECT COUNT(*) FROM(SELECT CNAME||COLTYPE||WIDTH FROM COL@PDJ WHERE TNAME='WTPART'MINUSSELECT CNAME||COLTYPE||WIDTH FROM COL WHERE TNAME='WTPART');我们在建立一个基于原来某个表的结构的时候,就用这个:CREATE TABLE T_NAME AS SELECT * FROM V_TABLE WHERE 1=2执行Oracle数据库碎片整理工具:在生产环境、测试环境中,请定期执行下面的sql,将其中的“pdm7”替换成为实际的数据库用户名,注意在执行该语句的时候一定要将Windchill先停止:execute dbms_stats.gather_schema_stats(ownname => 'pdm7', cascade=>true);该sql的用途是用来整理数据库的碎片程序,从而可以显著提高数据库的存取性能,在各个环境中建议每隔1-2个月执行一次,该语句可以在我们的WCPerfTuningGuide.pdf文档中找到修改游标的最大打开数:在两个文件中可以修改游标的打开数:"SPfile+例程名.ora" 和 "Init+例程名.ora";其中"SPfile+例程名.ora"的优先于"Init+例程名.ora"。
Windchill常用业务对象、目录结构、类、包介绍

常用业务对象、目录结构、类、包介绍文档控制更改记录目录文档控制 (ii)更改记录 (ii)1. Windchill对象介绍 (i)1.1 Windchill目录结构 (i)1.2 Windchill常用业务对象、类 (i)1.3 Windchill常用包 (iii)1.4 如何在Windchlil系统中查找对象对应的类 (iv)1.Windchill对象介绍(会持续更新此文档)1.1Windchill目录结构●wtCustom放入修改系统的rblnfo文件●wtSateArea下的siteMod文件中放入修改后的系统文件,比如.jspf文件、html, xml;ptcCurrent文件放系统当前版本的文件;ptcOrig放系统最原始的文件ant-f bin/swmaint.xml installSiteChanges●bin:windchill工具目录,如windchill shell●src目录放客制化的源文件,放国际化.rblnfo文件。
●codebase是运行时目录,放编译后的.class文件、放WEB相关文件、放模板文件(.html)●netmarkets:JSP文件●tasks目录放系统服务文件.xml文件, Info*Engine配置文件●valuts:文件仓目录●loadFiles目录,放置需要导入到系统的工作流、生命周期等●Logs:日志目录●loadXMLFiles目录,放置配置系统的信息的.xml文件8,DB目录,放置建立模型后生成的SQL语句●db:数据库映射文件及模型SQL脚本1.2Windchill常用业务对象、类业务对象常用类名描述部件wt.part.WTPart 零部件对象部件wt.part.WTPartMaster 部件master对象部件wt.part.WTPartReferenceLink 部件参考关系部件wt.part.WTPartDescribeLink 部件描述关系部件wt.part.WTPartUsageLink 部件使用关系部件wt.part.WTPartAlternateLink 实现wt.fc.ObjectToObjectLink,全局可替换部件wt.part.WTPartSubstituteLink 实现wt.fc.ObjectToObjectLink,特定可替换部件wt.part.LineNumber 行号部件wt.part.Quantity 数量1.3Windchill常用包1.4如何在Windchlil系统中查找对象对应的类方法一:导航到站点-->"类型和属性管理器",选择部件,这个部件就对应了系统中OOTB对象,wt.part是包名,WTPart是类名称方法二:对象的详细页面,浏览器地址中key(OID)的值包含类名+ida2a2,例如:oid=OR%3Awt.part.WTPart%3A222040.。
Windchill主要应用模块简介

经过全球50000多家先进企业长期验证的内容和过程管理系统:不管您是全球集团企业、区域供应商还是小型服务机构,您在设法管理产品内容和开发过程时都面对着各种问题。
比如:产品数据安全、产品数据规范、产品数据的结构化管理、研发流程的规范化、研发流程的自动化、研发效率如何提升?研发成果如何重用?标准化、通用化如何更有效的贯彻执行等。
贵公司的成功依赖于拥有高效的业务过程,并且有效地管理复杂的信息资产,这包括产品设计、工艺、服务、认证、法规符合等相关资料。
Windchill 是一个有着近10年历史的全球一流的生命周期管理系统,经过了全球50000多家先进企业实际应用和长期验证过的内容和过程管理软件,它提供了全面的产品生命周期解决方案。
这个全面的企业业务协同系统具有快速、安全、稳定、成熟和只需一个 Web 浏览器就能访问的特点,它使公司能够更规范的管理产品研发过程,为企业提高研发效率、规范产品研发过程、加快产品上市、提高产品标准化、通用化、降低产品成本、增强企业竞争力等方面提供强大而完整的系统解决方案。
功能及益处•一体化的信息管理系统,单一的产品数据源提高了产品研发效率,并减少了错误和返工;•完整的产品结构化信息管理和协作功能使得企业能够根据需要快速地从多个视角掌握产品的所有信息- 不管信息来自何处;•可重复、端到端的研发流程支持及流程自动化提升了流程效率、加快了产品上市速度,并降低了产品成本;•安全、稳定、符合业界标准的 Internet 体系结构带来了安全、高性能的、多层次研发协同的技术平台;Windchill主要应用模块简介:1、产品数据管理(Windchill PDMLink):a) 在产品整个生命周期中,帮助企业管理和控制产品信息,确保数据的准确、安全、可靠、完整、规范、逻辑关系,管理产品开发过程;b) 优化与固化产品研发流程,使得流程能够通过系统来保证规范、一致、严谨;c) 强大的产品结构管理功能,支持产品配置管理;d) 可一完全根据业务特点定制的、工作流驱动式产品开发过程自动化,内置获得CMⅡ认证的变更管理流程;e) 发布管理功能简化了数据的审核和签发(支持数字化签名)。
windchill系统学习之--开发流程

windchill系统学习之--开发流程An Overview of the Windchill Development ProcessVerify The Development Environment:Verify the following environment variables: path ,sqlpathVerify the contents of the following property files: wt.properties ,db.propertiesStart the Windchill servers. Open a new console window.Establish your Rose model directory.Model the Object in Rose:Start Rational Rose and check the virtual path map.WT_WORK = ..\windchill\srcWT_EXTENSIONS = ..\windchill\RoseAddInWT_STD_PACKAGES = $WT_EXTENSIONS\Standard PackagesEstablish the initial Rose model by performing the following steps:a. From the File menu, select Open, browse to ..\windchill\src\wt, andload the model WTDesigner.mdl.b. When asked whether to load subunits, press the Yes button.c. Save the model as ..\windchill\src\helloWorld\HelloWorld.mdl.d. When asked whether to save subunits, press the No button.Model the person class by performing the following steps:a. In the Logical View/Main class diagram, drop in a Package icon and labelit helloWorld.b. Use the dependency tool to draw dependencies from helloWorld to the wtand java packages.c. Go to the Main diagram of the helloWorld package.d. Drop on a class icon and give the class the name Item (the parent forPerson). Attributes and operations for Item automatically appear. Changethe diagram to suppress attributes and operations of Item. Ensure that theShow Visibility option is on for Item (so you can see in the diagram that itcomes from the fc package).e. Drop on another class icon and give it the name Person.f. Make Person a subclass of Item. (Use the generalization icon/tool to drawa line from Person to Item.)g. Insert the attributes name, age, title, and id. Name, title, and id should bestrings (String) and age should be an integer (int). Use lowercase or a mixof upper- and lowercase letters for these attributes; do not use alluppercase letters.2 Right click to start the specification dialog. Make allthe attributes public and change the Windchill property of each toconstrain=false. Click the Apply button for each change and, when youare done, click the OK button.h. Select the menu option Browse > Units. Select the HelloWorld packageand press the Control button. Save the unit to c:\ptc\windchill\src\helloWorld\helloWorld.cat. With the helloWorld package selected, pressthe Save button.i. Save the Rose model file. When asked whether to save subunits, click theNo button.Generate Java Classes From Rose:Go to the parent package of the Person class (by selecting the LogicalView/Main diagram from the class browser, then selecting the helloWorld package).From the Tools menu, select Windchill > System Generation.From the popup window, select Java Source Code, WT Introspector Support, and Database Support, then click the OK button.Create Database Tables:Initialize the Object:Design the GUI Layout:Code the GUI:Run the Applet in Mozilla or Internet Explorer:。
Windchill常用业务对象、目录结构、类、包介绍

常用业务对象、目录结构、类、包介绍文档控制更改记录目录文档控制 (ii)更改记录 (ii)1. Windchill对象介绍 (i)1.1 Windchill目录结构 (i)1.2 Windchill常用业务对象、类 (i)1.3 Windchill常用包 (iii)1.4 如何在Windchlil系统中查找对象对应的类 (iv)1.Windchill对象介绍(会持续更新此文档)1.1Windchill目录结构●wtCustom放入修改系统的rblnfo文件●wtSateArea下的siteMod文件中放入修改后的系统文件,比如.jspf文件、html, xml;ptcCurrent文件放系统当前版本的文件;ptcOrig放系统最原始的文件ant-f bin/swmaint.xml installSiteChanges●bin:windchill工具目录,如windchill shell●src目录放客制化的源文件,放国际化.rblnfo文件。
●codebase是运行时目录,放编译后的.class文件、放WEB相关文件、放模板文件(.html)●netmarkets:JSP文件●tasks目录放系统服务文件.xml文件, Info*Engine配置文件●valuts:文件仓目录●loadFiles目录,放置需要导入到系统的工作流、生命周期等●Logs:日志目录●loadXMLFiles目录,放置配置系统的信息的.xml文件8,DB目录,放置建立模型后生成的SQL语句●db:数据库映射文件及模型SQL脚本1.2Windchill常用业务对象、类业务对象常用类名描述部件wt.part.WTPart 零部件对象部件wt.part.WTPartMaster 部件master对象部件wt.part.WTPartReferenceLink 部件参考关系部件wt.part.WTPartDescribeLink 部件描述关系部件wt.part.WTPartUsageLink 部件使用关系部件wt.part.WTPartAlternateLink 实现wt.fc.ObjectToObjectLink,全局可替换部件wt.part.WTPartSubstituteLink 实现wt.fc.ObjectToObjectLink,特定可替换部件wt.part.LineNumber 行号部件wt.part.Quantity 数量1.3Windchill常用包1.4如何在Windchlil系统中查找对象对应的类方法一:导航到站点-->"类型和属性管理器",选择部件,这个部件就对应了系统中OOTB对象,wt.part是包名,WTPart是类名称方法二:对象的详细页面,浏览器地址中key(OID)的值包含类名+ida2a2,例如:oid=OR%3Awt.part.WTPart%3A222040.。
Windchill二次开发常用API说课讲解

W i n d c h i l l二次开发常用A P I1.1.根据零件名称/编码得到该零件2.wt.clients.prodmgmt.WTPartHelper.findPartByName(name) ;3.wt.clients.prodmgmt.WTPartHelper.findPartByNumber(number);4.2.根据WTpart得到WTparMaster5.WtPart wtpart;6.WTPartMaster wtmaster=(WTPartMster)part.getMaster();7.3.获取codebase下配置文件wt.properties属性信息8.WTProperties wtproperties = WTProperties.getLocalProperties();9.String wthome = wtproperties.getProperty("wt.home", "");//codebase的文件夹路径10.4.获取part被借用的所有父部件11.QueryResult qr=wt.part.WTPartHelper.service.getUsedByWTParts(WTPartMsterwtMaster);12.注:此方法得到的结果为该part被使用情况的全部父部件,包括了Design视图及Manufacturing视图更包括了父部件使用part的所有修订版本,打印出来可以看到会有相同的部件编号,不同的修订版本.13.5.根据OID 获取Wtpart14.wt.fc.WTReference partRef = newwt.fc.ReferenceFactory().getReference( oid );15.WTPart wtpart=(WTPart)partRef;16.6.得到零件最新版本17.WTPart wtpart= (WTPart)VersionControlHelper.getLatestIteration(part);18.7.通过过滤得到零件最新版本19.QuerySpec querysearch = new QuerySpec(WTPartMaster.class);20.//查询所有的WTPartMaster21.QueryResult queryresult =PersistenceHelper.manager.find(querysearch);testConfigSpec latestconfigspec = newLatestConfigSpec();23.//根据WTPartMaster查询所有最新版本的零部件24.QueryResult allWTPart =ConfigHelper.service.filteredIterationsOf(queryresult,latestc onfigspec)25.8.查询某用户某段时间范围内创建的零件26.QuerySpec qs = new QuerySpec(WTPart.class);27.qs.appendSearchCondition(newSearchCondition(WTPart.class,WTPart.CREATE_TIMESTAMP, true,new AttributeRange(begintime, endtime)));//删选条件时间范围内28.qs.appendAnd();//一定要加上不然下一个条件不能删选29.qs.appendSearchCondition(new SearchCondition(WTPart.class,30."iterationInfo.creator.key",SearchCondition.EQUAL,PersistenceHelper.getObjectIdentifier(n ame)));//删选条件用户31.QueryResult qr = PersistenceHelper.manager.find(qs);32.//今后持续更新if (enumUser.hasMoreElements())user = (WTUser) enumUser.nextElement();}if (user == null) {throw new WTException("系统中不存在用户名为'" + name + "'的用户!");}return user;}}10.windchill 中查询,高级查询,基本查询QuerySpec qs = new QuerySpec();//构造Int index = qs.appendClassList(WTPart.class,true);//添加查询类型,获取类型索引,第2个参数表示“要查询的类型、表”WhereExpression where = new SearchCondition(WTPart.class, WTPart.xx, “=”, xx);//泛型在WC API中的使用//获取查询条件数目If(qs.getConditionCount()>0 && qs.getWhere().endsWith(“")){qs.appendAnd();}//添加查询条件qs.appendWhere(where, new int[]{index});//** 以下是联合查询的API范例。
Windchill_介绍

独特的一体化项目管理解决方案,可以提供文档管理,CAD集成、可视化、协同工具、强大的工作流程
Windchill MPMLink
• 制造过程管理 (MPM) 是这样一个过程:定义和管理用于制造零件、 装配成品和执行检查的制造过程。
eBOM
输入
三维CAD 模型
Manufacturing Process
Pro/ENGINEER Workgroup Data Management
Approved Vendor & Manufacturer Lists
Supplier Management
Parts Classification
and re-use
PartsLink
Classification
& Re-Use
• 产品开发流程控制
– 超强的工作流引擎,固化下来可重复和可预测的产品开 发流程
– 基于CMII模型的变更控制流程 – 直观的产品数据配置管理
• 企业范围的产品信息访问
– 随时随地访问产品数据,这是通过基于简单的Web浏览 器界面实现的,而且支持强大的3D可视化数据的浏览
– 与 CAD, MRP, and ERP 等的集成
Windchill PDMLink
覆盖PDS流程 Digital Product Data Management Change Management Configuration Management
提供独特的变更管理和超强的工作流程能力,可进一步与Windchill ProjectLink组合实现一体化的项目管理 和项目知识经验管理
Product Data Management - Windchill PDMLink 在整个企业价值链中控制产品 信息,并且管理关键的产品开发活动
Windchill常用开发大全

模型扩展(续)
生成系统文件,选中docs包
模型扩展(续)
生成系统文件.mData和EleadDocs.java文件
在src目录下自动生成包路径和文件 docs.mData和 EleadDocs.java
模型扩展(续)
系统会自动生成SQL【WT_HOME】 \db\sql3\ext\elead\docs
– 不预留属性
对象建模,不预留属性。对于已有对象的预留属性,因属性名称业务 含义,也不允许使用。历史模型已预留的属性不做要求。 例如:不再使用以前建模留下的reserv1、reserv2等预留属性
设计规范
– 关联关系
两个对象关联时,需要使用模型的关联关系。尽量不要采用建模为两 个独立对象,在一个对象的属性中记录另一个对象的某个标志属性的 方式。 例如: 错误的建模方法:CBBCounter类有一个属性cbbNumber,记录CBB 的编码。 正确的建模方法:引入一个Link对象,记录CBBCounter类和 WTPartMaster类的关系。
模型扩展(续)
测试代码
public void test(){ try{ Person p = Person.newPerson(); p.setName("111"); p.setTitle("222"); p.setAge(1111); p = (Person) PersistenceHelper.manager.save(p); WTPart part = getPartByNumber("D3_0000000064"); if(part==null){ Debug.P("part is null"); return; } PersonLink link = PersonLink.newPersonLink(part, p); link = (PersonLink) PersistenceHelper.manager.save(link); if(link==null){ Debug.P("link is null"); return; } WTPart part1 = link.getUse(); Person p1 = link.getUsed(); if(part1==null){ Debug.P("part1 is null"); }else{ Debug.P("part1 is "+part1.getNumber()); } if(p1==null){ Debug.P("p1 is null"); }else{ Debug.P("p1 is "+p1.getName()); } }catch(Exception e){ e.printStackTrace(); } }
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
类图中尽量保证各部分分布均匀,连线尽量不要交叉,整个类图能够 显示在一个屏幕范围之内(标准1024*768分辨率),对于引用的其他包 的类、接口,可以将其属性、方法隐藏起来。避免占用过大的显示空 间。
建模搭建环境
进入到\Windchill+Information+Modeler091_F000l\Rational_Rose_for_Windows\setup.exe安 装
模型扩展(续)
写测试代码
public class HelloWorldTest {
public static void main(String[] args) { String userName = args[0];
String password = args[1]; RemoteMethodServer methodserver = RemoteMethodServer.getDefault(); methodserver.setUserName(userName); methodserver.setPassword(password); HelloWorldTest test = new HelloWorldTest(); test.test(); }
模型扩展(续)
修改Person.java加入下面的代码 protected void initialize() throws WTException{
Date today = new Date(); super.initialize(); System.out.println("Person - initialize executing!"); String s = String.valueOf(today.toLocaleString()); setId(s); } 然后把person.java和personLink.java这两个文件放到 windchill/codebase/helloWorld/目录下进行编译。
安装完成之后,load注册文件 rational_perm.dat.txt
进入到{WT_HOME}\roseAddIn,将 VirtualPathMap.AddIn.reg和Windchill.AddIn.reg文件中 的路径修订为个人本机环境的路径并注册
建模搭建环境
启动rose,点击“Edit Path Map…”查看注册信息 rose参数配置.txt
wtSafeArea\ptcOrig目录下,修改后的文件另存到wtSafeArea\siteMod目录 – 需要增加的properties属性不要放置在wt.properties中(service的注册除外),其他都放置
在codebase\com\itbg\ext.properties。 – 客制的新增Class文件放置在codebase\com\itbg对应的目录下。不要放在系统原有的包中。
模型扩展(续)
– 选中前3项点OK,然后这个时候你就可以在 windchill/src/helloWorld这个目录下看到有Person.java和 PersonLink.java这2个java文件,并且在 windchill/db/sql3/helloWorld这个目录下面也会产生几个sql文件, 把这几个sql文件导入到数据库中建立相关的表,要注意建立的 先后顺序:只用操作以create开头的3个sql文件
点击Save AS,重新命名为HelloWorld.mdl文件,弹出 框选择No,环境搭建好后,即可创建模型
扩展模型
模型扩展(续)
针对上面的图示,自定义个模型EleadDocs,继承 WTDocument,该模型自定义方法getEleadDocName() 和属性eleadDocType,且将其属性设置constrain=false, 点击保存(遇到提示,点击No)
(除非使用了系统原有的Protected Method,这种用法要尽量避免).
设计规范
设计规范之建模
– 仅对持久化对象建模
只有数据需要保存到数据库中的持久化业务对象才允许进行建模。其 余的操作类(例如:Processor、Delegate、Helper类等) 不被允许进行建模。
– 模型命名规则
对象的名称、属性名称、方法名称应该满足命名规则,同Java编码规 范的类命名、变量命名和方法命名。 例如: 类名 TRApplyDoc 属性名trPhase 方法名getFormData 说明:历史的模型如果要更改将要做数据迁移。因此只要求对新建立 的模型,历史模型不做要求。
生成.ser文件【WT_HOME】\codebase\ext\elead\docs 执行SQL语句
– 进入到 Oracle SQL*Plus路径,执行命令:
– 操作完成之后,即可使用EleadDocs对象了!
模型扩展(续)
模型扩展(续)
完整的例子说明
– 在windchill/src/目录下建立一个helloWorld目录,在 windchill/codebase/目录下也建立一个helloWorld目录
– 不预留属性
对象建模,不预留属性。对于已有对象的预留属性,因属性名称业务 含义,也不允许使用。历史模型已预留的属性不做要求。 例如:不再使用以前建模留下的reserv1、reserv2等预留属性
设计规范
– 关联ቤተ መጻሕፍቲ ባይዱ系
两个对象关联时,需要使用模型的关联关系。尽量不要采用建模为两 个独立对象,在一个对象的属性中记录另一个对象的某个标志属性的 方式。 例如: 错误的建模方法:CBBCounter类有一个属性cbbNumber,记录CBB 的编码。 正确的建模方法:引入一个Link对象,记录CBBCounter类和 WTPartMaster类的关系。
设计规范
– 字段扩展
对于对象的属性,一般情况下采用默认长度。建模时要求考虑属性长 度是否符合要求,如果需要加大长度,在模型中设置相应的值即可。
– 选择父类
对于建模,尽量继承底层的Windchill类,例如:Managed\Item等,继 承上层的具有实际业务含义的Windchill类(例如:WTPart、 WTDocument)时,在业务上符合“是一个(As -is)”的含义,例如: EleadPart是一个WTPart
模型扩展(续)
测试代码
public void test(){ try{ Person p = Person.newPerson(); p.setName("111"); p.setTitle("222"); p.setAge(1111); p = (Person) PersistenceHelper.manager.save(p); WTPart part = getPartByNumber("D3_0000000064"); if(part==null){ Debug.P("part is null"); return; } PersonLink link = PersonLink.newPersonLink(part, p); link = (PersonLink) PersistenceHelper.manager.save(link); if(link==null){ Debug.P("link is null"); return; } WTPart part1 = link.getUse(); Person p1 = link.getUsed(); if(part1==null){ Debug.P("part1 is null"); }else{ Debug.P("part1 is "+part1.getNumber()); } if(p1==null){ Debug.P("p1 is null"); }else{ Debug.P("p1 is "+p1.getName()); } }catch(Exception e){ e.printStackTrace(); } }
模型扩展(续)
打开helloWorld这个package后会出现下图
模型扩展(续)
你打开的时候是什么都没有的,这里面person,personLink这2个类 是自己建立的,可以从中间的那个条中选择到的,然后对这2个类 进行编辑,选中person这个类,点右键,会出现
点击第一个,然后就会出现
– 打开rose软件,依次打开fileopen定位到 windchill/src/wt/WTdesigner.mdl,打开
– 出现这个对话框,选择是,然后就耐心等待系统加载完这个文 件。当完全加载完以后把这个文件保存到上面建立的 windchill/src/helloWorld目录下,名称为helloWorld
– 由于将来系统生产环境是Cluster架构,所以在编写代码时,要尽量避免使用Static的Class 变量,测试环境配置多个Method Server,以防止编写的代码在Cluster环境中运行出现问 题。
– 系统运行的错误信息,要显示在UI界面上,以便用户和系统管理员了解,同时需要在系统 log中记录。
Agenda
Windchill开发内容集合
开发目录介绍 开发环境搭建 Windchill 模型环境搭建 Windchill类的介绍 Windchill各个业务对象的模型介绍 Windchill常用开发类和方法介绍
开发规范
JAVA开发规范,请遵守sun标准
Windchill开发规范
– Debug语句要有开关控制,避免直接使用System.out.println()打印,导致将来的生产环境 产生大量日志。
– 每个客制点之间,设定一个Debug开关,方便自身模块的调试。Debug的开关,缺省值设 置为false。客制点之间的输入和输出部分,需要输出Debug信息,方便客制点之间的调试。