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推荐的命名规则,Namingconventions(命名规则)Namingconventionscontributetoconsistencyandtomakingtheapplicationeasiertounderstand.ThegeneralAxaptanamingconventionsthatapplytoallapplicationobjectsaredescribedbelow.(命名规则是为了规范及使程序容易理解.在下面所描述的规则是应用于Axapta的所有应用程序对象的.)Forspecificnamingstandardsofthevariousapplicationobjects,seetheirspecifictopics.(对于不同应用对象的特殊的命名标准,看他们各自的特殊说明主题.),Generalrules(一般规则)AllnamesmustbeinUSEnglish.(所有的名字都应该是美式英文)NamesintheAOTandinX+codemustcorrespondtothenamesintheUSuserinterface.(名字在AOT和在X+代码里必须符合美式用户的界面.)Namesmustbelogicalanddescriptive.Thedefaultruleistonamelogicallyanddescriptively,soifnootherspecializedruleapply;namelogicallyanddescriptively.(),Namesmustbespelledcorrectly.(名字必须拼写正确.)Ifalogicalnamehasbeengivenandusedinaspecialmeaning,makesurethesamelogicalnameisusedoneveryoccasionwhereanamehasthesamemeaning.()Namesmustbeusedconsistently.Alltextsthatappearintheuserinterfacemustbedefinedusingalabel.(Thisruleappliesonlyifyouwantyoursolutioncertifiedasaninternationalsolution.)EachpathsintheApplicationObjectTreemustbeunique.Thismeansthatnodeswithidenticalnamesmustnotexist.,Upperorlowercase(大小写规则)Thenameofanapplicationobjectisgiveninmixedcasewithanuppercasefirstletterandthefirstletterofeachinternalwordcapitalized.(一个应用程序对象的名字是大小写混写的单词即第一个是大写字符和每个单词的首字都是大写.)Thenameofamember(amethod,avariableoratablefield)isgiveninmixedcasewithalowercasefirstletterandthefirstletterofeachinternalwordcapitalized.(对于“Method,VariableorTablefield”也是大小写混写:以第一个小写字母开头.和每个内部单词的首字大写的规则.),Systemfunctionsaretreatedasothermethods,thatis,alowercasefirstletter.(系统函数也被加工成像其它方法一样,是一个小写字母开头.)Thenameofaprimitivetypeisgiveninlowercase.Examples:str,date,int,real,void,boolean.true,false,null.(基本类型是以小写字母来书写的.如:str,date,int,real,void,boolean.true,false,null)ReservedwordsintheX+languagearetreatedasothermethods.Examples:if,while,for,select,ttsCommit.(ThereservedwordsarelistedbelowtheSystemDocumentationnodeintheApplicationObjectTree.)(保留字也应该一样第一个字母是小写加上其内部单词以大写字母书写,如if,while,for,select,ttsCommit),Abbreviations(缩写规则)Usewholewords.Avoidabbreviationsunlesstheabbreviationismuchmorewidelyusedthanthelongform,suchasURLorHTML.(避免使用整个单词作缩写,除非这样的缩写是非常广泛使用的.如URLorHTML.)Ifyouneedanabbreviation,youmustcomplytotherulesstatedbelow.(如果你需要使用缩写,你必需遵守以下声明的规则)Consistency:ifyouapplyanabbreviation,thisabbreviationshouldbeusedeverywhereinplaceofthename,andthereshouldbenomorethanoneabbreviationforaname.Recognition:theabbreviationshouldbecommonlyrecognizedandunderstood(atleastbyAxaptausers).,Prefixes(前缀)Abusinessareaspecificapplicationobjectisprefixedwiththenameofthebusinessareatheobjectbelongsto,forexampleCust*,Invent*,Ledger*,Proj*,Vend*.The“DEL_”prefix(DEL_前缀):NamestructureWherepossible,applicationobjectnamesshouldbeconstructedhierarchicallyfromthreebasiccomponents:businessareaname+businessareadescription+actionperformed(forclasses)ortypeofcontents(fortables),Underscore(下画线)Theunderscorecharacter(_)canbeusedinthefollowingsituations:Whennamingformalparameters,itshouldbeusedasthefirstcharacter.(形参的第一个字符应该是一个下画线.)IntheDEL_prefix.Asubclasscanbenamedasitssuperclasspostfixedwiththeunderscorecharacterandalogicalnamedescribingthesubclassspecialization,ifthenameofthesuperclasshastobeshortened(basicallytokeepthenamewithintheIndentifierNamelimitation(p.t.str40).Theunderscorehereactsastheperiodyounormallyapplyafteranabbreviatedname.,Donotuseunderscore(不要使用下画线的地方)inthebeginningofapplicationobjectnames(在应用对象名字的开头)asthefirstcharacterofvariablenamesinclassdeclarationsormethods(在类或者是方法内的变量名的第一个字符.)attheendofvariablenamesinclassdeclarationsormethods(在类或者是方法的最后一个字符.)ParametersThenamesoftheformalparametersinmethodsmustbeprefixedwithanunderscore(在方法中的形参的第一个字必须是下画线.),Zerooronespacebeforetheparenthesis?Usenospacebeforethestartingparenthesisinmethoddeclarationsandcalls.(在方法的定义时括号前不加空格.)Usenotspacebetweenamethodsnameandandtheargumentparenthesis.(在方法名字和变量名之内部不加入空格.)Useonespacebetweenif,switch,for,whileandtheexpressionsstartingparenthesis.(对于if,switch,for,while这些语法和其后面的括号之间要加入一个空格.),TheNineStepsofApplicationDevelopment(创建应用程序的九个步骤),Conceptualization:understandtheproblem.(概念化:理解问题,即撑握需求.)CreateExtendedDataTypesbasedontheprimitivedatatypesandBaseEnums.(基于原始的扩展类型或枚举类型创建扩展类型.)Createtablestoholdyourdata.(创建表来存放数据.)Createclassesforhandlingbusinessprocedures.(创建处理业务逻辑的类.)Createformsforinteractingwiththeuser.(创建用于交互的窗体.)Createreportstoextractinformationandpresentsurveys.(创建报表用于筛选数据和预测.)Createmenusandmenuitemsforaccessingthefunctionalityinyourapplication.(创访问程序的建菜单和菜单项)Setupsystemsecurity.(设置系统安全.)Writehelpinformation.(写帮助文档.),创建一个FORM,在一个类里staticvoidmain(Argsargs)PWS_ExportQuery_PWS_ExportQuery;argspreargs,frmargs;ObjectformRun;preargs=newargs(formstr(PWS_GoldenTaxQuery);/应该要有设计PWS_GoldenTaxQuery的FORM。preargs.caller();/呼叫这个FORM。formRun=classFactory.formRunClass(preargs);/再将呼叫完的FORM赋给FORMRUN。formRun.init();/执行FORM的操作。formRun.run();formRun.wait();frmargs=newargs(formstr(PWS_GoldenTax);frmargs.caller();formRun=classFactory.formRunClass(frmargs);formRun.init();formRun.run();formRun.wait();,打开一个FORM时所执行方法的顺序,Thenewconstructorontheformisactivated.Theinitmethodontheformisactivated.Theinitmethodontheformdatasourceisactivated.Therunmethodontheformisactivated.TheexecuteQuerymethodontheformdatasourceisactivated.ThefirstFieldmethodontheformisactivated.,关闭一个FORM所执行方法的顺序,当按Cancel关闭时的执行顺序:ThecloseCancelmethodontheformisactivated.ThecanClosemethodontheformisactivated.Theclosemethodontheformisactivated.当按关闭按钮或者是OK按钮时执行顺序如果是按OK按钮关闭窗口则closeOK会被运行,但如果是按关闭按钮closeOK这个方法则不会执行.ThecanClosemethodontheformisexecutedTheleavecontrolsequenceisexecuted.Theleavemethodonthecontrolisexecuted.Thevalidatemethodonthecontrolisexecuted.Thevalidatemethodonthedatasourceisexecuted.ThevalidateFieldmethodonthetableisexecuted.Themodifiedmethodonthecontrolisexecuted.Themodifiedmethodonthedatasourceisexecuted.Theleaverecordsequenceisexecuted,ifanactualdatabaserecordisinfactexited.ThevalidateWritemethodonthedatasourceisexecuted.Thewritemethodonthedatasourceisexecuted.Theinsert(ifitisanewrecord),ortheupdate(ifitisanexistingrecord)methodonthetableisexecuted.Theclosemethodontheformisexecuted.,离开一个控件时的方法执行顺序,Theleavemethodonthecontrolisexecuted.Thevalidatemethodonthecontrolisexecuted.Thevalidatemethodonthedatasourceisexecuted.ThevalidateFieldmethodonthetableisexecuted.Themodifiedmethodonthecontrolisexecuted.Themodifiedmethodonthedatasourceisexecuted.,离开一条记录时的方法执行顺序,ThevalidateWritemethodonthedatasourceisexecuted.Thewritemethodonthedatasourceisexecuted.Theinsert(ifitisanewrecord),ortheupdate(ifitisanexistingrecord)methodonthetableisexecuted.,创建一条记录时的方法执行顺序,createonthedatasourceisexecuted.initValueonthedatasourceisexecuted.initValueonthetableisexecuted.,删除一条记录时的方法执行顺序,deleteonthedatasourceisexecuted.validateDeleteonthedatasourceisexecuted.IfvalidateDeletereturnstrue.validateDeleteonthetableisexecuted.IfvalidateDeletereturnstrue.Therecordisthenre-readfromthedatabasebythekernel.Unlesstherecordisdeletedorupdatedbyanotheruser,then.deleteonthetableisexecuted.,自动行编号的新增,首先自动行编号的新增这需要TABLE和FORM结合才能做到.对于FORM将相应的表作为数据源拉进来,在数据源的CounterField属性选上要自动编号的字段.在TABLE上需要对那个想做自动行编号的字段做索引文件.下面举例:,自动行编号的字段,添加数据源,重载方法.,对于FORM的里的数据源的Create方法进行重载,重载成如下:,改写上面的东西就可以了.publicvoidcreate(boolean_append=True)super(_append);,同一表的多条从记录显示在一个窗体的不同位置的做法,欲达到的效果如下:,如上红色框所示物料档窗体“数量”页签的“采购订单”,“库存”,“销售订单”三组的资料是同一个表,但却是三条不同的记录。只是这三条记录都是跟主表有关联的。,例子:My_InventTable(最后的效果),这三个数据源是对应同一个表的,这里以InventTableModule,这个表作例子.,这是窗体的主数据源,数据源的属性设置:对于这三个从数据源的属性除名字其设置是一样的.,数据源名称.,真正表名,索引可不加,但加了可以提速,在这个方法里要定义一些QueryBuildRange.因为这里有三个相同的数据源,所以要定义三个.详见下.,这里是要关联的主表.及联接类型.,这两个属性也设为一致.,对于Purch,Invent,Sales三个数据源,都要有一Init的方法.来初始化不一样的资料,因为这些数据是在同一张表里,但是显示的信息是因不同位置而不同的.,voidinit()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的方法.,只要对三个数据源进行同样的操作就可以了.,在数据源中选择多条记录的处理,ExampleOnaformwithadatasourcenamedxRefReferences,thefollowingcouldbefound:voidclicked()xRefReferencesxRefReferencesEdit;/arethereanymarkedrecords-for(xRefReferencesEdit=xRefReferences_ds.getFirst(1)?xRefReferences_ds.getFirst(1):/ifyes,getthefirstmarkedrecordxRefReferences;/else,usethecurrentrecord/continueaslongastherearerecordstoworkonxRefReferencesEdit;/getthepotentialnextmarkedrecordxRefReferencesEdit=xRefReferences_ds.getNext()/doprocessingwithxRefReferencesEdit.,创建一个Numbersequence,创建一个Numbersequence所需要用到的对象:新建一个要捆绑Numbersequence的扩展数据类型.将要产生自动编号的表的主字段的扩展类型设为与Numbersequence捆绑的扩展数据类型.在那个表所属的模块的Numbersequence类(如:NumberSeqReference_MyModule)中新增设置Numbersequence的加载模块.在所属模块的参数表里加入NumberSeqReference的方法.进入到相应模块的参数FORM里NumberSeqReference编号组设上去就可以了.,新建一个要捆绑Numbersequence的扩展数据类型.与创建普通的扩展数据类型一样.以my_prodId(type:str20)将要产生自动编号的表的主字段的扩展类型设为与Numbersequence捆绑的扩展数据类型.创建一个my_Table的表.有一个字段:ID(扩展类型为:my_Id)在这个表的initVaule方法里,在那个表所属的模块的Numbersequence类(如:NumberSeqReference_MyModule)中新增设置Numbersequence的加载模块.,在所属模块的参数表里加入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步导出的数据导入进来.,Usedebuggershortcutkeys使用调试器的快捷键,fundamentalclasses(基本类),SessionApplicationCompanySiteInfoClassFactoryGlobal,fundamentalclasses(基本类),SessionApplicationCompanySiteInfoClassFactoryGlobal,Session,UseSessiontogetinformationaboutthecurrentsession.(用Session可以获得当前的会话.)TheSessionmethodsfallintothesecategories:ClientinformationLogintimeThesessionId()andtheSessionclassgiveuniqueinformationonauser.Also,useglobal.isSessionActive().WheretousetheSessionclassUsetheSessionclasstogetuniqueidentificationofthecurrentsession,orinformationabouttheclient.,fundamentalclasses(基本类),SessionApplicationCompanySiteInfoClassFactoryGlobal,Application,TheApplicationmethodsfallintothesecategories:(Application有被分成如下的一些分类:)DatabaseloglogDeletelogInsertlogUpdateNumbersequencecontrolresetNumberSeqAutoAbortnumberSeqAutoCleanTTScontrolUserlogupdateUserLog:记录用户的日记,是在startup方法里调用的.Startupmethod:这个方法是AX在启动时第一个被调用的.用来初始化一些变量.startupCommand这个参数传递的是从AX配置框里startupCommand框里填入的.有几种参数:SetBuildNo,UpdateBuildNo,Synchronize,Batch,compileAll,Exit,AOTImport,ApplUpgrade,Edit方法的使用,Edit方法是Display方法的扩展他既用于显示也用于接受用户的输入.Edit方法使用的地方:Table里的方法.Form的方法.Form数据源的方法.Edit方法用在Table里的例子:editFreeTxtTxtDefault(booleanSet,FreeTxtTxt)第一个参数是布尔类型的参数.第二个是要返回与要接受用户数据的参数.Edit方法使用在窗体时数据源时:editAmountSettle(booleanset,CustTrans_CustTrans,AmountU),标准lookupform的组成:,TitleField1fromtherelatedtable(关联的表的标题字段1)TitleField2fromtherelatedtable(关联的表的标题字段2)Thefieldsmakinguptherelation(所关联的字段)注:如果有显示的字段有重复的话则只显示其中一个.,用自定义的lookup窗体来代替标准,重载Lookup方法.创建自已的Lookup窗体.使用AutoLookup字段组.,创建一个运行时的(runtime)的lookup窗体,在Design要查找控件的lookup方法里加入如下的代码:/CreateanewinstanceofSysTableLookupwherethisisthecurrentformcontrolSysTableLookupsysTableLookup=SysTableLookup:newParameters(tableNum(custTable),this);/AddthefieldstobeshowninthelookupformsysTableLookup.addLookupField(fieldNum(custTable,accountNum);/Limitthedataselection.queryBuildDataSource=query.addDataSource(tableNum(custTable);queryBuildRange=queryBuildDataSource.addRange(fieldNum(custTable,accountNum);queryBuildRange.value(A.B);sysTableLookup.parmQuery(query);/Performthelookup,anddeletesuper()./super()willcreateanautogeneratedlookupform.sysTableLookup.performFormLookup();/super()可以看如下的例子:FormsDocuTypeDesignsDesignTab:TabTabPage:OverviewGrid:GridStringEdit:ActionClassNameMethods.lookup,在窗体中添加进度条的例子,效果如:,设计如:,优化窗体的性能:,Usebitmapsandothergraphicobjectssparingly.(尽量少使用位图和其他图形对象.)Useblack-and-whiteratherthancolorbitmaps.(尽量使用黑白而不使用彩色的图像.)Closeformsthatarenotbeingused.(不使用窗体时关闭他.)Iftheunderlyingrecordsourceincludesmanyrecordsandyouwanttousetheformprimarilytoenternewrecords,settheStartPositionpropertyoftheformtoLastsothattheformopenstoablankrecord.Ifyouopenaformwithallrecordsshowing,Axaptahastoreadineachrecordbeforeitcandisplaytheblankrecordattheendoftherecordset.(如果窗体的主要作用是新增记录并且数据源的记录比较多的话,则数据源的StartPosition属性设为Last.DonotusetheVisiblepropertymethod(existsonallcontrols)oncontrolseachtimeanewrecordbecomesactive.ThisoperationwillmakeMorphXre-arrangetheentireform.(不要设置所有控件的Visible属性,因为每次一条新的记录激活时.MorphX会将整个窗体重新排列一遍.),打印报表任务在Server上执行,当用户以3-tier,thin客户端登录打印报表时,报表是可以在打印在客户端或者是服务器端.如果想在服务器端打印报表则需进行如下的配置:在AOS的配置里将“Allowclientstouseprintersontheserver.”打勾.默认情况是不打勾的.在客户端的配置页里将“Useprintersontheserver(onlypossibleifserverallowsit)”打勾.,Eventsexecutingsequenceonreports,WhenyouopenareportbyselectingOpenintheshortcutmenu,thefollowingsequenceofeventsoccurs:FirsttheInitmethodonthereportisactivatedtoinitializethereport.TheRunmethodonthereportisactivated.ThePromptmethodonthereportisactivatedtoallowtheusertointeractwiththereport.TheFetchmethodonthereportisactivated.ToseewhichmethodsareactivatedbyFetch,click.T

温馨提示

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

评论

0/150

提交评论