On 10.2.100.43
I am attempting to process a shipment when the user checks “Ready To Fulfill”. Because the Serial tables exist in the SalesOrder method and the CustShip Method, I must use a Standard Data Directive to get around the error. I ran a test in the BL Tester and the logic works flawlessly. The only change to the data is to set a RowMod = “U” once at a specific point in time, otherwise, the whole thing is simply calling methods.
I tried to duplicate the process in code and everything works until the last “CustShip.UpdateMaster”. I have also tried creating each line by hand instead of using the Mass Shipment. Still errors.
Here is my error:
Business Layer Exception
Pack ID references invalid value.
Exception caught in: Epicor.ServiceModel
Error Detail
============
Description: Pack ID references invalid value.
Program: Epicor.Ice.dll
Method: ValidateReferentialIntegrity
Line Number: 585
Column Number: 21
Table: ShipDtl
Field: PackNum
Server Trace Stack: at Ice.Core.BizRuleEngine.ValidateReferentialIntegrity() in C:\_Releases\ICE\ICE3.2.100.43\Source\Framework\Epicor.Ice\BizRuleEngine\BizRuleEngine.cs:line 585
at Ice.Core.BizRuleEngine.ValidateRow() in C:\_Releases\ICE\ICE3.2.100.43\Source\Framework\Epicor.Ice\BizRuleEngine\BizRuleEngine.cs:line 178
at Ice.Core.BizRuleEngine.Validate(IceRow oldRow, IceRow newRow, LinqRow curRow) in C:\_Releases\ICE\ICE3.2.100.43\Source\Framework\Epicor.Ice\BizRuleEngine\BizRuleEngine.cs:line 123
at Ice.Services.Trace.TablesetProfilingCollector.DoRowEventTrace(String tableName, String methodName, Int32 rowCount, Action action) in C:\_Releases\ICE\ICE3.2.100.43\Source\Framework\Epicor.Ice\Services\TablesetProfilingCollector.cs:line 146
at Ice.TablesetBound`3.CreateRow(IceDataContext dataContext, Int32 tableNum, IIceTable table, IceRow newTablesetRow, TablesetProfilingCollector parentTraceCollector) in C:\_Releases\ICE\ICE3.2.100.43\Source\Framework\Epicor.Ice\Services\TablesetBound.cs:line 1088
at Ice.TablesetBound`3.WriteTable(IceDataContext dataContext, Int32 tableIndex, IIceTable table, TablesetProfilingCollector parentTraceCollector) in C:\_Releases\ICE\ICE3.2.100.43\Source\Framework\Epicor.Ice\Services\TablesetBound.cs:line 947
at Ice.TablesetBound`3.InnerUpdate(IceDataContext dataContext, TFullTableset tableset) in C:\_Releases\ICE\ICE3.2.100.43\Source\Framework\Epicor.Ice\Services\TablesetBound.cs:line 856
at Erp.Services.BO.CustShipSvc.Update(CustShipTableset& ds) in C:\_Releases\ERP\UD10.2.100.43\Source\Server\Services\BO\CustShip\CustShip.Designer.cs:line 2987
at Erp.Services.BO.CustShipSvcFacade.Update(CustShipTableset& ds) in C:\_Releases\ERP\UD10.2.100.43\Source\Server\Services\BO\CustShip\CustShipSvcFacade.cs:line 5816
at Erp.Services.BO.CustShipSvc.UpdateMaster(CustShipTableset& ds, Boolean doValidateCreditHold, Boolean doCheckShipDtl, Boolean doLotValidation, Boolean doCheckOrderComplete, Boolean doPostUpdate, Boolean doCheckCompliance, Boolean ipShippedFlagChanged, Int32 ipPackNum, Int32 ipBTCustNum, String& opReleaseMessage, String& opCompleteMessage, String& opShippingMessage, String& opLotMessage, String& opInventoryMessage, String& opLockQtyMessage, String& opAllocationMessage, String& opPartListNeedsAttr, String& opLotListNeedsAttr, String& shipCreditMsg, Boolean& cError, Boolean& compError, String& msg, String& opPostUpdMessage, Boolean& updateComplete, Boolean& checkComplianceError, Boolean& changeStatusError, Boolean& checkShipDtlAgain) in C:\_Releases\ERP\UD10.2.100.43\Source\Server\Services\BO\CustShip\CustShip.cs:line 33998
at Erp.Services.BO.CustShipSvcFacade.UpdateMaster(CustShipTableset& ds, Boolean doValidateCreditHold, Boolean doCheckShipDtl, Boolean doLotValidation, Boolean doCheckOrderComplete, Boolean doPostUpdate, Boolean doCheckCompliance, Boolean ipShippedFlagChanged, Int32 ipPackNum, Int32 ipBTCustNum, String& opReleaseMessage, String& opCompleteMessage, String& opShippingMessage, String& opLotMessage, String& opInventoryMessage, String& opLockQtyMessage, String& opAllocationMessage, String& opPartListNeedsAttr, String& opLotListNeedsAttr, String& shipCreditMsg, Boolean& cError, Boolean& compError, String& msg, String& opPostUpdMessage, Boolean& updateComplete, Boolean& checkComplianceError, Boolean& changeStatusError, Boolean& checkShipDtlAgain) in C:\_Releases\ERP\UD10.2.100.43\Source\Server\Services\BO\CustShip\CustShipSvcFacade.cs:line 4345
at Epicor.Customization.Bpm.DBE6B891EE16334E6ABF7238B6C642AFE6.PostTranDirective_ProcessShipment_8BD17AEEA43042C1AE2BED7BA1C57DB9.A002_CustomCodeAction()
at Epicor.Customization.Bpm.DBE6B891EE16334E6ABF7238B6C642AFE6.PostTranDirective_ProcessShipment_8BD17AEEA43042C1AE2BED7BA1C57DB9.ExecuteCore()
at Epicor.Customization.Bpm.DirectiveBase`3.Execute(TParam parameters) in C:\_Releases\ICE\ICE3.2.100.43\Source\Server\Internal\Lib\Epicor.Customization.BPM\DirectiveBase.Generic.cs:line 131
at System.Linq.Enumerable.All[TSource](IEnumerable`1 source, Func`2 predicate)
at Epicor.Customization.Bpm.CustomizationBase2`3.Execute(TParam parameters) in C:\_Releases\ICE\ICE3.2.100.43\Source\Server\Internal\Lib\Epicor.Customization.BPM\CustomizationBase2.cs:line 71
at Epicor.Customization.Bpm.Standard.MonitoringSessionManager.ProcessCollectedData(IceDataContext db, IRowChangesCollection data, IDirectiveEnabler enabler) in C:\_Releases\ICE\ICE3.2.100.43\Source\Server\Internal\Lib\Epicor.Customization.BPM\Standard\MonitoringSessionManager.cs:line 130
at Epicor.Customization.Bpm.SvcFacadeBase`3.Epicor.Hosting.IBpmReadyService.FinalizeCall(Object state, Boolean fail) in C:\_Releases\ICE\ICE3.2.100.43\Source\Server\Internal\Lib\Epicor.Customization.BPM\SvcFacadeBase.Generic.cs:line 205
at Epicor.Hosting.OperationBoundInvoker.Invoke(Object instance, Func`2 func) in C:\_Releases\ICE\ICE3.2.100.43\Source\Framework\Epicor.System\Hosting\OperationBoundInvoker.cs:line 32
at Epicor.Hosting.Wcf.EpiOperationInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) in C:\_Releases\ICE\ICE3.2.100.43\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.SecurityChannelListener`1.ReceiveItemAndVerifySecurityAsyncResult`2.InnerTryReceiveCompletedCallback(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.SalesOrderImpl.MasterUpdate(Boolean lCheckForOrderChangedMsg, Boolean lcheckForResponse, String cTableName, Int32 iCustNum, Int32 iOrderNum, Boolean lweLicensed, Boolean& lContinue, String& cResponseMsg, String& cCreditShipAction, String& cDisplayMsg, String& cCompliantMsg, String& cResponseMsgOrdRel, SalesOrderDataSet ds)
at Erp.Adapters.SalesOrderAdapter.MasterUpdate(Boolean lCheckForOrderChangedMsg, Boolean lcheckForResponse, String cTableName, Int32 iCustNum, Int32 iOrderNum, Boolean lweLicensed, Boolean& lContinue, String& cResponseMsg, String& cCreditShipAction, String& cDisplayMsg, String& cCompliantMsg, String& cResponseMsgOrdRel)
at Erp.UI.App.SalesOrderEntry.Transaction.Update()
Here is my code:
var hCustShip = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.CustShipSvcContract>(this.Db);
Erp.Tablesets.CustShipTableset ds = new Erp.Tablesets.CustShipTableset();
var tt = ttOrderHed.First();
string creditMessage;
bool opPromptForNum;
string opReleaseMessage;
string opCompleteMessage;
string opShippingMessage;
string opLotMessage;
string opInventoryMessage;
string opLockQtyMessage;
string opAllocationMessage;
string opPartListNeedsAttr;
string opLotListNeedsAttr;
string shipCreditMsg;
bool cError;
bool compError;
string msg;
string opPostUpdMessage;
bool updateComplete;
bool checkComplianceError;
bool changeStatusError;
bool checkShipDtlAgain;
string warnMsg;
using (var txScope = IceContext.CreateDefaultTransactionScope())
{
hCustShip.GetNewShipHead(ref ds);
hCustShip.GetHeadOrderInfo(tt.OrderNum, out creditMessage, ref ds);
hCustShip.GetLegalNumGenOpts(0, ref ds, out opPromptForNum);
hCustShip.UpdateMaster(ref ds, false, false, false, false, false, false, false, packNum, tt.CustNum, out opReleaseMessage, out opCompleteMessage, out opShippingMessage, out opLotMessage, out opInventoryMessage, out opLockQtyMessage, out opAllocationMessage, out opPartListNeedsAttr, out opLotListNeedsAttr, out shipCreditMsg, out cError, out compError, out msg, out opPostUpdMessage, out updateComplete, out checkComplianceError, out changeStatusError, out checkShipDtlAgain);
packNum = ds.ShipHead[0].PackNum;
hCustShip.PreCreateMassShipDtl(packNum, tt.OrderNum, out warnMsg, ref ds);
hCustShip.CreateMassShipDtl(packNum, tt.OrderNum, ref ds);
ds.ShipHead[0].RowMod = "U";
hCustShip.GetManifestInfo(tt.OrderNum, packNum, ref ds);
hCustShip.MarkShipmentLines(ref ds);
hCustShip.UpdateMaster(ref ds, false, true, false, false, false, false, false, packNum, tt.CustNum, out opReleaseMessage, out opCompleteMessage, out opShippingMessage, out opLotMessage, out opInventoryMessage, out opLockQtyMessage, out opAllocationMessage, out opPartListNeedsAttr, out opLotListNeedsAttr, out shipCreditMsg, out cError, out compError, out msg, out opPostUpdMessage, out updateComplete, out checkComplianceError, out changeStatusError, out checkShipDtlAgain);
txScope.Complete();
}