cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Order number keygen increments in alphanumeric

SAPSupport
Employee
Employee
0 Likes
1,199

We wanted to update the order number keygen to something like ABC00000000 and we updated the below properties in P1.

  • keygen.order.code.digits=11
  • keygen.order.code.start=ABC00000000
  • keygen.order.code.type=alphanumeric

And then we restarted nodes and executed:

  • spring.getBean("avantorOrderCodeGenerator").reset();

But the increments of this pattern are not expected.
We expected increments like ABC00000000. But, what the increments are: ABC000000RS
Can you please help to fix this?


------------------------------------------------------------------------------------------------------------------------------------------------
Learn more about the SAP Support user and program here.

Accepted Solutions (1)

Accepted Solutions (1)

SAPSupport
Employee
Employee
0 Likes

Go to HAC, scrip type: "groovy" and execute below script:

  • import de.hybris.platform.jalo.numberseries.*
  • NumberSeriesManager nm = NumberSeriesManager.getInstance()
  • def s = nm.getNumberSeries("order_code")
  • nm.resetNumberSeries(s.key, "ABC00000001", s.type, s.template)

Answers (2)

Answers (2)

cat2023
Associate
Associate
0 Likes

When we execute spring.getBean("orderCodeGenerator").reset() in Scripting Languages, it will call resetNumberSeries() method. Then it will call resetSeries(key, type, tmp.getCurrentNumber()) method. The method will based on the key to reset "startValue", "Type" and "key", but it will not reset the Template. So when we execute the spring.getBean("orderCodeGenerator").reset() in Scripting Languages, it can not change the value of Template as setting in project.properties or local properties file.

cat2023
Associate
Associate
0 Likes

1. Check the project.properties as below or add below settings to local.properties:

  • keygen.order.code.name=order_code
  • keygen.order.code.digits=8
  • keygen.order.code.start=00000000
  • keygen.order.code.numeric=true
  • keygen.order.code.template=TEST$

2. Restart server.

3.Check in HAC>>Console>>Flexible Search>>SQL search, execute "select * from numberseries". You will find the Value of the Template is still the 'ABC$'.

4. Go to HAC>>Console>>Scripting Languages, and execute the below groovy script (commit mode):

  • import de.hybris.platform.jalo.numberseries.*
  • NumberSeriesManager nm = NumberSeriesManager.getInstance()
  • def s = nm.getNumberSeries("order_code")
  • println "Before: key: ${s.key} current: ${s.currentNumber} type: ${s.type} template: ${s.template}"
  • nm.removeNumberSeries("order_code")

5.Check in HAC>>Console>>Flexible Search>>SQL search, execute "select * from numberseries". You will find the "order_code" NumberSeries is removed in the table.

6. Go to HAC>>Console>>Scripting Languages, and execute the below groovy script (commit mode):

  • spring.getBean("orderCodeGenerator").generate();

7.Check in HAC>>Console>>Flexible Search>>SQL search, execute "select * from numberseries". You will find the new value of "Template" as expected: "TEST$".