如何查看通过Dynamics GP UI中的CreateSalesInvoice Web服务调用创建的发票?

时间:2019-03-29 18:25:24

标签: c# web-services native dynamics-gp

这是我第一次进行Dynamics GP集成,因此我需要一些帮助。我可以通过调用本地Web服务从C#成功创建发票。但是,我在Dynamics GP中看不到此发票。我尝试按客户ID,日期等进行查找。就C#调用而言,它成功执行,没有任何错误。当我在Fiddler中观看呼叫时,所有呼叫也都具有HTTP 200响应。

我尝试了其他“创建”调用,例如创建供应商,并且可以在Dynamics GP UI中看到。

    SalesInvoice salesInvoice;
    SalesInvoiceLine salesInvoiceLine;
    Policy salesInvoiceCreatePolicy;

    // Create an instance of the service
    DynamicsGPClient wsDynamicsGP = new DynamicsGPClient();

    // Create a context with which to call the service
    var context = new Context
    {
        // Specify which company to use (sample company)
        // Set up the context object
        OrganizationKey = new CompanyKey
        {
            Id = 3
        }
    };

    // Create a sales invoice object
    salesInvoice = new SalesInvoice
    {
        // Create a sales document type key for the sales invoice
        // Populate the document type key for the sales invoice
        DocumentTypeKey = new SalesDocumentTypeKey
        {
            Type = SalesDocumentType.Invoice

        },

        // Create a customer key
        // Set the customer key property of the sales invoice
        CustomerKey = new CustomerKey
        {
            Id = "1561"
        },
    };

    // Create a sales invoice line to specify the invoiced item
    salesInvoiceLine = new SalesInvoiceLine
    {
        // Create an item key
        // Set the item key property of the sales invoice line object
        ItemKey = new ItemKey
        {
            Id = "10"
        },

        // Create a sales invoice quatity object
        // Set the quantity of the sales invoice line object
        Quantity = new Quantity
        {
            Value = 15
        },

        UofM = "EA",
    };

    // Create an array of sales invoice lines
    // Initialize the array with the sales invoice line object
    SalesInvoiceLine[] invoiceLines = { salesInvoiceLine };

    // Add the sales invoice line array to the sales line object
    salesInvoice.Lines = invoiceLines;

    // Get the create policy for the sales invoice object
    salesInvoiceCreatePolicy = wsDynamicsGP.GetPolicyByOperation("CreateSalesInvoice", context);

    // Create the sales invoice
    wsDynamicsGP.CreateSalesInvoice(salesInvoice, context, salesInvoiceCreatePolicy);

    // Close the service
    if (wsDynamicsGP.State != CommunicationState.Faulted)
    {
        wsDynamicsGP.Close();
    }

我在做什么错?如何从Dynamics GP UI看到此发票?

0 个答案:

没有答案