PCID Job Receipt to Inventory Programmatically?

Has anyone succeeded in recording a Job Receipt to Inventory (PCID) programmatically? We’ve been attempting to do this in 10.2.500 but we also get the same results in Kinetic 2022.2.

In both versions we get the same error message “Staged PCID xxxxxx has been updated by another user.”

This happens on calling the ReceiveMfgPCIDtoInventory method in the ReceiptsFromMfg business object. Using the BL Tester or a Function that we created also gives the same error.

I’ve noticed that a couple of the calls seem to wipe out the PCIDReceiptParams dataset and we have to fill it back in. It can’t be empty, so it has to be filled in or the call won’t fire. Is this the cause of my mysterious “updated by another user” error or is Epicor just doing secret things that don’t show in the Trace Log?

Has anyone else attempted or successfully recorded a PCID Receipt to Inventory without manually doing so?

Hi Chat, were you be able to solve this issue?

Y’all holler at me tomorrow. We do it everyday.

I solve it, you just need to set RowMod states

using( Erp.Contracts.ReceiptsFromMfgSvcContract rcpH = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.ReceiptsFromMfgSvcContract>(Db))
{
var SelectedReceiptsPCIDDS = new Erp.Tablesets.SelectedReceiptsPCIDTableset();
rcpH.GetNewPCIDParamsRow(ref SelectedReceiptsPCIDDS);

            var PCIDReceiptsParamsRow = SelectedReceiptsPCIDDS.PCIDReceiptsParams.FirstOrDefault();
            if( PCIDReceiptsParamsRow != null )
            {
                PCIDReceiptsParamsRow.RowMod = "A";
            }
            
            var ReceiptsFromMfgDS = new Erp.Tablesets.ReceiptsFromMfgTableset();
            string pcProcessID = "RcptToInvEntry";
            string warehouseCode = "JRZ";
            rcpH.OnChangePCIDParamWarehouseCode( ref SelectedReceiptsPCIDDS , ref ReceiptsFromMfgDS , pcProcessID , warehouseCode);

            rcpH.OnChangePCIDParamsBinNum( ref SelectedReceiptsPCIDDS, ref ReceiptsFromMfgDS, binNum);
 
            string tranType = "MFG-STK";
            string processID = "RcptToInvEntry";
            
            Erp.Tablesets.PCIDReceiptsSelectedRow PCIDRecSelRow = new Erp.Tablesets.PCIDReceiptsSelectedRow();
            if( PCIDRecSelRow != null )
            {
                PCIDRecSelRow.PCID = PCID;
                PCIDRecSelRow.Company = Session.CompanyID;
                PCIDRecSelRow.RowMod = "A";
                SelectedReceiptsPCIDDS.PCIDReceiptsSelected.Add(PCIDRecSelRow);
            }
            
            rcpH.GetNewReceiptsFromPCIDMultiple(ref SelectedReceiptsPCIDDS, tranType, processID);
            
            var PCIDRECSelectedRow = SelectedReceiptsPCIDDS.PCIDReceiptsSelected.FirstOrDefault();
            if( PCIDRECSelectedRow != null )
            {
                PCIDRECSelectedRow.RowMod = "A";
            }
            
            bool requiresUserInput = false;
            
            var PartTranRow = ReceiptsFromMfgDS.PartTran.FirstOrDefault();
            if( PartTranRow != null )
            {
                PartTranRow.RowMod = "U";
            }
            
            rcpH.PreUpdate(ref ReceiptsFromMfgDS , out requiresUserInput );

            string pcid = PCID;
            string pcMessage = ""; 
            string pcPartTranPKs = "";
            rcpH.ReceiveMfgPCIDtoInventory(ref ReceiptsFromMfgDS, ref SelectedReceiptsPCIDDS , pcid, pcProcessID, out pcMessage, out pcPartTranPKs );

        }