vc-module-core icon indicating copy to clipboard operation
vc-module-core copied to clipboard

Need to support sequential unique number generation

Open tatarincev opened this issue 5 years ago • 1 comments

For example RWS800000

I believe they just want them to be sequential starting from

RWS800001 RWS800002 RWS800003 etc…

It seems the current implementation for this template RWS8{1:D5} will produce not unique numbers.

tatarincev avatar Jan 21 '20 13:01 tatarincev

Functional requirements: We want to have a flexible and customizable template creation mechanism that gives us the following functionality:

  • Unique increasing number sequence for orders on all platform instances. It means different platform instances connected to the same db should genereate increasing order numbers;
  • In template, besides constant values, we need to have an ability to use: {0} - next number in the sequence, {1} - current UTC date;
  • Optionally - {2} - store code;
  • Formatting is applied using regular c# number and date formatting, like {0:d5};
  • Ability to set up incrementing step and sequence start;
  • Ability to setup reset rule for the sequence - None, every day, every week, etc;
  • Ability to reset sequence manually; This extension could be used as a functional example: https://bsscommerce.com/blog/complete-tutorial-guide-change-order-number-magento-2/#Tip_2_Use_Magento_2_Custom_Order_Number_extension

Technical details: As a possible solution, we could add custom template number generator to the core module, with an ability to change its settings and enable it for the orders, payments, and shipping. Thus custom generator will replace the current one. We need to add an abstraction for this purpose. Implementation could use MSSQL sequence objects under the hood to guarantee a unique and increasing sequence.

yecli avatar Feb 04 '20 09:02 yecli