Windchill技术培训笔记_第1页
Windchill技术培训笔记_第2页
Windchill技术培训笔记_第3页
Windchill技术培训笔记_第4页
Windchill技术培训笔记_第5页
已阅读5页,还剩72页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

精品文档 1欢迎下载 搭建搭建 WindchillWindchill 环境环境 开发工具设置开发工具设置 在 Eclipse 中选择 Window Preferences java Compiler Building 去掉 的选中 注意 一定要取消选中 否则在清工作区时将删除 windchill codebase 下的文件 5 此时会在 Eclipse 的工作空间里面生成一个 HelloWindchill 的文件 此文件很小只有 几 KB 创建创建 JavaJava 项目项目 第一种创建方式 1 在 Eclipse 中选择 File New Java Project 创建一个 Test 的 Java 项目 精品文档 2欢迎下载 2 在当前创建的 java 项目 Test 在 Eclipse 中选择 当前项目上 Test New Properties Java Build Path Add Class Folder Create New Folder 精品文档 3欢迎下载 单击 ok 完成 codebase 文件夹的创建和指定 由于 Windchill 的 codebase 文件夹很大 所以这一步骤需要等待片刻 成功之后 将会看到 第二种创建方式 1 在 Eclipse 中选择 File New Java Project 创建一个 TestWindchill 的 Java 项目 Link additional source Browse Finish 2 Browse 选择 codebase 精品文档 4欢迎下载 3 添加自定义的 library 库 精品文档 5欢迎下载 3 指定 codebase 的映射 精品文档 6欢迎下载 3 指定 codebase 文件夹编译之后的 class 文件 和 工程下面的 java 源文件的映射关系 在 Eclipse 中选择 当前项目上 HelloWindchill New Properties Java Build Path Browse 单击 OK 之后 你可能会发现 Java 项目 Referenced Libraries 里面有个 codebase 文 件夹了 精品文档 7欢迎下载 4 添加 Windchill 环境所需的 jar 包 推荐使用 1 D ptc Windchill 9 1 Windchill 里面需要的被导入的 jar 文件按有 lib srclib installlib WHC WEB INF lib ant lib codebase WEB INF lib codebase lib 7 个文件夹下的所有 jar 文件 1 可用自定义一个类库 然后把 Windchill 7 个 lib 下面的 jar 都添加到该库中 以 后就可以在开发中直接引用该类库 注意 最好不要覆盖相同名字的 jar 包 因为他 们的 jar 的文件大小不同 所以作用也不同 避免在开发中因 jar 的冲突和版本问题 而引起些莫名奇妙的错误 在 Eclipse 中选择 当前项目上 HelloWindchill New Properties Java Build Path Libraries 选项卡 2 直接引用 7 个 lib 下面的所有 jar 包 精品文档 8欢迎下载 第一个第一个 HelloHello WorldWorld 创建创建 HelloWorld javaHelloWorld java 在 Eclipse 中选择 当前项目上 HelloWindchill src New Package 精品文档 9欢迎下载 创建一个 TestWindchill java 的类 内容为 packagepackage 精品文档 10欢迎下载 publicpublic classclass TestWindchill param param args publicpublic staticstatic voidvoid main String args TODOTODO Auto generated method stub System out println Hello World 启动启动 WindchillWindchill 服务服务 1 启动 Oracle10g 监听服务 OracleOraDb10g home1TNSListener 2 启动 Oracle10g 主数据库服务 OracleServiceWIND 3 启动 Apache 服务 4 启动 Tomcat 服务 成功标志 精品文档 11欢迎下载 5 启动 control panel bat 服务 D ptc Windchill 9 1 WindchillDS server bat 精品文档 12欢迎下载 6 启动 Windchill Shell 服务 输入 windchill start 目标 D ptc Windchill 9 1 Windchill bin windchill exe shell 起始位置 D ptc Windchill 9 1 Windchill bin 7 观察 Windchill 的两个窗口 精品文档 13欢迎下载 ServerManager MethodServer 8 Windchill 启动成功的标志 在 MethodServer 窗口出现如下标志 表明 Windchill 服务启动成功 运行运行 HelloWorld javaHelloWorld java 1 Eclipse 控制台会打印 Hello World 2 此时会在 Windchill 系统的安装目录 D ptc Windchill 9 1 Windchill codebase 生成如下目录 精品文档 14欢迎下载 angus com 里面会生成 TestWindchill java 源文件的编译后的文件 TestWindchill class 此时表明第一个 Hello World 程序运行成功 3 第一个第一个 JSPJSP 与与 HelloHello WordWord 创建创建 index jspindex jsp 在 Windchill 的安装目录 D ptc Windchill 9 1 Windchill codebase netmarkets jsp 下面新建一个文件 夹 angus 在里面新建一个 index jsp 页面 页面内容为 My JSP index jsp starting page ddd 精品文档 15欢迎下载 创建创建 TestWindchill javaTestWindchill java TestWindchill java 里面的内容 packagepackage publicpublic classclass TestWindchill param param args publicpublic staticstatic voidvoid main String args TODOTODO Auto generated method stub System out println 第一个Windchill程序 publicpublic String helloWindchill returnreturn this is the Hello World Windchill 编译后的 TestWindchill class 文件会自动映射 放到 D ptc Windchill 9 1 Windchill codebase angus com 目录下 注意 该目录下的 TestWindchill class 的更新时间 访问 访问 在浏览器地址栏输入 http localhost Windchill netmarkets jsp angus index jsp 就可以在 Windchill 目录使用 jsp 页面调用 Windchill 目录 java 类的方法 注意 注意 如果你在 TestWindchill java 里面添加了一个方法 然后在 index jsp 中调用 注意一 定要删除 D ptc Windchill 9 1 Windchill codebase angus com 目录下 的 TestWindchill class 文件 然后在 Windchill Shell 中输入 精品文档 16欢迎下载 重启 Windchill 然后重启 Tomcat 再在 浏览器地址栏输入 http localhost Windchill netmarkets jsp angus index jsp 访问 jsp 页面 不然就会报错 WindchillWindchill 菜单定制菜单定制 顶级菜单定制顶级菜单定制 1 在安装的 Windchill 系统的 Windchill Shell 中运行命令 ant f bin swmaint xml createSafeArea 会在 Windchill 的安装 D ptc Windchill 9 1 Windchill wtSafeArea 目录出现 3 个 文件夹 ptcCurrentptcCurrent ptcOrigptcOrig siteModsiteMod 2 在文件夹 siteMod 下创建 codebase config actions 三个文件夹 内嵌结构 3 在 WC Home 安装目录的 actions 文件夹下面添加如下两个 xml 文件 把 custom actionModels xml custom actions xml 两个 xml 文件添加到 wtSafeArea siteMod codebase config actions 目录下 文件一定要是 UTF 8 编码格式的 4 在 custom actionModels xmlcustom actionModels xml 文件里面需要配置如下代码 Example custom actionsModel xmlcustom actionsModel xml 模型文件 模型文件 xmlencoding UTF 8 DOCTYPE actionmodels dtd modelnavigation MainMain navigationnavigation tabs tabs actiontype navigation actiontype navigation actiontype navigation actiontype navigation actiontype navigation actiontype navigation actiontype navigation actiontype navigation actiontype navigation actiontype navigation actiontype navigation 精品文档 17欢迎下载 5 在 custom actions xml 文件里面需要配置如下代码 Example custom actions xmlcustom actions xml 动作文件 动作文件 xmlencoding UTF 8 DOCTYPE actions dtd objecttypeclass actionresourceBundle ext resource navigationRB commandwindowType page 6 Windchill 英文资源文件 里面的代码 navigationRB rbInfonavigationRB rbInfo navigationRB en US rbInfonavigationRB en US rbInfo 存放的位置 D ptc Windchill 9 1 Windchill src ext resource resource 目录是自己建的 名 字 可 以 取 Example navigationRB rbInfonavigationRB rbInfo 英文资源文件 英文资源文件 ResourceInfo class wt tools resource StringResourceInfoResourceInfo class wt tools resource StringResourceInfo ResourceInfo customizable trueResourceInfo customizable true ResourceInfo deprecated falseResourceInfo deprecated false navigation fiberhomereport description value testreportnavigation fiberhomereport description value testreport navigation fiberhomereport activetooltip value testreportnavigation fiberhomereport activetooltip value testreport navigation fiberhomereport tooltip value testreportnavigation fiberhomereport tooltip value testreport 7 Windchill 中文资源文件里面的代码 navigationRB zh CN rbInfonavigationRB zh CN rbInfo 存放的位置 D ptc Windchill 9 1 Windchill src ext resource resource 目录是自己建的 名 字 可 以 精品文档 18欢迎下载 取 Example navigationRB zh CN rbInfonavigationRB zh CN rbInfo 中文资源文件 中文资源文件 ResourceInfo class wt tools resource StringResourceInfoResourceInfo class wt tools resource StringResourceInfo ResourceInfo customizable trueResourceInfo customizable true ResourceInfo deprecated falseResourceInfo deprecated false navigation fiberhomereport tooltip value u62a5 u8868navigation fiberhomereport tooltip value u62a5 u8868 navigation fiberhomereport description value u62a5 u8868navigation fiberhomereport description value u62a5 u8868 navigation fiberhomereport activetooltip value u62a5 u8868navigation fiberhomereport activetooltip value u62a5 u8868 8 在 Windchill Shell 下面运行 Resourcebuild ext resource navigationRB 或 Resourcebuild ext resource navigationRB zh CN ant f bin swmaint xml installSiteChanges 1 清除 Tomcat 下面的缓存 D ptc Windchill 9 1 Tomcat work 2 清除资源文件编译后目录 D ptc Windchill 9 1 Windchill codebase ext resource 3 清除 IE 缓存 历史记录 cookies 4 清除 xml 文件的编译目录 D ptc Windchill 9 1 Windchill codebase config actions 5 查看 Windchill 的日子记录 D ptc Windchill 9 1 Windchill logs WindchillWindchill 重新启动成功的标志重新启动成功的标志 3min 左右 INFO wt method server startup MethodServer ready in 42 063 secs 9 显示效果如图 二级菜单定制二级菜单定制 精品文档 19欢迎下载 1 二级菜单的定制 跟上面顶级菜单的定制差不多 主要涉及的文件也是 4 个 2 个 xml 2 个资源文件 为 了测试二级菜单是否成功 我们需要在 Windchill 中访问 Jsp 页面 change record jspchange record jsp show Archive record jspshow Archive record jsp 只是里面的代码有所不同 添加代码之后再 Windchill Shell 里面运行的命令也是一样的 注意 文件一定要是 UTF 8 编码格式的 2 配置 2 级菜单在 wtSafeArea siteMod codebase config actions 目录下 custom actionModels xmlcustom actionModels xml 文件里面添加的代码为 Example custom actionsModel xmlcustom actionsModel xml 模型文件 模型文件 xmlencoding UTF 8 DOCTYPE actionmodels dtd modeldefaultActionName ChangeReports actiontype fiberhomereport actiontype fiberhomereport 3 配置 2 级菜单在 wtSafeArea siteMod codebase config actions 目录下 custom actions xmlcustom actions xml 文件里面添加的代码为 Example custom actions xmlcustom actions xml 动作文件 动作文件 xmlencoding UTF 8 DOCTYPE actions dtd objecttyperesourceBundle ext resource navigationRB actionname ChangeReports commandwindowType page actionname ArchiveReports commandwindowType page 4 配置 2 级菜单在 D ptc Windchill 9 1 Windchill src ext resource 目录下 navigationRB rbInfonavigationRB rbInfo navigationRB en US rbInfonavigationRB en US rbInfo 英文资源文件里面添加的代码为 Example navigationRB rbInfonavigationRB rbInfo 英文资源文件 英文资源文件 精品文档 20欢迎下载 ResourceInfo class wt tools resource StringResourceInfoResourceInfo class wt tools resource StringResourceInfo ResourceInfo customizable trueResourceInfo customizable true ResourceInfo deprecated falseResourceInfo deprecated false fiberhomereport ChangeReports description value Globalfiberhomereport ChangeReports description value Global ChangeChange statisticsstatistics fiberhomereport ChangeReports tooltip value Globalfiberhomereport ChangeReports tooltip value Global ChangeChange statisticsstatistics fiberhomereport ArchiveReports description value Archivefiberhomereport ArchiveReports description value Archive DrawingDrawing statisticsstatistics fiberhomereport ArchiveReports tooltip value Archivefiberhomereport ArchiveReports tooltip value Archive DrawingDrawing statisticsstatistics 5 配置 2 级菜单在 D ptc Windchill 9 1 Windchill src ext resource 目录下 navigationRB zh CN rbInfonavigationRB zh CN rbInfo 中文资源文件里面添加的代码为 Example navigationRB zh CN rbInfonavigationRB zh CN rbInfo 中文资源文件 中文资源文件 ResourceInfo class wt tools resource StringResourceInfoResourceInfo class wt tools resource StringResourceInfo ResourceInfo customizable trueResourceInfo customizable true ResourceInfo deprecated falseResourceInfo deprecated false fiberhomereport ChangeReports description value u5168 u5c40 u53d8 u66f4 u7edf u8ba1 u62a5 u8868fiberhomereport ChangeReports description value u5168 u5c40 u53d8 u66f4 u7edf u8ba1 u62a5 u8868 fiberhomereport ChangeReports tooltip value u5168 u5c40 u53d8 u66f4 u7edf u8ba1 u62a5 u8868fiberhomereport ChangeReports tooltip value u5168 u5c40 u53d8 u66f4 u7edf u8ba1 u62a5 u8868 fiberhomereport ArchiveReports description value u5f52 u6863 u5de5 u7a0b u56fe u7edf u8ba1 u62a5 u8868fiberhomereport ArchiveReports description value u5f52 u6863 u5de5 u7a0b u56fe u7edf u8ba1 u62a5 u8868 fiberhomereport ArchiveReports tooltip value u5f52 u6863 u5de5 u7a0b u56fe u7edf u8ba1 u62a5 u8868fiberhomereport ArchiveReports tooltip value u5f52 u6863 u5de5 u7a0b u56fe u7edf u8ba1 u62a5 u8868 6 为了测试二级菜单是否新建成功 我们需要在 Windchill 安装系统 codebase netmarkets jsp 目录新 建几个 Jsp 文件 如下在 D ptc Windchill 9 1 Windchill codebase netmarkets jsp angus report 目录下面新建 change record jspchange record jsp show Archive record jspshow Archive record jsp 两个 Jsp 页面 jsp 页面的内容为 file netmarkets jsp util begin jspf WindchillWindchill testtest file netmarkets jsp util end jspf 7 在 Windchill Shell 下面运行 Resourcebuild ext resource navigationRB 或 Resourcebuild ext resource navigationRB zh CN ant f bin swmaint xml installSiteChanges 精品文档 21欢迎下载 1 清除 Tomcat 下面的缓存 D ptc Windchill 9 1 Tomcat work 2 清除资源文件编译后目录 D ptc Windchill 9 1 Windchill codebase ext resource 3 清除 IE 缓存 历史记录 cookies 4 查看 Windchill 的日子记录 D ptc Windchill 9 1 Windchill logs Windchill 重新启动成功的标志 3min 左右 INFO wt method server startup MethodServer ready in 42 063 secs 8 显示效果如图 ActionAction 下拉菜单下拉菜单 1 Action 下拉菜单的定制 跟上面二级菜单的定制差不多 主要涉及的文件也是 4 个 2 个 xml 2 个资源文件 添加代码之后再 Windchill Shell 里面运行的命令也是一样 的 注意 文件一定要是 UTF 8 编码格式的 2 定制 Action 下拉菜单在 wtSafeArea siteMod codebase config actions 目录下 custom actionModels xmlcustom actionModels xml 文件里面添加的代码为 Example custom actionsModel xmlcustom actionsModel xml 模型文件 模型文件 xmlencoding UTF 8 DOCTYPE actionmodels dtd modelmenufor wt part WTPart actiontype part actiontype part 精品文档 22欢迎下载 3 定制 Action 下拉菜单在 wtSafeArea siteMod codebase config actions 目录下 custom actions xmlcustom actions xml 文件里面添加的代码为 Example custom actions xmlcustom actions xml 动作文件 动作文件 xmlencoding UTF 8 DOCTYPE actions dtd objecttypename part actionresourceBundle ext resource navigationRB commandmethod netmarkets jsp angus report show Archive record jsp action ExportBom actionresourceBundle ext resource navigationRB commandmethod netmarkets jsp angus report show Archive record jsp action ExportData 4 定制 Action 下拉菜单在 D ptc Windchill 9 1 Windchill src ext resource 目录 下 navigationRB rbInfonavigationRB rbInfo navigationRB en US rbInfonavigationRB en US rbInfo 英文资源文件里面添加的代码 为 Example navigationRB rbInfonavigationRB rbInfo 英文资源文件 英文资源文件 ResourceInfo class wt tools resource StringResourceInfoResourceInfo class wt tools resource StringResourceInfo ResourceInfo customizable trueResourceInfo customizable true ResourceInfo deprecated falseResourceInfo deprecated false part ExportBom description value ExportBompart ExportBom description value ExportBom part ExportBom tooltip value ExportBompart ExportBom tooltip value ExportBom part ExportData description value ExportDatapart ExportData description value ExportData part ExportData tooltip value ExportDatapart ExportData tooltip value ExportData 5 定制 Action 下拉菜单在 D ptc Windchill 9 1 Windchill src ext resource 目录 下 navigationRB zh CN rbInfonavigationRB zh CN rbInfo 中文资源文件里面添加的代码为 Example navigationRB zh CN rbInfonavigationRB zh CN rbInfo 中文资源文件 中文资源文件 精品文档 23欢迎下载 ResourceInfo class wt tools resource StringResourceInfoResourceInfo class wt tools resource StringResourceInfo ResourceInfo customizable trueResourceInfo customizable true ResourceInfo deprecated falseResourceInfo deprecated false part ExportBom description value u5bfc u51fa u7269 u6599part ExportBom description value u5bfc u51fa u7269 u6599 part ExportBom tooltip value u5bfc u51fa u7269 u6599part ExportBom tooltip value u5bfc u51fa u7269 u6599 part ExportData description value u5bfc u51fa u6570 u636epart ExportData description value u5bfc u51fa u6570 u636e part ExportData tooltip value u5bfc u51fa u6570 u636epart ExportData tooltip value u5bfc u51fa u6570 u636e 6 在 Windchill Shell 下面运行 Resourcebuild ext resource navigationRB 或 Resourcebuild ext resource navigationRB zh CN ant f bin swmaint xml installSiteChanges windchill stop importimport wt fc PersistenceHelper importimport wt fc QueryResult importimport wt method RemoteAccess importimport wt part WTPart importimport wt pds StatementSpec importimport wt query QuerySpec importimport wt util WTException publicpublic classclass JCATest implementsimplements RemoteAccess author author bob he 取得所有部件 return return 部件的查询类型 throws throws WTException publicpublic staticstatic QueryResult findPart throwsthrows WTException QuerySpec qs newnew QuerySpec WTPart classclass returnreturn PersistenceHelper manager find StatementSpec qs publicpublic staticstatic voidvoid main String args trytry System out println JCATest findPart 精品文档 40欢迎下载 catchcatch WTException e TODOTODO Auto generated catch block e printStackTrace ValidateValidate 验证 验证 JavaJava 文件 文件 1 在 Java 类中写 packagepackage importimport java util Locale importimport wt org WTPrincipal importimport wt session SessionHelper importimport wt util WTException importimport com ptc core ui validation UIValidationResult importimport com ptc core ui validation DefaultUIComponentValidator importimport com ptc core ui validation UIValidationCriteria importimport com ptc core ui validation UIValidationKey importimport com ptc core ui validation UIValidationResultSet importimport com ptc core ui validation UIValidationStatus Windchill验证定制 author author angus publicpublic classclass Validate extendsextends DefaultUIComponentValidator 处理多个Action的的验证 param param UIValidationKey 要验证的action param param UIValidationCriteria 验证标志实体类 精品文档 41欢迎下载 param param Locale 本地化的 Override publicpublic UIValidationResultSet performFullPreValidation UIValidationKey actionKey UIValidationCriteria criteria Locale locale throwsthrows WTException TODOTODO Auto generated method stub 获得参与者 WTPrincipal wtp SessionHelper manager getPrincipal 获得验证结果 UIValidationResultSet rs newnew UIValidationResultSet 判断参与者是不是管理员 ifif Administrator equals wtp getName 显示菜单 rs addResult newnew UIValidationResult actionKey UIValidationStatus ENABLED elseelse 隐藏菜单 rs addResult newnew UIValidationResult actionKey UIValidationStatus HIDDEN returnreturn rs 2 dd 3 ddddd RegisterRegister serveserve 1 在 Windchill Shell 下面使用 xconfmanager 命令注册 Validate 类 xconfmanager s wt services svc default com ptc core ui validation UIComponentValidator report 自定义的 action 名称 null 0 Validate duplicate t codebase service properties p 2 注册成功之后 你会在 WT HOME Windchill site xconf 文件中找到 Propertyvalue Validate duplicate WT HOME Windchill codebase service properties文件中找到 wt services svc default com ptc core ui validation UIComponentValidator fiberhomereport null 0 Validate duplicatewt services svc default com ptc core ui validation UIComponentValidator fiberhomereport null 0 Validate duplicate ListenListen 监听 监听 ListenListen InterfaceInterface 1 编写一个监听接口 ListenService java packagepackage 空接口 什么也不做 这是实现监听必须实现的接口 Description author author angus liu time time May 03 2011 6 08 24 PM version version 1 0 publicpublic interfaceinterface ListenerService 定义一个监听接口的目的 是为了更灵活的扩充自定义监听事件的方法 2 ddddd ListenListen ClassClass 1 自定义一个类 使他继承 wt 的StandardManager类 实现ListenerService接口 packagepackage importimport wt doc WTDocument 精品文档 43欢迎下载 importimport wt events KeyedEvent importimport wt events KeyedEventListener importimport wt fc PersistenceManagerEvent importimport wt services ServiceEventListenerAdapter importimport wt services StandardManager importimport wt util DebugProperties importimport wt util DebugWriter importimport wt util WTException author author angus publicpublic classclass TestListener extendsextends StandardManager implementsimplements ListenerService privateprivate staticstatic finalfinal longlong serialVersionUID 1L 获取监听器类的名称 privateprivate staticstatic finalfinal String CLASSNAME TestListener classclass getName 定义一个接受监听事件中的DEBUG变量 privateprivate staticstatic finalfinal booleanboolean DEBUG DebugProperties isDebugOn CLASSNAME 把监听到的BEBUG输出到DEBUG日志文件当中 privateprivate staticstatic finalfinal DebugWriter LOG DEBUG DebugProperties getWriter CLASSNAME nullnull privateprivate KeyedEventListener listener 定义一个接受当前类的 名称方法 publicpublic String getConceptualClassName returnreturn CLASSNAME 创建监听实例 return return 监听实例对象 throws throws WTException protectedprotected staticstatic TestListener newTestListenerInstance throwsthrows WTException

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论