I was trying to make an inventory transfer from adpaters so i can make the transfer but only using the same lotnum , i need to make the transfer from a lotnum to a new lotnum but the system requier “A lotnum valid is required”. I try to use the the ChangeLot() method but i dont know how it is working
any help`?
My code
string PartNum = “275552TIWANDERSPO+” ;string UOM=“KILO”;
InvTransferAdapter invTransferAdapter = new InvTransferAdapter(oTrans);
invTransferAdapter.BOConnect();
InvTransferDataSet transferRecord = invTransferAdapter.GetTransferRecord(PartNum,UOM);
invTransferAdapter.InvTransferData.Clear();
invTransferAdapter.InvTransferData.Merge(transferRecord);
invTransferAdapter.InvTransferData.AcceptChanges();
InvTransferDataSet.InvTransDataTable table = (InvTransferDataSet.InvTransDataTable)invTransferAdapter.InvTransferData.InvTrans;
if (table.Count != 0)
{
DataRow dr = table.Rows[0];
dr.BeginEdit();
dr["TransferQty"] = 2;
dr["FromWarehouseCode"] = "03";
dr["FromBinNum"] = "A1";
dr["FromLotNumber"] = "178490377001621";// my lotnum
dr["ToWarehouseCode"] = "04";
dr["ToBinNum"] = "A1";
dr["ToLotNumber"] = "178490377001621CC"; // New lotnum
dr["TranReference"] = "mov ext fiscal";
dr.EndEdit();
string str6;
string str7;
InvTransferDataSet.InvTransRow row1 = (InvTransferDataSet.InvTransRow)table.Rows[0];
string partNum = row1.PartNum;
string fromWarehouseCode = row1.FromWarehouseCode;
string fromBinNum = row1.FromBinNum;
string fromLotNumber = row1.FromLotNumber;
string transferQtyUOM = row1.TransferQtyUOM;
decimal pdTranQty = 1M;
decimal pdDimConvFactor = decimal.Parse(row1.TransferQty.ToString());
//-------------------------- I try this but it does not work
//invTransferAdapter.ChangeLot(transferRecord);
//MessageBox.Show("change lotnum");
invTransferAdapter.NegativeInventoryTest(partNum, fromWarehouseCode, fromBinNum, fromLotNumber,"", transferQtyUOM, pdDimConvFactor, pdTranQty, out str6, out str7);
if (string.Compare(str6, "Ask User", true) == 0)
{
//MessageBox.Show("Bloque 1.2.1");
if (MessageBox.Show(str7, "", MessageBoxButtons.OKCancel) != DialogResult.OK)
{
//MessageBox.Show("Bloque 1.2.2");
return;
}
}
else if (string.Compare(str6, "Stop", true) == 0)
{
MessageBox.Show(str7);
return;
}
InvTransferDataSet.InvTransRow rowN = (InvTransferDataSet.InvTransRow)table.Rows[0];
bool requiresUserInput = false;
bool flag2 = true;
try
{
if (!invTransferAdapter.PreCommitTransfer(invTransferAdapter.InvTransferData, out requiresUserInput))
{
return;
}
}
catch (Exception exc)
{
MessageBox.Show(exc.ToString());
return;
}
if (flag2)
{
string str16;
string str8 = row1.TransferQty.ToString();
string str9 = row1.TransferQtyUOM;
string fromWarehouseDesc = row1.FromWarehouseDesc;
string fromBinDesc = row1.FromBinDesc;
string toWarehouseDesc = row1.ToWarehouseDesc;
string toBinDesc = row1.ToBinDesc;
string toLotNumber = row1.ToLotNumber;
string legalNumberMessage = "";
bool flag3 = invTransferAdapter.CommitTransfer( out legalNumberMessage, out str16);
MessageBox.Show("Inventory transfer");
}// IF flag 2
}//FIn if cuenta
invTransferAdapter.Dispose();
// Fin inventory transfer