Order Entry Revision Error

When we are trying to pull in our revisions in the order, some times, and on random parts, we get the follwoing error: Has anyone seen this and found a fix?

Business Layer Exception

An error occurred while updating the entries. See the inner exception for details.

Exception caught in: Epicor.ServiceModel

Error Detail

============

Description: An error occurred while updating the entries. See the inner exception for details.

Program: Erp.Internal.MR.CPMethod.dll

Method: _CPMethod

Line Number: 1363

Column Number: 21

Server Trace Stack: at Erp.Internal.MR.CPMethod._CPMethod(Guid TargetAsm_Rowid, String Source_Part, String Source_Rev, String Source_AltMethod, Object hProcessInfo, Boolean msg_prompt, Boolean Use_Source_AltMethod, Boolean fromCpMethod, Boolean doRoughCutSched, Boolean& crossPlant, Nullable1& useDate, String& useJob, String& useRev, Int32& cfgPhantomCount, List1& opTgtJobRows, Int32 structID) in c:_Releases\ERP\UD10.1.400.37\Source\Server\Internal\MR\CPMethod\CPMethod.cs:line 1363

at Erp.Internal.MR.CPMethod._CPMethod(Guid TargetAsm_Rowid, String Source_Part, String Source_Rev, String Source_AltMethod, Object hProcessInfo, Boolean msg_prompt, Boolean Use_Source_AltMethod, Boolean fromCpMethod, Boolean doRoughCutSched, Boolean& crossPlant, Nullable1& useDate, String& useJob, String& useRev, List1& opTgtJobRows) in c:_Releases\ERP\UD10.1.400.37\Source\Server\Internal\MR\CPMethod\CPMethod.cs:line 854

at Erp.Services.BO.OrderJobWizSvc.getDetails(Boolean& errorOccurred) in c:_Releases\ERP\UD10.1.400.37\Source\Server\Services\BO\OrderJobWiz\OrderJobWiz.cs:line 2282

at Erp.Services.BO.OrderJobWizSvc.processJWOrderDtls(String& OP_ErrorMsgs) in c:_Releases\ERP\UD10.1.400.37\Source\Server\Services\BO\OrderJobWiz\OrderJobWiz.cs:line 2756

at Erp.Services.BO.OrderJobWizSvc.CreateJobs(OrderJobWizTableset& ds, String& pErrorMessages) in c:_Releases\ERP\UD10.1.400.37\Source\Server\Services\BO\OrderJobWiz\OrderJobWiz.cs:line 1387

at Epicor.Customization.Bpm.MethodCustomizationBase2`3.RunDirectives(TParam parameters) in c:_Releases\ICE\3.1.400.37\Source\Server\Internal\Lib\Epicor.Customization.BPM\MethodCustomizationBase2.cs:line 218

at Epicor.Customization.Bpm.CustomizationBase2`3.Execute(TParam parameters) in c:_Releases\ICE\3.1.400.37\Source\Server\Internal\Lib\Epicor.Customization.BPM\CustomizationBase2.cs:line 77

at Epicor.Customization.Bpm.BOCC2F238A1C9E4D85B08E5A44ECF7E6B7.OrderJobWizSvcCustomization.CreateJobs(OrderJobWizTableset& ds, String& pErrorMessages)

at Erp.Services.BO.OrderJobWizSvcFacade.CreateJobs(OrderJobWizTableset& ds, String& pErrorMessages) in c:_Releases\ERP\UD10.1.400.37\Source\Server\Services\BO\OrderJobWiz\OrderJobWizSvcFacade.cs:line 87

at SyncInvokeCreateJobs(Object , Object[] , Object[] )

at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)

at Epicor.Hosting.OperationBoundInvoker.InnerInvoke(Object instance, Func`2 func) in c:_Releases\ICE\3.1.400.37\Source\Framework\Epicor.System\Hosting\OperationBoundInvoker.cs:line 59

at Epicor.Hosting.OperationBoundInvoker.Invoke(Object instance, Func`2 func) in c:_Releases\ICE\3.1.400.37\Source\Framework\Epicor.System\Hosting\OperationBoundInvoker.cs:line 28

at Epicor.Hosting.Wcf.EpiOperationInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) in c:_Releases\ICE\3.1.400.37\Source\Framework\Epicor.System\Hosting\Wcf\EpiOperationInvoker.cs:line 23

at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)

at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)

at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)

at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

at System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext)

at System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext)

at System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult result)

at System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete(IAsyncResult result)

at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)

at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)

at System.ServiceModel.Channels.TransportDuplexSessionChannel.TryReceiveAsyncResult.OnReceive(IAsyncResult result)

at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)

at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)

at System.ServiceModel.Channels.SynchronizedMessageSource.ReceiveAsyncResult.OnReceiveComplete(Object state)

at System.ServiceModel.Channels.SessionConnectionReader.OnAsyncReadComplete(Object state)

at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)

