Developer forum

Forum » Integration » Sync queued order - Finished after X minutes - not working

Sync queued order - Finished after X minutes - not working

Jon Thorne
Jon Thorne
Reply

We have recently had some issues with duplicate orders being created in BC and found this is caused by the Live Integration sending the order at the same time as the "Sync queued orders" task.

We have found that this caused by the incorrect implementation of "Finished after X minutes". In the DW code this is using the "ToDate" of the order filter which is referring to the "OrderDate" and not the "OrderCompletedDate". This results in finding an order immediately that may have been created more than 15 minutes previously, but only just completed. So effectively this "Finished after X mins" really only has a random usefulness even if it is changed to a long duration as carts (order records) can be created days before checkout.

Has anybody noticed this issue before? Any workaround or suggestions for this?

From QueuedOrdersSyncScheduledTask.cs:

OrderSearchFilter filter = new OrderSearchFilter
{
PageSize = MaxOrdersToProcess,
ToDate = DateTime.Now.AddMinutes(-1 * MinutesCompleted),
ShowUntransferred = true,
ShowNotExported = true,
Completed = OrderSearchFilter.CompletedStates.Completed,
IncludeRecurringOrders = !ExcludeRecurrent
};

From OrderRepository.cs:

// To date clause
if (filter.ToDate.HasValue)
{
var sqlToDate = filter.ToDate.Value;
sqlToDate = sqlToDate.Add(new TimeSpan(23, 59, 59));
if (sqlToDate > SqlDateTime.MaxValue.Value)
{
sqlToDate = SqlDateTime.MaxValue.Value;
}
 
sql.Add("AND EcomOrders.OrderDate <= {0} ", (object)sqlToDate);
}

Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Jon,
that is a bug and will be fixed, the bug number is 15757.
Thx for the great detailed description
BR, Dmitrij

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply
This post has been marked as an answer

Hi Jon

The problem #15757 regarding LiveIntegration Sync queued order
Now fixed in Dynamicweb version 9.16.2 
Get this from the download section https://doc.dynamicweb.dk/downloads/dynamicweb-9

Sorry for any inconvenience this may have caused

Kind Regards
Care Support
Kristian Kirkholt

 

Votes for this answer: 1

 

You must be logged in to post in the forum