简体   繁体   中英

NumberSequence - Dynamics ax 2012

I need help.

I'm trying to add a few auto-generated number sequences in my tables. I'm doing it by using loadModule() in Class NumberSeqModuleMine :

NumberSeqDatatype datatype = NumberSeqDatatype::construct();
datatype.parmDatatypeId(extendedtypenum(IdStuffSeq));
datatype.parmReferenceHelp(literalstr("@SYS32633"));
datatype.parmWizardIsContinuous(true);
datatype.parmWizardIsManual(NoYes::No);
datatype.parmWizardIsChangeDownAllowed(NoYes::No);
datatype.parmWizardIsChangeUpAllowed(NoYes::No);
datatype.parmWizardHighest(99999);
datatype.parmWizardLowest(1);
datatype.parmSortField(12);
this.create(datatype);

datatype.parmDatatypeId(extendedtypenum(IdOrderSeq));
datatype.parmReferenceHelp(literalstr("@SYS32674"));
datatype.parmWizardIsContinuous(true);
datatype.parmWizardIsManual(NoYes::No);
datatype.parmWizardIsChangeDownAllowed(NoYes::No);
datatype.parmWizardIsChangeUpAllowed(NoYes::No);
datatype.parmWizardHighest(99999);
datatype.parmWizardLowest(1);
datatype.parmSortField(12);
this.create(datatype);

Next I've created a job and execute it:

static void jobName(Args _args){
NumberSeqModuleMine  NumberSeqModuleMine = new NumberSeqModuleMine();
NumberSeqModuleMine.loadModule();

Next in all tables I have metodls like this:

static client server NumberSequenceReference numRefIdOrderSq(){
return NumberSeqReference::findReference(extendedTypeNum(IdOrderSeq)); }

My question: I added all numbers without IdOrderSeq however I used the same methods like in other SeqNumbers - have you got idea what I'm doing wrong so only one number isn't working?

EDIT - Ok... As I noticed by testing my aplication NumberSequence is working but not always - sometimes Dynamics set the number but sometimes it leaves blank field in base. But I don't know this is server issue, my form problem or something else. Any idea?

Try clearing all caches, in particular run this code:

NumberSeqApplicationModule::loadAll();
SysGlobalObjectCache::clearAllCaches();
appl.numberSeqGlobal().buildModulesMap();

Or restart AX, and if all fails, restart the AOS as well.

See also Using the Enhanced Number Sequence Framework (White paper)

Note: In Microsoft Dynamics AX 2009, number sequence references could be initialized by restarting the Application Object Server (AOS). In Microsoft Dynamics AX 2012, the initialization of references to populate the NumberSequenceDatatype and NumberSequenceParameterType tables has moved to the initialization checklist. To initialize the newly created references, run a job that executes the LoadModule method.

You can also reinitialize all references by running a job that executes the LoadAll method in the NumberSequenceModuleSetup class. However, for reinitializing all references, you must ensure that there are no existing number sequences already defined in the system..

Have you tried setting the sort field of IdOrderSeq to eg 13? I think each number in a module needs its own sorting number. To be clear, I'm talking about the following line of code:

datatype.parmSortField(12)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM