Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to support sequential unique number generation #146

Open
tatarincev opened this issue Jan 21, 2020 · 1 comment
Open

Need to support sequential unique number generation #146

tatarincev opened this issue Jan 21, 2020 · 1 comment

Comments

@tatarincev
Copy link
Contributor

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.

@yecli
Copy link
Contributor

yecli commented Feb 4, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants