Search code examples
axaptamicrosoft-dynamicsdynamics-ax-2009

production order number sequence


Is it possible in AX 2009 to give number sequence as per the production groups. because I need to give number sequence according to the production order per site. please guide me whether it is possible or not ?


Solution

  • ProdId (the production order number) is a primary key on ProdTable, so you cannot have duplicates in that field. Unless you wanted to have a different number series per group (that is, a different format per series), there is no way of doing exactly what you are looking for.

    If different number formats are what you are looking for, then you would need to override the method that determines the next number in sequence, and choose a different sequence based on criteria of the record (in this case, the group). I'm not sure where this logic resides, but I would guess looking at the ProdTable methods with the debugger should help. However, also keep in mind that this could take some effort to maintain - if you create a new group, you'll need to remember to create a new number sequence and associate the two together.

    Another solution (as an alternative to the above, as well as if you want a single repeating number sequence) is to write your own into the ProdTable. I would use a secondary table that holds the production group id and the current number. The table would automatically create a record for the production group if one doesn't already exist. The record would be referenced as the ProdTable record was created and incremented - similar to the operation of the SystemSequences table for RecIds. You would need to specify your own number string formatting, but that shouldn't be very difficult. Your biggest challenge would be handling multiple concurrent reads/writes to the table, but I'm sure there's a graceful way of handling that as well.