Duplicate Part - Target Part number already exists

For some reason this week, duplicate part has begun giving this error. It only gives this error on Live and not on our Test server. I ran traces on both Live and Test and it is following the same steps up through DuplicatePart at which point it stops on Live with the error and Test continues to PartExists and then GetByID. There are three BPMs on Duplicate which were written months ago and have not changed. They are exactly the same on Live and Test. I also disabled all Method and Data Directives I have added in the last 3 months to make sure none of those are interfering. Even with those all disabled, I receive the same error.

Error

Business Layer Exception

Target Part number already exists.

Exception caught in: Epicor.ServiceModel

Error Detail 
============
Description:  Target Part number already exists.
Program:  Erp.Services.BO.Part.dll
Method:  DuplicatePart
Line Number:  5647
Column Number:  17
Server Trace Stack:     at Erp.Services.BO.PartSvc.DuplicatePart(String sourcePartNum, String targetPartNum, String targetPartDescription, String configuratorMode, String configID, String configDescription, String configType) in C:\_Releases\ERP\UD10.1.500.18\Source\Server\Services\BO\Part\Part.cs:line 5647
   at Epicor.Customization.Bpm.BO99368248778347AA929C26276C67372C.DuplicatePartImpl.ExecuteBase(DuplicatePartParameters parameters)
   at Epicor.Customization.Bpm.MethodCustomizationBase2`3.RunDirectives(TParam parameters) in c:\_Releases\ICE\3.1.500\Current\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.500\Current\Source\Server\Internal\Lib\Epicor.Customization.Bpm\CustomizationBase2.cs:line 77
   at Epicor.Customization.Bpm.BO99368248778347AA929C26276C67372C.PartSvcCustomization.DuplicatePart(String sourcePartNum, String targetPartNum, String targetPartDescription, String configuratorMode, String configID, String configDescription, String configType)
   at Erp.Services.BO.PartSvcFacade.DuplicatePart(String sourcePartNum, String targetPartNum, String targetPartDescription, String configuratorMode, String configID, String configDescription, String configType) in C:\_Releases\ERP\UD10.1.500.18\Source\Server\Services\BO\Part\PartSvcFacade.cs:line 812
   at SyncInvokeDuplicatePart(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.500.18\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.500.18\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.500.18\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.PartImpl.DuplicatePart(String sourcePartNum, String targetPartNum, String targetPartDescription, String configuratorMode, String configID, String configDescription, String configType)
   at Erp.UI.App.PartEntry.PartTransaction.Duplicate()

So even with all BPM’s disabled you still get the error?

By chance that the target part actual does already exist? Or that the duplicate Part method is somehow getting called twice, where it succeeds the first time, but then fails the second - because the target partnum now exists from the first call.

I have disabled all BPMs I added to the system. (I’m the only one who currently does it, the only other person who had access and knowledge to create these left 4 weeks ago. I did not disable her BPMs as this issue only developed this week and nothing has changed on her BPMs in the last month). Same error occurs.

Did a query on the part table to make sure the part did not exist. It did not. If the duplicate part method is being called a second time, it is not showing in the trace. Including both traces for comparison. This works on Test, not on Live.

I also considered the fact that the parameter for sourcePartNum and targetPartNum appear the same, however, that is the same for both traces whereas one works and the other does not.

Live Trace

<tracePacket>
  <businessObject>Ice.Proxy.BO.ReportMonitorImpl</businessObject>
  <methodName>GetRowsKeepIdleTime</methodName>
  <appServerUri>net.tcp://☼☼☼☼/EpicorLive10/</appServerUri>
  <returnType>Ice.Tablesets.ReportMonitorTableset</returnType>
  <localTime>9/8/2021 10:59:56:0891670 AM</localTime>
  <executionTime total="20" roundTrip="9" channel="0" bpm="0" other="11" />
  <retries>0</retries>
  <parameters>
    <parameter name="whereClauseSysRptLst" type="System.String"><![CDATA[((PrintDriver='TEXT' AND (AutoAction = 'PRINT' OR AutoAction = 'PREVIEW')) OR (PrintDriver='CRYSTAL' AND (AutoAction = 'PRINT' OR AutoAction = 'AUTOPRT' OR AutoAction = 'PREVIEW' OR AutoAction = 'AUTOPRV')) OR (PrintDriver='EPIFIN' AND (AutoAction = 'PRINT' OR AutoAction = 'PREVIEW')) OR (PrintDriver='BARTENDER' AND (AutoAction = 'AUTOPRT' OR AutoAction = 'AUTOPRV')) OR (PrintDriver='EDI' AND AutoAction <> '') OR (PrintDriver='SSRS' AND (AutoAction = 'PREVIEW' OR AutoAction = 'PRINT') AND LastAction = 'SSRSREADY')) AND WorkStationID ='MDE-ENG09 1']]></parameter>
    <parameter name="pageSize" type="System.Int32"><![CDATA[0]]></parameter>
    <parameter name="absolutePage" type="System.Int32"><![CDATA[0]]></parameter>
    <parameter name="morePages" type="System.Boolean"><![CDATA[False]]></parameter>
  </parameters>
</tracePacket>

<tracePacket>
  <businessObject>Ice.Proxy.BO.GenXDataImpl</businessObject>
  <methodName>GetList</methodName>
  <appServerUri>net.tcp://☼☼☼☼/EpicorLive10/</appServerUri>
  <returnType>Ice.Tablesets.XXXDefListTableset</returnType>
  <localTime>9/8/2021 10:59:57:4405422 AM</localTime>
  <executionTime total="7" roundTrip="4" channel="0" bpm="0" other="3" />
  <retries>0</retries>
  <parameters>
    <parameter name="whereClause" type="System.String"><![CDATA[Key2 = 'App.PartEntry.DuplicatePart']]></parameter>
    <parameter name="pageSize" type="System.Int32"><![CDATA[0]]></parameter>
    <parameter name="absolutePage" type="System.Int32"><![CDATA[0]]></parameter>
    <parameter name="morePages" type="System.Boolean"><![CDATA[False]]></parameter>
    <parameter name="CallContext" type="Ice.Bpm.Context.ContextDataSet">
      <ContextDataSet xmlns="http://www.epicor.com/Ice/300/Bpm/Context">
        <BpmData>
          <SysRowID>3dabfcab-3727-46b4-830d-0f01610818bd</SysRowID>
        </BpmData>
      </ContextDataSet>
    </parameter>
  </parameters>
</tracePacket>

<tracePacket>
  <businessObject>Erp.Proxy.BO.PartImpl</businessObject>
  <methodName>GetCodeDescList</methodName>
  <appServerUri>net.tcp://☼☼☼☼/EpicorLive10/</appServerUri>
  <returnType>System.String</returnType>
  <localTime>9/8/2021 10:59:57:6088023 AM</localTime>
  <executionTime total="6" roundTrip="5" channel="0" bpm="0" other="1" />
  <retries>0</retries>
  <parameters>
    <parameter name="tableName" type="System.String"><![CDATA[PcStatus]]></parameter>
    <parameter name="fieldName" type="System.String"><![CDATA[ConfigType]]></parameter>
    <parameter name="CallContext" type="Ice.Bpm.Context.ContextDataSet">
      <ContextDataSet xmlns="http://www.epicor.com/Ice/300/Bpm/Context">
        <BpmData>
          <SysRowID>00000000-0000-0000-0000-000000000000</SysRowID>
        </BpmData>
      </ContextDataSet>
    </parameter>
  </parameters>
</tracePacket>

<tracePacket>
  <businessObject>Erp.Proxy.BO.PartImpl</businessObject>
  <methodName>DuplicatePart</methodName>
  <appServerUri>net.tcp://☼☼☼☼/EpicorLive10/</appServerUri>
  <returnType>Erp.Tablesets.PartTableset</returnType>
  <localTime>9/8/2021 11:00:04:2015435 AM</localTime>
  <executionTime total="41" roundTrip="39" channel="0" bpm="0" other="2" />
  <retries>0</retries>
  <parameters>
    <parameter name="sourcePartNum" type="System.String"><![CDATA[3000178]]></parameter>
    <parameter name="targetPartNum" type="System.String"><![CDATA[3000178]]></parameter>
    <parameter name="targetPartDescription" type="System.String"><![CDATA[DURA-MS: Machine Shop Product 
HANGER 1]]></parameter>
    <parameter name="configuratorMode" type="System.String"><![CDATA[COPY]]></parameter>
    <parameter name="configID" type="System.String"><![CDATA[]]></parameter>
    <parameter name="configDescription" type="System.String"><![CDATA[]]></parameter>
    <parameter name="configType" type="System.String"><![CDATA[PC]]></parameter>
    <parameter name="CallContext" type="Ice.Bpm.Context.ContextDataSet">
      <ContextDataSet xmlns="http://www.epicor.com/Ice/300/Bpm/Context">
        <BpmData>
          <SysRowID>00000000-0000-0000-0000-000000000000</SysRowID>
        </BpmData>
      </ContextDataSet>
    </parameter>
  </parameters>
</tracePacket>

Test Trace

<tracePacket>
  <businessObject>Ice.Proxy.BO.GenXDataImpl</businessObject>
  <methodName>GetList</methodName>
  <appServerUri>net.tcp://☼☼☼☼/EpicorTest10/</appServerUri>
  <returnType>Ice.Tablesets.XXXDefListTableset</returnType>
  <localTime>9/8/2021 10:58:43:4247983 AM</localTime>
  <executionTime total="10" roundTrip="4" channel="0" bpm="0" other="6" />
  <retries>0</retries>
  <parameters>
    <parameter name="whereClause" type="System.String"><![CDATA[Key2 = 'App.PartEntry.DuplicatePart']]></parameter>
    <parameter name="pageSize" type="System.Int32"><![CDATA[0]]></parameter>
    <parameter name="absolutePage" type="System.Int32"><![CDATA[0]]></parameter>
    <parameter name="morePages" type="System.Boolean"><![CDATA[False]]></parameter>
    <parameter name="CallContext" type="Ice.Bpm.Context.ContextDataSet">
      <ContextDataSet xmlns="http://www.epicor.com/Ice/300/Bpm/Context">
        <BpmData>
          <SysRowID>84186e38-fbfa-4f95-8951-0fd633435413</SysRowID>
        </BpmData>
      </ContextDataSet>
    </parameter>
  </parameters>
</tracePacket>

<tracePacket>
  <businessObject>Erp.Proxy.BO.PartImpl</businessObject>
  <methodName>GetCodeDescList</methodName>
  <appServerUri>net.tcp://☼☼☼☼/EpicorTest10/</appServerUri>
  <returnType>System.String</returnType>
  <localTime>9/8/2021 10:58:43:6038757 AM</localTime>
  <executionTime total="6" roundTrip="5" channel="0" bpm="0" other="1" />
  <retries>0</retries>
  <parameters>
    <parameter name="tableName" type="System.String"><![CDATA[PcStatus]]></parameter>
    <parameter name="fieldName" type="System.String"><![CDATA[ConfigType]]></parameter>
    <parameter name="CallContext" type="Ice.Bpm.Context.ContextDataSet">
      <ContextDataSet xmlns="http://www.epicor.com/Ice/300/Bpm/Context">
        <BpmData>
          <SysRowID>00000000-0000-0000-0000-000000000000</SysRowID>
        </BpmData>
      </ContextDataSet>
    </parameter>
  </parameters>
</tracePacket>

<tracePacket>
  <businessObject>Erp.Proxy.BO.PartImpl</businessObject>
  <methodName>DuplicatePart</methodName>
  <appServerUri>net.tcp://☼☼☼☼/EpicorTest10/</appServerUri>
  <returnType>Erp.Tablesets.PartTableset</returnType>
  <localTime>9/8/2021 10:58:49:8456626 AM</localTime>
  <executionTime total="156" roundTrip="128" channel="0" bpm="0" other="28" />
  <retries>0</retries>
  <parameters>
    <parameter name="sourcePartNum" type="System.String"><![CDATA[3000178]]></parameter>
    <parameter name="targetPartNum" type="System.String"><![CDATA[3000178]]></parameter>
    <parameter name="targetPartDescription" type="System.String"><![CDATA[DURA-MS: Machine Shop Product 
HANGER 1]]></parameter>
    <parameter name="configuratorMode" type="System.String"><![CDATA[COPY]]></parameter>
    <parameter name="configID" type="System.String"><![CDATA[]]></parameter>
    <parameter name="configDescription" type="System.String"><![CDATA[]]></parameter>
    <parameter name="configType" type="System.String"><![CDATA[PC]]></parameter>
    <parameter name="CallContext" type="Ice.Bpm.Context.ContextDataSet">
      <ContextDataSet xmlns="http://www.epicor.com/Ice/300/Bpm/Context">
        <BpmData>
          <SysRowID>00000000-0000-0000-0000-000000000000</SysRowID>
        </BpmData>
      </ContextDataSet>
    </parameter>
  </parameters>
</tracePacket>

<tracePacket>
  <businessObject>Erp.Proxy.BO.PartImpl</businessObject>
  <methodName>PartExists</methodName>
  <appServerUri>net.tcp://☼☼☼☼/EpicorTest10/</appServerUri>
  <returnType>System.Boolean</returnType>
  <localTime>9/8/2021 10:58:50:0138984 AM</localTime>
  <executionTime total="7" roundTrip="5" channel="0" bpm="0" other="2" />
  <retries>0</retries>
  <parameters>
    <parameter name="PartNumber" type="System.String"><![CDATA[8011731]]></parameter>
    <parameter name="CallContext" type="Ice.Bpm.Context.ContextDataSet">
      <ContextDataSet xmlns="http://www.epicor.com/Ice/300/Bpm/Context">
        <BpmData>
          <Character01>8011731</Character01>
          <SysRowID>00000000-0000-0000-0000-000000000000</SysRowID>
        </BpmData>
      </ContextDataSet>
    </parameter>
  </parameters>
</tracePacket>

<tracePacket>
  <businessObject>Erp.Proxy.BO.PartImpl</businessObject>
  <methodName>GetByID</methodName>
  <appServerUri>net.tcp://☼☼☼☼/EpicorTest10/</appServerUri>
  <returnType>Erp.Tablesets.PartTableset</returnType>
  <localTime>9/8/2021 10:58:50:0309814 AM</localTime>
  <executionTime total="63" roundTrip="47" channel="0" bpm="1" other="15" />
  <retries>0</retries>
  <parameters>
    <parameter name="partNum" type="System.String"><![CDATA[8011731]]></parameter>
    <parameter name="CallContext" type="Ice.Bpm.Context.ContextDataSet">
      <ContextDataSet xmlns="http://www.epicor.com/Ice/300/Bpm/Context">
        <BpmData>
          <Character01>8011731</Character01>
          <SysRowID>00000000-0000-0000-0000-000000000000</SysRowID>
        </BpmData>
      </ContextDataSet>
    </parameter>
  </parameters>
</tracePacket>

If it helps any, this is the code from the only BPM that appears it would have an impact. This code however has not changed in months so not sure why it would cause an issue. It is also the same on the Test server where there is no issue.

	//Get next part number from JCSyst table
	var jcSystRow = ( from JCrow in Db.JCSyst
									 where JCrow.Company == callContextClient.CurrentCompany
										select JCrow ).FirstOrDefault();
	if(jcSystRow != null)
	{
		//assign new target part number  
		targetPartNum = jcSystRow.PartNumber_c.ToString();
		jcSystRow.PartNumber_c++;
		//save target part number for search in post processing
		callContextBpmData.Character01 = targetPartNum;
	}

Update in case anyone else has this issue in the future.

I dug into the JCSyst table and compared with the part table and the JCSyst table had either not incremented properly or someone created a dummy part in a way that bypassed the BPMs and did not increment the PartNumber_c in jcSyst.

I found the errant part, deleted it, and the system works again.

1 Like