at System.Net.LazyAsyncResult.Complete(IntPtr userToken)

at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)

at System.Net.Security.NegotiateStream.ProcessFrameBody(Int32 readBytes, Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)

at System.Net.Security.NegotiateStream.ReadCallback(AsyncProtocolRequest asyncRequest)

at System.Net.AsyncProtocolRequest.CompleteRequest(Int32 result)

at System.Net.FixedSizeReader.CheckCompletionBeforeNextRead(Int32 bytes)

at System.Net.FixedSizeReader.ReadCallback(IAsyncResult transportResult)

at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)

at System.ServiceModel.Channels.ConnectionStream.IOAsyncResult.OnAsyncIOComplete(Object state)

at System.Net.Sockets.SocketAsyncEventArgs.OnCompleted(SocketAsyncEventArgs e)

at System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSuccess(SocketError socketError, Int32 bytesTransferred, SocketFlags flags)

at System.Net.Sockets.SocketAsyncEventArgs.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)

at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

Client Stack Trace

==================

at Epicor.ServiceModel.Channels.ImplBase`1.ShouldRethrowNonRetryableException(Exception ex, DataSet[] dataSets)

at Erp.Proxy.BO.OrderJobWizImpl.CreateJobs(OrderJobWizDataSet ds, String& pErrorMessages)

at Erp.Adapters.OrderJobWizAdapter.CreateJobs(String& pErrorMessages)

at Erp.UI.App.OrderJobWizEntry.Transaction.CreateJobs()

Also same error when creating a job wiht the part and pulling in the revision.

Just looking at the error link by line, I see you have BPM customization. This could be root cause of the unhandled exception.

Totally missed that. I’ll check that out.

I found the BPM Cusotmization, but I can not see anything that would cause it to not work. Note: this started the problems when I went form 10.1.400.19 to 10.1.400.37.

/* Copy values from OrderDtl to JobHead */

bool debugMode = false;

using (var txscope = IceDataContext.CreateDefaultTransactionScope())
{
Erp.Tables.OrderDtl OrderDtl;
Erp.Tables.JobHead JobHead;

	if (debugMode) { PublishInfoMessage("Enter BPM", Ice.Common.BusinessObjectMessageType.Information,Ice.Bpm.InfoMessageDisplayMode.Individual, "", ""); }
	
	foreach (var ttJWOrderRel_xRow in ttJWOrderRel)
	{
			if (debugMode) { PublishInfoMessage("In ttJWOrderRel Loop", Ice.Common.BusinessObjectMessageType.Information,Ice.Bpm.InfoMessageDisplayMode.Individual, "", ""); }
	
	    var ttJWOrderRelRow = ttJWOrderRel_xRow;

			/* Lookup OrderDtl */
	    OrderDtl = (from OrderDtl_Row in Db.OrderDtl
	                where OrderDtl_Row.Company == ttJWOrderRelRow.Company
	                && OrderDtl_Row.OrderNum == ttJWOrderRelRow.OrderNum
	                && OrderDtl_Row.OrderLine == ttJWOrderRelRow.OrderLine
	                select OrderDtl_Row).FirstOrDefault();
	    if (OrderDtl != null)
	    {
					if (debugMode) { PublishInfoMessage("Found OrderDtl", Ice.Common.BusinessObjectMessageType.Information,Ice.Bpm.InfoMessageDisplayMode.Individual, "", ""); }

					/* Lookup JobHead */
	        JobHead = (from JobHead_Row in Db.JobHead.With(LockHint.UpdLock)
	                   where JobHead_Row.Company == OrderDtl.Company
	                   && JobHead_Row.JobNum == ttJWOrderRelRow.JobNum
	                   select JobHead_Row).FirstOrDefault();
	        if (JobHead != null)
	        {
							 if (debugMode) { PublishInfoMessage("Found JobHead. Setting values", Ice.Common.BusinessObjectMessageType.Information,Ice.Bpm.InfoMessageDisplayMode.Individual, "", ""); }
							
							/* Set values */
							JobHead.Size_c  = OrderDtl.Size_c;
	            JobHead.Shape_c = OrderDtl.Shape_c;
							JobHead.JobID_c = OrderDtl.JobID_c;
							JobHead.JobCode = OrderDtl.JobCode_c;
							JobHead.OverUnder_c = OrderDtl.OverUnder_c;
							JobHead.OrderDate_c = OrderDtl.OrderDate_c;
							
							/* Save the JobHead */
							Db.Validate();
	        }
	    }
	}
	txscope.Complete();

What happen if you disable the BPM? Does the problem occur?

I see you are performing an update lock on the target JobHead table. If the BPM is causing this you will know. Once you can find a consistent way to make the error re-occur, you can put some messages as to which line of code proceeds the error. I would bet that something else is updating the JobHead at the same time.

The client stack shows OrderJobWizEntry is being directed to create a Job. You might be able to update the dataset instead of directly updating the table.