InvTransfer Adapter in 10.2.300 error Transfer record not found

Hello!

This BO was changed significantly between 10.1 and 10.2.300, as such I needed to tweak it.
I get a “Transfer record not found” exception when attempting the commit method.

All methods work as expected, until I get to commit, and my dataset is being passed successfully (checked the tracelog). Does anyone have any ideas?
Code:

string partNum;
string serialWarning;
string questionString;
bool multipleMatch;
string uomCode = “”;
string pcNeqQtyAction;
string pcMessage;
bool rowAdded;
// PreCommitTransfer
bool requiresUserInput;

	// CommitTransfer
	string legalNumberMessage;
	string partTranPKs;
	
	bool hadErrors = false;
	
	try
	{
		InvTransferAdapter adpInvTran = new InvTransferAdapter(this.oTrans);
		adpInvTran.BOConnect();
		foreach(DataRowView drUD in edvUD100A.dataView)
		{
			if (Convert.ToDecimal(drUD["Number01"]) > Convert.ToDecimal(drUD["Number02"])) { hadErrors = true; continue; }
			
			if (Convert.ToDecimal(drUD["Number01"]) <= 0 || !Convert.ToBoolean(drUD["CheckBox01"]) || Convert.ToBoolean(drUD["CheckBox20"])) continue;
			partNum = drUD["ChildKey1"].ToString();
			//MessageBox.Show(partNum);
			using (oTrans.PushDisposableStatusText(GetStringByID("Transfer") + " " + partNum,true))
			{
				Byte[] bytes = new Byte[16];

				Guid guid2 = Guid.NewGuid();
				Guid getTransferRecordSysRowId = Guid.NewGuid();
				adpInvTran.GetPartXRefInfo(ref partNum, ref uomCode, guid2, string.Empty, out serialWarning, out questionString, out multipleMatch);
				
				Erp.BO.InvTransferDataSet dsInvTrans = adpInvTran.GetTransferRecord(getTransferRecordSysRowId, drUD["ChildKey1"].ToString(), string.Empty, uomCode, out rowAdded);

				//adpInvTran.InvTransferData.InvTrans.Rows.Add(dsInvTrans.Tables["InvTrans"].Rows[0].ItemArray);

				

				dsInvTrans.Tables["InvTrans"].Rows[0]["TransferQty"] = drUD["Number01"];
				MessageBox.Show("Row xfer qty!: " + dsInvTrans.Tables["InvTrans"].Rows[0]["TransferQty"]);

				dsInvTrans.Tables["InvTrans"].Rows[0]["TrackingQty"] = drUD["Number01"];
				dsInvTrans.Tables["InvTrans"].Rows[0]["FromPlantTracking"] = false;
				dsInvTrans.Tables["InvTrans"].Rows[0]["ToPlantTracking"] = false;
				adpInvTran.ChangeUOM();
				//dsInvTrans.Tables["InvTrans"].Rows[0]["RowMod"] = "U";
				
				dsInvTrans.Tables["InvTrans"].Rows[0]["FromWarehouseCode"] = drUD["Key3"];
				adpInvTran.ChangeFromWhse(dsInvTrans.Tables["InvTrans"].Rows[0]["FromWarehouseCode"].ToString());
				dsInvTrans.Tables["InvTrans"].Rows[0]["FromBinNum"] = drUD["ShortChar09"];
				adpInvTran.ChangeFromBin(dsInvTrans.Tables["InvTrans"].Rows[0]["FromBinNum"].ToString());
				
				dsInvTrans.Tables["InvTrans"].Rows[0]["ToWarehouseCode"] = drUD["Key4"];
				adpInvTran.ChangeToWhse(dsInvTrans.Tables["InvTrans"].Rows[0]["ToWarehouseCode"].ToString());
				dsInvTrans.Tables["InvTrans"].Rows[0]["ToBinNum"] = drUD["ShortChar10"];
				adpInvTran.ChangeToBin(dsInvTrans.Tables["InvTrans"].Rows[0]["ToBinNum"].ToString());
				//dsInvTrans.Tables["InvTrans"].Rows[0]["RowMod"] = "U";
				MessageBox.Show("Row Complete! Beginning Pre Commit");
				#region Validation Checks	
				bool okToUpdate = true;
				try
				{
					adpInvTran.PreCommitTransfer(dsInvTrans, out requiresUserInput);
				}
				catch(Ice.Common.BusinessObjectException e)
				{
					ExceptionBox.Show(e, EpiString.GetString("BusinessObjectException"));
					return;
				}
				if(requiresUserInput)
				{
					/*DialogResult dialogResult = (DialogResult) LegalNumberPromptEntry.LegalNumberPromptArgs.Start(
						this,adapter.InvTransferData.LegalNumGenOpts, true);
					if(dialogResult != DialogResult.OK)
						okToUpdate = false;*/

				}
				if(!okToUpdate) { hadErrors = true; continue; }
				#endregion
				MessageBox.Show("Pre Commit Complete! Beginning Commit");
				adpInvTran.CommitTransfer(out legalNumberMessage, out partTranPKs);
				dsInvTrans.Tables["InvTrans"].Rows[0].Delete();
				drUD["CheckBox20"] = true;
				
			} //end loop of records
			
		}	
		adpInvTran.Dispose();

Never mind I finally got it!

I needed to add row mod “a” between the pre-commit and commit methods! Woooo!

3 Likes

Very useful thanks!

This code doesn’t work in 10.2.300 - the function calls contain an invalid number of parameters and looking back to 10.1.x.x I’m not seeing these calls ever taking that many parameters. What references did you include, perhaps I’m missing something?

Thank you Jeff. Changing the row mod to A between precommit and commit did it.

I am on version 2022.2.1

Word of warning, if your item is in a PCID but you do not fill in the PCID field in the dataset it will transfer the inventory but remove it from the PCID. It will also mess up the PartLot table.
I transfered 11 from one bin to another. I have 11 in the new bin but 11 in the old bin and also a record with -11 in the old bin. Adding the PCID field to the dataset and all was good.

I still have use cases to test but I was able to transfer items and keep the PCID as well.