HI all,
i am getting an error when doing an inventory transfer via BPM that is triggered by change in UD40…
I have tried InTran Data directive and Update Method PostProcessing in MethodDirective but get the same error in both cases.
The issue is only happening when duplicate parts need to be transfered…
using (var txScope = IceDataContext.CreateDefaultTransactionScope())
{
try
{
sbDebugMsg.AppendLine(string.Format("{0:yyyy-MM-dd__HH:mm:ss} - > > > > > > > > > > Transferring Stock > > > > > > > > > >", System.DateTime.Now));
toWarehouseCode = tt.WarehouseCode;
toBinNum = tt.BinNum;
Erp.Contracts.InvTransferSvcContract svcInvTransfer = null;
svcInvTransfer = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.InvTransferSvcContract>(Db);
var dsInvTransfer = new Erp.Tablesets.InvTransferTableset();
sbDebugMsg.AppendLine(string.Format("{0:yyyy-MM-dd__HH:mm:ss} - GetTransferRecord", System.DateTime.Now));
dsInvTransfer = svcInvTransfer.GetTransferRecord(tt.PartNum, "CT");
var ttInvTrans = (from r in dsInvTransfer.InvTrans select r).FirstOrDefault();
if(ttInvTrans != null)
{
ttInvTrans.TranReference = "Pack:" + tt.PackNum;
ttInvTrans.TransferQty = tt.OurInventoryShipQty;
ttInvTrans.TrackingQty = tt.OurInventoryShipQty;
ttInvTrans.RowMod = "U";
sbDebugMsg.AppendLine(string.Format("{0:yyyy-MM-dd__HH:mm:ss} - ChangeUOM ({1:#})", System.DateTime.Now, tt.OurInventoryShipQty));
svcInvTransfer.ChangeUOM(ref dsInvTransfer);
sbDebugMsg.AppendLine(string.Format("{0:yyyy-MM-dd__HH:mm:ss} - ttInvTrans.FromWhse/BinNum ({1}/{2}) -> ttInvTrans.ToWhse/BinNum ({3}/{4})"
, System.DateTime.Now, ttInvTrans.FromWarehouseCode, ttInvTrans.FromBinNum, ttInvTrans.ToWarehouseCode, ttInvTrans.ToBinNum));
if (!string.Equals(ttInvTrans.FromWarehouseCode, fromWarehouseCode, StringComparison.OrdinalIgnoreCase))
{
ttInvTrans.FromWarehouseCode = fromWarehouseCode;
sbDebugMsg.AppendLine(string.Format("{0:yyyy-MM-dd__HH:mm:ss} - \tChangeFromWhse ({1})", System.DateTime.Now, fromWarehouseCode));
svcInvTransfer.ChangeFromWhse(ref dsInvTransfer);
}
if (!string.Equals(ttInvTrans.FromBinNum, fromBinNum, StringComparison.OrdinalIgnoreCase))
{
ttInvTrans.FromBinNum = fromBinNum;
sbDebugMsg.AppendLine(string.Format("{0:yyyy-MM-dd__HH:mm:ss} - \tChangeFromBin ({1})", System.DateTime.Now, fromBinNum));
svcInvTransfer.ChangeFromBin(ref dsInvTransfer);
}
if (!string.Equals(ttInvTrans.ToWarehouseCode, toWarehouseCode, StringComparison.OrdinalIgnoreCase))
{
ttInvTrans.ToWarehouseCode = toWarehouseCode;
sbDebugMsg.AppendLine(string.Format("{0:yyyy-MM-dd__HH:mm:ss} - \tChangeToWhse ({1})", System.DateTime.Now, toWarehouseCode));
svcInvTransfer.ChangeToWhse(ref dsInvTransfer);
}
if (!string.Equals(ttInvTrans.ToBinNum, toBinNum, StringComparison.OrdinalIgnoreCase))
{
ttInvTrans.ToBinNum = toBinNum;
sbDebugMsg.AppendLine(string.Format("{0:yyyy-MM-dd__HH:mm:ss} - \tChangeToBin ({1})", System.DateTime.Now, toBinNum));
svcInvTransfer.ChangeToBin(ref dsInvTransfer);
}
bool RequiresUserInput = false;
sbDebugMsg.AppendLine(string.Format("{0:yyyy-MM-dd__HH:mm:ss} - PreCommitTransfer ({1}/{2} -> {3}/{4},{5})",
System.DateTime.Now, ttInvTrans.FromWarehouseCode, ttInvTrans.FromBinNum, ttInvTrans.ToWarehouseCode, ttInvTrans.ToBinNum, tt.PartNum));
svcInvTransfer.PreCommitTransfer(ref dsInvTransfer, out RequiresUserInput);
ttInvTrans.RowMod = "U";
string LegalNumberMessage, partTranPKs;
sbDebugMsg.AppendLine(string.Format("{0:yyyy-MM-dd__HH:mm:ss} - CommitTransfer...", System.DateTime.Now));
svcInvTransfer.CommitTransfer(ref dsInvTransfer, out LegalNumberMessage, out partTranPKs);
sbDebugMsg.AppendLine(string.Format("{0:yyyy-MM-dd__HH:mm:ss} - ...Completed", System.DateTime.Now));
}
svcInvTransfer.Dispose();
dsInvTransfer = null;
txScope.Complete();
}
catch (Exception ex)
{
sbDebugMsg.AppendFormat(" … Failed!! [{0}]\r\n{1}\r\n{2}\r\n", ex.Message, ex.StackTrace, ex.InnerException);
txScope.Dispose();
}
} // using (var txScope = IceContext.CreateDefaultTransactionScope())
// tt.ToTransfer_c = false;
Erp.Internal.Lib.DeferredUpdate libDeferredUpdate = new Erp.Internal.Lib.DeferredUpdate(Db);
libDeferredUpdate.UpdPQDemand();
}