Inside Dynamics Axapta源代码赏析(二)

C.NumberSequence
作用:如何给特定模块的某个类型增加编码规则,该工程示例了给销售模块的服务订单增加编码规则.
步骤:
1.创建BikeServiceOrderId扩展数据类型,当然如果要给已经存在的扩展数据类型增加序列号分配的话,就不必增加了.
2.修改NumberSeqReference_SalesOrder类,当然如果要给其他模块的类型增加编码规则的话,就选名为_**的类.修改LoadModule方法,增加如下代码:
None.gif numRef.DataTypeId               =  typeId2ExtendedTypeId(
None.gif                                     typeid(BikeServiceOrderId));
None.gif    numRef.ReferenceHelp           
=   " Unique key for the service order table,  " +
None.gif                                     
" used when identification of a service  " +
None.gif                                     
" order is allocated automatically. " ;
None.gif    numRef.WizardContinuous        
=   false ;
None.gif    numRef.WizardManual            
=  NoYes::No;
None.gif    numRef.WizardAllowChangeDown   
=  NoYes::No;
None.gif    numRef.WizardAllowChangeUp     
=  NoYes::No;
None.gif    numRef.SortField               
=   100 ;
None.gif
None.gif    
this .create(numRef);
3.修改表SalesParameter,当然如果其他模块就修改**parmameter表.增加如下方法:
None.gif static  client server NumberSequenceReference  numRefBikeServiceOrderId()
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
InBlock.gif    
return NumberSeqReference::findReference(typeId2ExtendedTypeId(typeid(BikeServiceOrderId)));
ExpandedBlockEnd.gif}
OK,这样就可以在应收账款->设置->参数设置->编码规则处看到刚刚增加的编码规则了.
D.ReportImageNoEmptyBodySection
作用:将通过文档管理增加的文档和注释显示在报表中.本示例是销售发票报表(SalesInvoice)中显示促销产品的照片和说明.

步骤:
1.在InventTable增加两个display方法分别用于返回促销产品的照片和说明,比如返回照片的代码如下:
None.gif display  public  DocuValueFile PromotionImage()
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
InBlock.gif    DocuRef     docuref;
InBlock.gif    DocuValue   docuValue;
InBlock.gif    ;
InBlock.gif
InBlock.gif    select forceplaceholders firstonly tableid from docuRef
InBlock.gif        where docuRef.RefCompanyId  
== this.DataAreaId  &&
InBlock.gif              docuRef.RefTableId    
== this.TableId     &&
InBlock.gif              docuRef.RefRecId      
== this.RecId       &&
InBlock.gif              docuRef.TypeId        
== 'PromoImage'
InBlock.gif    join file from docuValue
InBlock.gif        where docuValue.RecId   
== docuRef.ValueRecId;
InBlock.gif
InBlock.gif    
return docuValue.File;
ExpandedBlockEnd.gif}
 
2.在报表SalesInvoice中以下路径CustInvoiceJour->BodyCustInvoiceJour->CustInvoiceTrans->BodyReference->InventTable增加一SectionGroup:BodyInventTable对应表InventTable,在该SectionGroup下增加BodyInventTable.
3.在该body下增加两个控件分别对应图片和注释,对应方法在InventTable下增加的方法PromotionImage()和PromotionText.
4.在Body:BodyReference printInventTable方法:
None.gif void  printInventTable()
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
InBlock.gif    InventTable inventTable 
= custInvoiceTrans.inventTable();
InBlock.gif    
if (inventTable.RecId &&
InBlock.gif        (inventTable.PromotionText() 
|| inventTable.PromotionImage()))
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif         element.send(inventTable);
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif 
5.改写Body:BodyReference 的executeSection方法,增加printInventTable方法的调用.
E:ReportImageOptimized
作用:跟D工程的功能一样,只不过是优化版本.
不同之处在于在报表中定义了promotionTxt和promotionImage两个变量,BodyInventTable下的控件对应的值从这两个变量中取得,而这两个变量的值是在方法printInventTable中赋值的.
对报表的send过程细节不是很清楚,为什么这样就可以改善效率?访问数据库的次数是一样的,send的调用次数也是一样的.


转载于:https://www.cnblogs.com/Farseer1215/archive/2006/09/26/514835.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值