• How to generate number Sequence[AX 2012]


    Suppose we want create number sequence for Test field on form in General  ledger module
    Consideration: EDT-Test, Table-TestTable and Form- TestTable
     
    Step1. Create new EDT with name Test
    Step 2. Modify load module() method on  NumberSeqModuleLedger class
     
    {
         datatype.parmDatatypeId(extendedTypeNum(Test));
         datatype.parmReferenceHelp(literalStr("Test"));
         datatype.parmWizardIsManual(NoYes::No);
         datatype.parmWizardIsChangeDownAllowed(NoYes::No);
         datatype.parmWizardIsChangeUpAllowed(NoYes::No);
         datatype.parmWizardHighest(999);
         datatype.parmSortField(30);
         datatype.addParameterType(NumberSeqParameterType::DataArea, truefalse);
         this.create(datatype);
    }
     
    Step 3.Create a method on LedgerParameters Table
     
         client server static NumberSequenceReference numRefTest()
    {
         return NumberSeqReference::findReference(extendedTypeNum(Test));
    }
     
    Step 4.Write and run following job
     
    static void NumberSeqLoadAll(Args _args)
    {
        NumberSeqApplicationModule::loadAll();
     
    }
     
     
    Step 5.Then run the wizard
     
    Organization Administration -> CommonForms -> Numbersequences->Numbersequences-> Generate -> run the wizard.
     
    Step 6.Now we have to check the number sequence  is correctly working  for that write a job:
     
    static void NumSeq(Args _args)
    {
        NumberSeq  numberSeq;
        Test num;
        ;
        numberSeq = NumberSeq::newGetNum(ProjParameters:: numRefTest ());
        num = numberSeq.num();
        info(num);
    }
     
     
    Step 7.Now we want that Number Sequence in form level(Test Table):
     
     
     Write below code in class declaration  
    public class FormRun extends ObjectRun
    {
        NumberSeqFormHandler numberSeqFormHandler;
     
    }
     
     Step 8.Write the NumberSeqFormHandler() in form methods node.
     
    NumberSeqFormHandler numberSeqFormHandler()
    {
        if (!numberSeqFormHandler)
        {
           numberSeqFormHandler = NumberSeqFormHandler::newForm(LedgerParameters:: numRefTest ().NumberSequenceId,
                                                                 element,
                                                                 TestTable_DS,
                                                                 fieldNum(TestTable, Test)
                                                                );
        }
        return numberSeqFormHandler;
    }
     
     
    Step 9.Write the  Create(),Delete(),Write() , Validate Write(),Link Active() on the Data source methods node.
     Create() Method
    void create(boolean append = false,
                boolean extern = false
    {
        element.numberSeqFormHandler().formMethodDataSourceCreatePre();
     
        super(append);
     
        if (!extern)
        {
            element.numberSeqFormHandler().formMethodDataSourceCreate(true);
        }
    }
     
    Delete() Method
     
    public void delete()
    {
        element.numberSeqFormHandler().formMethodDataSourceDelete();
        super();
    }
     
    Write()Method
     
    public void write()
    {
        super();
        element.numberSeqFormHandler().formMethodDataSourceWrite();
    }
     
     
     
    Validate Write() Method
     
    public boolean validateWrite()
    {
        boolean         ret;
        ret = super();
        ret = element.numberSeqFormHandler().formMethodDataSourceValidateWrite(ret) && ret;
        if (ret)
        {
            TestTable.validateWrite();
        }
        return ret;
    }
     
    Link Active() Method
     
    public void linkActive()
    {
        ;
        element.numberSeqFormHandler().formMethodDataSourceLinkActive();
        super();
    }
    Step 10.Finally add Close() method on form
    void close()
    {
        if (numberSeqFormHandler)
        {
            numberSeqFormHandler.formMethodClose();
        }
        super();
    }
     
    AX2009 version such as:
  • 相关阅读:
    .9文件,展示后显示黑条问题的解决
    云存储——asus webstorage
    OpenRisc27wishbone接口的vga ipcore的分析与仿真
    Java内部类与final关键字详解
    在QT项目中添加对研华数采模块的支持
    WindowXP 下Android 开发环境搭建
    第八学 linux内核——内存寻址——段机制(2)
    机房收费系统个人版——DataGridView控件怎么用?
    Javascript 给页面元素添加时间函数探讨
    Mule学习笔记3官方案例
  • 原文地址:https://www.cnblogs.com/Fandyx/p/3141630.html
Copyright © 2020-2023  润新知