AXAPTA开发心得v.ppt_第1页
AXAPTA开发心得v.ppt_第2页
AXAPTA开发心得v.ppt_第3页
AXAPTA开发心得v.ppt_第4页
AXAPTA开发心得v.ppt_第5页
已阅读5页,还剩54页未读 继续免费阅读

下载本文档

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

文档简介

,AXAPTA开发心得,NAME:,2005-11-11,Axapta支持的平台及DB,Axapta3.0支持的国家及语言,AXAPTA 推荐的命名规则,Naming conventions (命名规则) Naming conventions contribute to consistency and to making the application easier to understand. The general Axapta naming conventions that apply to all application objects are described below.(命名规则是为了规范及使程序容易理解.在下面所描述的规则是应用于Axapta的所有应用程序对象的.) For specific naming standards of the various application objects, see their specific topics.(对于不同应用对象的特殊的命名标准,看他们各自的特殊说明主题.),General rules(一般规则) All names must be in US English.(所有的名字都应该是美式英文) Names in the AOT and in X+ code must correspond to the names in the US user interface.(名字在AOT和在X+代码里必须符合美式用户的界面.) Names must be logical and descriptive. The default rule is to name logically and descriptively, so if no other specialized rule apply; name logically and descriptively. (),Names must be spelled correctly.(名字必须拼写正确.) If a logical name has been given and used in a special meaning, make sure the same logical name is used on every occasion where a name has the same meaning.() Names must be used consistently. All texts that appear in the user interface must be defined using a label. (This rule applies only if you want your solution certified as an international solution.) Each paths in the Application Object Tree must be unique. This means that nodes with identical names must not exist.,Upper or lower case (大小写规则) The name of an application object is given in mixed case with an uppercase first letter and the first letter of each internal word capitalized.(一个应用程序对象的名字是大小写混写的单词即第一个是大写字符和每个单词的首字都是大写.) The name of a member (a method, a variable or a table field) is given in mixed case with a lowercase first letter and the first letter of each internal word capitalized.(对于 “Method,Variable or Table field”也是大小写混写:以第一个小写字母开头.和每个内部单词的首字大写的规则.),System functions are treated as other methods, that is, a lower case first letter.(系统函数也被加工成像其它方法一样,是一个小写字母开头.) The name of a primitive type is given in lowercase. Examples: str, date, int, real, void, boolean.true, false, null.(基本类型是以小写字母来书写的.如: str, date, int, real, void, boolean.true, false, null) Reserved words in the X+ language are treated as other methods. Examples: if, while, for, select, ttsCommit. (The reserved words are listed below the System Documentation node in the Application Object Tree.)(保留字也应该一样第一个字母是小写加上其内部单词以大写字母书写,如if, while, for, select, ttsCommit),Abbreviations(缩写规则) Use whole words. Avoid abbreviations unless the abbreviation is much more widely used than the long form, such as URL or HTML.(避免使用整个单词作缩写,除非这样的缩写是非常广泛使用的.如URL or HTML.) If you need an abbreviation, you must comply to the rules stated below.(如果你需要使用缩写,你必需遵守以下声明的规则) Consistency: if you apply an abbreviation, this abbreviation should be used everywhere in place of the name, and there should be no more than one abbreviation for a name. Recognition: the abbreviation should be commonly recognized and understood (at least by Axapta users).,Prefixes(前缀) A business area specific application object is prefixed with the name of the business area the object belongs to, for example Cust*, Invent*, Ledger*, Proj*, Vend*. The “DEL_” prefix (DEL_前缀): Name structure Where possible, application object names should be constructed hierarchically from three basic components: business area name + business area description + action performed (for classes) or type of contents (for tables),Underscore (下画线) The underscore character (“_“) can be used in the following situations: When naming formal parameters, it should be used as the first character. (形参的第一个字符应该是一个下画线.) In the DEL_ prefix. A sub class can be named as its super class post fixed with the underscore character and a logical name describing the sub class specialization, if the name of the super class has to be shortened (basically to keep the name within the IndentifierName limitation (p.t. str 40 ). The underscore here acts as the period you normally apply after an abbreviated name.,Do not use underscore(不要使用下画线的地方) in the beginning of application object names(在应用对象名字的开头) as the first character of variable names in class declarations or methods (在类或者是方法内的变量名的第一个字符.) at the end of variable names in class declarations or methods(在类或者是方法的最后一个字符.) Parameters The names of the formal parameters in methods must be prefixed with an underscore(在方法中的形参的第一个字必须是下画线.),Zero or one space before the parenthesis? Use no space before the starting parenthesis in method declarations and calls.(在方法的定义时括号前不加空格.) Use not space between a methods name and and the argument parenthesis.(在方法名字和变量名之内部不加入空格.) Use one space between if, switch, for, while and the expressions starting parenthesis.(对于 if, switch, for, while这些语法和其后面的括号之间要加入一个空格.),The Nine Steps of Application Development (创建应用程序的九个步骤),Conceptualization: understand the problem.(概念化:理解问题,即撑握需求.) Create Extended Data Types based on the primitive data types and Base Enums.(基于原始的扩展类型或枚举类型创建扩展类型.) Create tables to hold your data.(创建表来存放数据.) Create classes for handling business procedures.(创建处理业务逻辑的类.) Create forms for interacting with the user.(创建用于交互的窗体.) Create reports to extract information and present surveys.(创建报表用于筛选数据和预测.) Create menus and menu items for accessing the functionality in your application.(创访问程序的建菜单和菜单项) Setup system security.(设置系统安全.) Write help information.(写帮助文档.),创建一个FORM,在一个类里 static void main(Args args) PWS_ExportQuery _PWS_ExportQuery; args preargs,frmargs; Object formRun; ; preargs = new args(formstr(PWS_GoldenTaxQuery);/应该要有设计 PWS_GoldenTaxQuery的FORM。 preargs.caller(); /呼叫这个FORM。 formRun = classFactory.formRunClass(preargs); /再将呼叫完的FORM赋给FORMRUN。 formRun.init(); /执行FORM 的操作。 formRun.run(); formRun.wait(); frmargs = new args(formstr(PWS_GoldenTax); frmargs.caller(); formRun = classFactory.formRunClass(frmargs); formRun.init(); formRun.run(); formRun.wait(); ,打开一个FORM时所执行方法的顺序,The new constructor on the form is activated. The init method on the form is activated. The init method on the form data source is activated. The run method on the form is activated. The executeQuery method on the form data source is activated. The firstField method on the form is activated.,关闭一个FORM所执行方法的顺序,当按Cancel关闭时的执行顺序: The closeCancel method on the form is activated. The canClose method on the form is activated. The close method on the form is activated. 当按关闭按钮或者是OK按钮时执行顺序 如果是按OK按钮关闭窗口则closeOK 会被运行,但如果是按关闭按钮closeOK 这个方法则不会执行. The canClose method on the form is executed The leave control sequence is executed. The leave method on the control is executed. The validate method on the control is executed. The validate method on the data source is executed. The validateField method on the table is executed. The modified method on the control is executed. The modified method on the data source is executed. The leave record sequence is executed, if an actual database record is in fact exited. The validateWrite method on the data source is executed. The write method on the data source is executed. The insert (if it is a new record), or the update (if it is an existing record) method on the table is executed. The close method on the form is executed.,离开一个控件时的方法执行顺序,The leave method on the control is executed. The validate method on the control is executed. The validate method on the data source is executed. The validateField method on the table is executed. The modified method on the control is executed. The modified method on the data source is executed.,离开一条记录时的方法执行顺序,The validateWrite method on the data source is executed. The write method on the data source is executed. The insert (if it is a new record), or the update (if it is an existing record) method on the table is executed.,创建一条记录时的方法执行顺序,create on the data source is executed. initValue on the data source is executed. initValue on the table is executed.,删除一条记录时的方法执行顺序,delete on the data source is executed. validateDelete on the data source is executed. If validateDelete returns true . validateDelete on the table is executed. If validateDelete returns true. The record is then re-read from the database by the kernel. Unless the record is deleted or updated by another user, then. delete on the table is executed.,自动行编号的新增,首先自动行编号的新增这需要TABLE和FORM结合才能做到. 对于FORM将相应的表作为数据源拉进来,在数据源的CounterField属性选上要自动编号的字段. 在TABLE上需要对那个想做自动行编号的字段做索引文件.下面举例:,自动行编号的字段,添加数据源,重载方法.,对于FORM的里的数据源的Create方法进行重载,重载成如下:,改写上面的东西就可以了. public void create(boolean _append = True) super(_append); ,同一表的多条从记录显示在一个 窗体的不同位置的做法,欲达到的效果如下:,如上红色框所示物料档窗体“数量”页签的 “采购订单”,“库存”,“销售订单”三组的资料是同一个表,但却是三条不同的记录。只是这三条记录都是跟主表有关联的。,例子:My_InventTable(最后的效果),这三个数据源是对应同一个表的,这里以InventTableModule,这个表作例子.,这是窗体的主数据源,数据源的属性设置:对于这三个从数据源的属性除名字其设置是一样的.,数据源名称.,真正表名,索引可不加,但加了可以提速,在这个方法里要定义一些QueryBuildRange.因为这里有三个相同的数据源,所以要定义三个.详见下.,这里是要关联的主表.及联接类型.,这两个属性也设为一致.,对于Purch,Invent,Sales三个数据源,都要有一Init的方法.来初始化不一样的资料,因为这些数据是在同一张表里,但是显示的信息是因不同位置而不同的.,void init() super(); criteriaPurch = this.query().dataSourceName(“Purch“).addRange(FieldNum(InventTableModule,ModuleType); criteriaPurch.value(queryValue(ModuleInventPurchSales:Purch); /这里是上面范围的值. criteriaPurch.status(RangeStatus:HIDDEN); this.query().dataSourceName(“Purch“).addSortindex(indexNum(InventTableModule,ItemModuleIdx); this.query().dataSourceName(“Purch“).indexIsHint(true); /上面这两句是指定索引,用以加速. ,下面是Purch这个数据源的Init的方法.,只要对三个数据源进行同样的操作就可以了.,在数据源中选择多条记录的处理,Example On a form with a data source named xRefReferences, the following could be found: void clicked() xRefReferences xRefReferencesEdit; / are there any marked records - for (xRefReferencesEdit = xRefReferences_ds.getFirst(1) ? xRefReferences_ds.getFirst(1) : /if yes, get the first marked record xRefReferences; /else, use the current record / continue as long as there are records to work on xRefReferencesEdit; / get the potential next marked record xRefReferencesEdit = xRefReferences_ds.getNext() / do processing with xRefReferencesEdit . ,创建一个Number sequence,创建一个Number sequence 所需要用到的对象: 新建一个要捆绑Number sequence 的扩展数据类型. 将要产生自动编号的表的主字段的扩展类型设为与Number sequence 捆绑的扩展数据类型. 在那个表所属的模块的Number sequence 类(如:NumberSeqReference_MyModule)中新增设置Number sequence 的加载模块. 在所属模块的参数表里加入NumberSeqReference的方法. 进入到相应模块的参数FORM里NumberSeqReference编号组设上去就可以了.,新建一个要捆绑Number sequence 的扩展数据类型. 与创建普通的扩展数据类型一样.以my_prodId(type:str20) 将要产生自动编号的表的主字段的扩展类型设为与Number sequence 捆绑的扩展数据类型. 创建一个my_Table的表.有一个字段:ID(扩展类型为:my_Id) 在这个表的initVaule方法里,在那个表所属的模块的Number sequence 类(如:NumberSeqReference_MyModule)中新增设置Number sequence 的加载模块.,在所属模块的参数表里加入NumberSeqReference的方法.,进入到相应模块的参数FORM里NumberSeqReference编号组设上去就可以了.,将代码从一个层移到另一个层中:,(1).以要被移动的那一层登录到AXAPTA中. (2).将要移动的代码用(Export)导出,并将相应的数据表的内容导出来.备份用. (3).将要移动的代码删除.并同步相应的表 (4).退出AXAPTA (5).以要移入的层登录AXAPTA. (6).将在第2步所导出的代码导入.同步相关的数据表;并将相应的数据导入.,将一个表从一个层移至另一个中并保留数据,(1).以要被移动的层登录到AXAPTA (2).将表的数据导出(以二进制形式导出) (3).将要移动的表的代码导出. (4).将要移动的表删除. (5).退出AXAPTA. (6).再以你移动的层登录到AXAPTA. (7).将在第3步中导出的代码导进来,并同步表. (8).将第2步导出的数据导入进来.,Use debugger shortcut keys使用调试器的快捷键,fundamental classes(基本类),Session Application Company Site Info ClassFactory Global,fundamental classes(基本类),Session Application Company Site Info ClassFactory Global,Session,Use Session to get information about the current session.(用Session可以获得当前的会话.) The Session methods fall into these categories: Client information Login time The sessionId() and the Session class give unique information on a user. Also, use global.isSessionActive(). Where to use the Session class Use the Session class to get unique identification of the current session, or information about the client.,fundamental classes(基本类),Session Application Company Site Info ClassFactory Global,Application,The Application methods fall into these categories:(Application 有被分成如下的一些分类:) Database log logDelete logInsert logUpdate Number sequence control resetNumberSeqAutoAbort numberSeqAutoClean TTS control User log updateUserLog:记录用户的日记,是在startup方法里调用的. Startup method :这个方法是AX在启动时第一个被调用的.用来初始化一些变量. startupCommand这个参数传递的是从AX配置框里startupCommand 框里填入的.有几种参数: SetBuildNo, UpdateBuildNo, Synchronize, Batch, compileAll, Exit, AOTImport, ApplUpgrade,Edit方法的使用,Edit方法是Display方法的扩展他既用于显示也用于接受用户的输入. Edit方法使用的地方: Table 里的方法. Form的方法. Form 数据源的方法. Edit方法用在Table里的例子: edit FreeTxt TxtDefault(boolean Set, FreeTxt Txt) 第一个参数是布尔类型的参数. 第二个是要返回与要接受用户数据的参数. Edit方法使用在窗体时数据源时: edit Amount Settle(boolean set, CustTrans _CustTrans, Amount U),标准 lookup form的组成:,TitleField1 from the related table(关联的表的标题字段1) TitleField2 from the related table(关联的表的标题字段2) The fields making up the relation(所关联的字段) 注:如果有显示的字段有重复的话则只显示其中一个.,用自定义的lookup 窗体来代替标准,重载Lookup方法. 创建自已的Lookup 窗体. 使用AutoLookup 字段组.,创建一个运行时的(runtime)的lookup 窗体,在Design要查找控件的lookup方法里加入如下的代码: /Create a new instance of SysTableLookup where this is the current form control SysTableLookup sysTableLookup = SysTableLookup:newParameters(tableNum(custTable), this); /Add the fields to be shown in the lookup form sysTableLookup.addLookupField(fieldNum(custTable, accountNum); /Limit the data selection. queryBuildDataSource = query.addDataSource(tableNum(custTable); queryBuildRange = queryBuildDataSource.addRange(fieldNum(custTable, accountNum); queryBuildRange.value(AB); sysTableLookup.parmQuery(query); /Perform the lookup, and delete super(). /super() will create an autogenerated lookup form. sysTableLookup.performFormLookup(); / super() 可以看如下的例子: FormsDocuTypeDesignsDesignTab:TabTabPage:OverviewGrid:GridStringEdit:ActionClassNameMethods. lookup,在窗体中添加进度条的例子,效果如:,设计如:,优化窗体的性能:,Use bitmaps and other graphic objects sparingly.(尽量少使用位图和其他图形对象.) Use black-and-white rather than color bitmaps.(尽量使用黑白而不使用彩色的图像.) Close forms that are not being used.(不使用窗体时关闭他.) If the underlying record source includes many records and you want to use the form primarily to enter new records,set the StartPosition property of the form to Last so that the form opens to a blank record. If you open a form with all records showing, Axapta has to read in each record before it can display the blank record at the end of the recordset.(如果窗体的主要作用是新增记录并且数据源的记录比较多的话,则数据源的StartPosition属性设为Last. Do not use the Visible property method(exists on all controls) on controls each time a new record becomes active. This operation will make MorphX re-arrange the entire form.(不要设置所有控件的Visible 属性,因为每次一条新的记录激活时.MorphX会将整个窗体重新排列一遍.),打印报表任务在Server上执行,当用户以3-tier,thin 客户端登录打印报表时,报表是可以在打印在客户端或者是服务器端. 如果想在服务器端打印报表则需进行如下的配置: 在AOS的配置里 将 “Allow clients to use printers on the server.”打勾.默认情况是不打勾的. 在客户端的配置页里将 “Use printers on the server (only possible if server allows it)” 打勾.,Events executing sequence on reports,When you open a report by selecting Open in the short cut menu, the following sequence of events occurs: First the Init method on the report is activated to initialize the report. The Run method on the report is activated. The Prompt method on the report is activated to allow the user to interact with the report. The Fetch method on the report is activated. To see which methods are activated by Fetch, click . T

温馨提示

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

最新文档

评论

0/150

提交评论