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 a comment
10|10000 characters needed characters exceeded

Related questions

0 Answers

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.