# Inventory transfer changing lotnum

**URL:** <https://www.epiusers.help/t/inventory-transfer-changing-lotnum/37439>\
**Category:** Epicor ERP 10\
**Created:** [February 27, 2017, 8:03pm UTC](https://www.epiusers.help/t/inventory-transfer-changing-lotnum/37439 "2017-02-27T20:03:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![egranados](https://www.epiusers.help/user_avatar/www.epiusers.help/egranados/32/17315_2.png) [@egranados](https://www.epiusers.help/u/egranados)\
**Post date:** [February 27, 2017, 8:03pm UTC](https://www.epiusers.help/t/inventory-transfer-changing-lotnum/37439/1 "2017-02-27T20:03:19Z")

</div>

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
```

---

<div class="post-metadata">

**Author:** ![duckor](https://www.epiusers.help/user_avatar/www.epiusers.help/duckor/32/611_2.png) [@duckor](https://www.epiusers.help/u/duckor)\
**Post date:** [February 27, 2017, 10:19pm UTC](https://www.epiusers.help/t/inventory-transfer-changing-lotnum/37439/2 "2017-02-27T22:19:37Z")

</div>

Enrique,

Does this script work if the lot does not change?

---

<div class="post-metadata">

**Author:** ![egranados](https://www.epiusers.help/user_avatar/www.epiusers.help/egranados/32/17315_2.png) [@egranados](https://www.epiusers.help/u/egranados)\
**Post date:** [February 27, 2017, 10:57pm UTC](https://www.epiusers.help/t/inventory-transfer-changing-lotnum/37439/3 "2017-02-27T22:57:30Z")

</div>

> [@egranados](#):
>
> 178490377001621

Hi duckor  
Yes it works if a use the same lotnum (E.g 178490377001621 to lotnum 178490377001621)  
but if i try to use a new lotnum the system says “A valid lotnum” is required.

Thanks & regards.

---

<div class="post-metadata">

**Author:** ![duckor](https://www.epiusers.help/user_avatar/www.epiusers.help/duckor/32/611_2.png) [@duckor](https://www.epiusers.help/u/duckor)\
**Post date:** [February 28, 2017, 3:38pm UTC](https://www.epiusers.help/t/inventory-transfer-changing-lotnum/37439/4 "2017-02-28T15:38:44Z")

</div>

So when running it manually I notice that a lot change prompts to create a new lot. This is the step you are missing which I believe is from LotSelectUpdate. When the lot for that part existed already it does not prompt. So the first time I used my script to transfer from lot 123 to 321 it wouldn’t work. When I manually did it my script then started working since it now existed and ChangeLot was not required.

I’m 95% sure LotSelectUpdate is what you need to be looking at but I haven’t dug into how to use it.
