Spring API - Properties of GcpBEDocumentoVenda do not assume my values [closed]

-1

When I insert an order for the final consumer, I enter the name and address of the client in that document ie based on C # code using your API and from what I could understand it should be something like

GcpBEDocumentoVenda invoice = new GcpBEDocumentoVenda();
try
{
   invoice.set_Tipodoc(<DocumentoEncomenda>);
   invoice.set_Entidade(<ClientID>);  
   invoice.set_TipoEntidade("C");
   invoice.set_Serie(<DocumentoSerie>);
   invoice.set_DataDescarga(<CreatedOn.ToString("yyyy-MM-dd HH:mm:ss")>);
   invoice.set_Observacoes(order.Observations);
   invoice.set_MoradaEntrega(<order.ShipToInfo.Address1>);
   invoice.set_DataDoc(DateTime.Parse(String.Format("{0:yyyy-MM-dd HH:mm:ss}", CreatedOn)));


   invoice.set_Morada(<Address>);
   invoice.set_NomeEntrega(<Name>);
   invoice.set_Localidade(<City>);
   invoice.set_CodigoPostal(<ZipCode>);
   invoice.set_LocalidadeCodigoPostal(<City>);

   Engine.Comercial.Vendas.PreencheDadosRelacionados(invoice);

If you put the parameter invoice.set_NomeEntrega(<Name>); the function gives an error stating that the

All other parameters do not make any results in the order

If after this call the methods get always returns a null

If you create the order directly in the spring this lets you enter this data as you would create a final consumer order with data.

    
asked by anonymous 04.04.2018 / 13:53

1 answer

2

In order to be able to change any attributes associated with the object, they can not be set properties before calling Engine.Comercial.Vendas.PreencheDadosRelacionados(invoice); because this method of the API will override SET values.

private void cmdSave_Click(object sender, EventArgs e)
    {
        GcpBEDocumentoVenda invoice = new GcpBEDocumentoVenda();
        string strAvisos = string.Empty;

        invoice.set_Tipodoc("FA");
        invoice.set_Entidade("Sofrio");
        invoice.set_TipoEntidade("C");
        invoice.set_Serie("2018");

        try
        {
            PriEngine.Engine.Comercial.Vendas.PreencheDadosRelacionados(invoice);
            invoice.set_Nome("Aqui o Nome");

            GcpBELinhasDocumentoVenda linhas = new GcpBELinhasDocumentoVenda();

            PriEngine.Engine.Comercial.Vendas.AdicionaLinha(invoice, "A0001", 1);
            linhas = invoice.get_Linhas();
            linhas[1].get_CamposUtil().set_Item("CDU_LinVar1", "12");
            linhas[1].get_CamposUtil().set_Item("CDU_LinVar2", "132323");
            linhas[1].set_Desconto1(10);

            PriEngine.Engine.Comercial.Vendas.Actualiza(invoice, ref strAvisos);

        }
        catch (Exception ex)
        {
            MessageBox.Show("Unable to save document. \n" + ex.Message);
        }
    }

The invoice.set_NomeEntrega(<Name>); property is for ignore, it still only exists for backward compatibility.

    
04.04.2018 / 15:47