If it helps, here is where the failure seems to occur:
Create_PartTran(ref PartTran, MainDate, MainTime, out PartTranError);
Digging way deeping to the bowels of Epicor I see some other logic which probably not well suited for the forum but it has me thinking.
//Epicor is using these values to pass to create a part tran - as it has to be unique
MainDate = CompanyTime.Now().Date;
MainTime = CompanyTime.Now().SecondsSinceMidnight();
What happens if you try to pass the same pn across in the same second, as I would assume happens. I bet it would fail. If you want to test this theory, either place several other pn records in between you same pn call or (FOR TESTING ONLY IN A TEST ENV) add a delay in your processing to see if that stops the issue. If it does, we’d need to talk to Epicor about a fix.
a butload of other unique pn’s
Thread sleep 4 seconds
If not, I wonder if it’s possible that its always pulling the same time in the BPM call (like a snapshot of when it was called). Meh, one test at a time.
Might be worth it to ping an inside man who can offer some suggestion (or tell you to avoid mine haha) @Rich