Skip to Content

UoM error Inventory Transfer with DI API

Good day experts, I'm doing tests in .net with a code that generates a stock transfer using DI API, taking the information from a GridView loaded with a DataTable like this:

I specify the article code, the total amount of the line, lots, etc. In most cases it works correctly and generates the document without problem, but there are certain items that generate an error in the selection of batchs by handling an alternative unit of measurement. I explain, the problem in particular I have it with some boxes of tubes, where the code of the article represents a single tube piece, but when activating the alternative unit, for each "box" it take "x" number of tubes, as in the following example:

When wanting to generate a stock transfer with this information I get the following error: Error: Can not add row without complete selection of batch / serial numbers | Error code: -4014 I was looking for properties in the group "Lines" and "BatchNumbers" but I can not find the solution. I also add the fragment of the code in C # that builds the lines in case it can contribute something to the case:

foreach(DataRow dr in Shared.lotesTransferencia.Rows)
{
    if(i != 0)
        nuevaTransferencia.Lines.Add();

    nuevaTransferencia.Lines.SetCurrentLine( Int32.Parse( dr["NumLineaArticulo"].ToString() ) );
    nuevaTransferencia.Lines.ItemCode = dr["Articulo"].ToString();
    nuevaTransferencia.Lines.Quantity = double.Parse(dr["Total"].ToString());
    nuevaTransferencia.Lines.WarehouseCode = ddlAlmacenDestino.SelectedItem.Text;

    // Prueba para unidad de medida
    nuevaTransferencia.Lines.UseBaseUnits = BoYesNoEnum.tNO;
    nuevaTransferencia.Lines.MeasureUnit = dr["UnidadMedida2"].ToString();

    nuevaTransferencia.Lines.BatchNumbers.SetCurrentLine( Int32.Parse( dr["NumLineaLote"].ToString() ) );
    nuevaTransferencia.Lines.BatchNumbers.BatchNumber = dr["Lote"].ToString();
    nuevaTransferencia.Lines.BatchNumbers.Quantity = double.Parse( dr["Cantidad"].ToString() );
    nuevaTransferencia.Lines.BatchNumbers.Add();

    i++;
}

Has anyone had a similar problem? I thank you in advance for any comments or guidance you may give me. Best regards.

image.jpg (19.7 kB)
image-1.jpg (23.6 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers