zoukankan      html  css  js  c++  java
  • Inside Dynamics Axapta源代码赏析(二)

    C.NumberSequence
    作用:如何给特定模块的某个类型增加编码规则,该工程示例了给销售模块的服务订单增加编码规则.
    步骤:
    1.创建BikeServiceOrderId扩展数据类型,当然如果要给已经存在的扩展数据类型增加序列号分配的话,就不必增加了.
    2.修改NumberSeqReference_SalesOrder类,当然如果要给其他模块的类型增加编码规则的话,就选名为_**的类.修改LoadModule方法,增加如下代码:
    numRef.DataTypeId              = typeId2ExtendedTypeId(
                                         typeid(BikeServiceOrderId));
        numRef.ReferenceHelp           
    = "Unique key for the service order table, "+
                                         
    "used when identification of a service "+
                                         
    "order is allocated automatically.";
        numRef.WizardContinuous        
    = false;
        numRef.WizardManual            
    = NoYes::No;
        numRef.WizardAllowChangeDown   
    = NoYes::No;
        numRef.WizardAllowChangeUp     
    = NoYes::No;
        numRef.SortField               
    = 100;

        
    this.create(numRef);
    3.修改表SalesParameter,当然如果其他模块就修改**parmameter表.增加如下方法:
    static client server NumberSequenceReference  numRefBikeServiceOrderId()
    {
        
    return NumberSeqReference::findReference(typeId2ExtendedTypeId(typeid(BikeServiceOrderId)));
    }
    OK,这样就可以在应收账款->设置->参数设置->编码规则处看到刚刚增加的编码规则了.
    D.ReportImageNoEmptyBodySection
    作用:将通过文档管理增加的文档和注释显示在报表中.本示例是销售发票报表(SalesInvoice)中显示促销产品的照片和说明.

    步骤:
    1.在InventTable增加两个display方法分别用于返回促销产品的照片和说明,比如返回照片的代码如下:
    display public DocuValueFile PromotionImage()
    {
        DocuRef     docuref;
        DocuValue   docuValue;
        ;

        select forceplaceholders firstonly tableid from docuRef
            where docuRef.RefCompanyId  
    == this.DataAreaId  &&
                  docuRef.RefTableId    
    == this.TableId     &&
                  docuRef.RefRecId      
    == this.RecId       &&
                  docuRef.TypeId        
    == 'PromoImage'
        join file from docuValue
            where docuValue.RecId   
    == docuRef.ValueRecId;

        
    return docuValue.File;
    }
     
    2.在报表SalesInvoice中以下路径CustInvoiceJour->BodyCustInvoiceJour->CustInvoiceTrans->BodyReference->InventTable增加一SectionGroup:BodyInventTable对应表InventTable,在该SectionGroup下增加BodyInventTable.
    3.在该body下增加两个控件分别对应图片和注释,对应方法在InventTable下增加的方法PromotionImage()和PromotionText.
    4.在Body:BodyReference printInventTable方法:
    void printInventTable()
    {
        InventTable inventTable 
    = custInvoiceTrans.inventTable();
        
    if (inventTable.RecId &&
            (inventTable.PromotionText() 
    || inventTable.PromotionImage()))
        
    {
             element.send(inventTable);
        }

    }

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


  • 相关阅读:
    不同storyboard间跳转
    WWDC2014:留给微软的时间不多了!
    IBOutletCollection 索引获取顺序问题
    iOS下单例模式实现(二)利用宏定义快速实现
    iOS下单例模式实现(一)(objective-c arc gcd)
    windows phone UI吐槽---跑偏了就再也跑不回来了
    iOS沙盒(SanBox)机制与文件操作
    转载:iOS静态库与动态库
    KVO与KVC理解
    iOS多线程编程的几种方式
  • 原文地址:https://www.cnblogs.com/Farseer1215/p/514835.html
Copyright © 2011-2022 走看看