I want both of them to start at a specific number (ex 2 200 000).
And if it’s possible I also want the numbers to be uneven.
Litium version: Accelerator MVC 5.5.1
I want both of them to start at a specific number (ex 2 200 000).
And if it’s possible I also want the numbers to be uneven.
Litium version: Accelerator MVC 5.5.1
The readable numbers is generated in database and is from the below tables and sequences depend on Litium version. To update to use another range you simply update the value.
To make usage of other number pattern like uneven you need to manual set the readable number on the entities and also maintain the values by yourself.
Litium 4 and 5
ECommerce_ReadableID
ECommerce_ReadableDeliveryID
Relations_ReadableCustomerID
Litium 6 and 7
ECommerce_ReadableID
ECommerce_ReadableDeliveryID
Customers.CustomerId
.You should also be aware of following stored procs that fetches these auto increment numbers.
ECommerce_GetReadableID
ECommerce_GetReadableDeliveryID
By changing the stored procs, you can supply any number, as long as they are unique.
For customer number (if you are using Litium 5 or before) you can change the stored procedure dbo.Relations_GetReadableCustomerID
(following code is only an example, examine the deployed version of this stored proc in your database).
-- Returns a unique string as the External Order ID
ALTER PROC [dbo].[Relations_GetReadableCustomerID]
@ReadableCustomerID nvarchar(100) OUTPUT
AS
BEGIN
DECLARE @Prefix nvarchar(10)
SET @Prefix = 'LSC'
INSERT INTO dbo.Relations_ReadableCustomerID DEFAULT VALUES
SELECT @ReadableCustomerID = @Prefix + CAST(IDENT_CURRENT('dbo.Relations_ReadableCustomerID') AS nvarchar(90))
WHILE (SELECT COUNT(1) FROM dbo.Relations_Person WHERE CustomerNumber = @ReadableCustomerID) > 0 OR (SELECT COUNT(1) FROM dbo.Relations_Organization WHERE CustomerNumber = @ReadableCustomerID)> 0
BEGIN
INSERT INTO dbo.Relations_ReadableCustomerID DEFAULT VALUES
SELECT @ReadableCustomerID = @Prefix + CAST(IDENT_CURRENT('dbo.Relations_ReadableCustomerID') AS nvarchar(90))
END
RETURN
END
Remember that any change you do to existing procedures probably need to be re-applied again after every future upgrade.
Is it possible to pass the prefix from .net code ??
One more dobut :
ECommerce_GetReadableID
this store proc where is this called from ?
It’s not possible to pass a prefix from code. In later versions you can set what this should be in Web.config
The stored procedure is called internally when creating the order to get the next available order number.
Perhaps it is simpler to just change the external order number after order is created.
Maybe one can add the the the state machine in for exempel exit-action for initstate och entry action for waitingforconfirmation if there arent a better place.