Error writing the Stock V900 document

1

For a customer in Mozambique I'm having a write to the stock document ( C # ) by spring engines, the error happens in the method:

bso.Comercial.Stocks.Actualiza(objDocStockDestino)

I've simulated the same scenario inside the spring vba6 and it works.

Below a part of the code:

public void processa(DataTable dataSource,DateTime dataDoc, string artigoDestino, string unidadeDestino,
    string armazemDestino,double qntDestino,string maquina)
{
    try
    {
        double qnt;
        string artigoOrigem;
        string unidadeOrigem;
        string armazemOrigem;
        string tipodoc;
        string erros;

        GcpBEDocumentoStock objDocStock = new GcpBEDocumentoStock();

        tipodoc = SS";

        objDocStock.set_Tipodoc(tipodoc);
        objDocStock.set_Serie(bso.Comercial.Series.DaSerieDefeito("S", tipodoc, dataDoc));

        bso.Comercial.Stocks.PreencheDadosRelacionados(objDocStock);

        objDocStock.set_DataDoc(dataDoc);

        objDocStock.get_CamposUtil().set_Item("CDU_Maquina",maquina);

        objDocStock.set_Moeda(bso.Contexto.MoedaBase);
        objDocStock.set_EmModoEdicao(false);
        objDocStock.set_TipoEntidade("C");

        foreach (DataRow item in dataSource.Rows)
        {
            qnt = Convert.ToDouble(item["Qnt"]);
            artigoOrigem = Convert.ToString(item["Cod. Mp"]);
            unidadeOrigem = Convert.ToString(item["UN"] );
            armazemOrigem = Convert.ToString(item["Tank"]);

            if (qnt > 0)
            {
                bso.Comercial.Stocks.AdicionaLinha(objDocStock, artigoOrigem, "",qnt, armazemOrigem);
            }
        }

        bso.Comercial.Stocks.Actualiza(objDocStock);
    }
    catch(Exception ex)
    {
        escreveLog(string.Format("Ocorreu um erro devido a: {0} {1}", ex.Message, ex.InnerException));
        throw ex;
    }
}

GCP build is 09.1509.1038 .

    
asked by anonymous 23.08.2018 / 09:51

0 answers