Great Plains查找销售订单

时间:2013-05-21 14:47:27

标签: microsoft-dynamics dynamics-gp

我在Great Plains创建了销售订单,但是,我找不到它们在系统中的正确位置。虽然我的代码执行没有任何错误,但我在Sales>下找不到此事务。所有销售交易。相反,我在Sales>下看到了它们。销售文件。

是否处于待定状态?

enter image description here enter image description here

        public void CreateOrder()
    {
        CompanyKey companyKey;
        Context context;
        SalesOrder salesOrder;
        SalesDocumentTypeKey salesOrderType;
        CustomerKey customerKey;
        BatchKey batchKey;
        SalesOrderLine salesOrderLine;
        ItemKey orderedItem;
        Quantity orderedAmount;
        Policy salesOrderCreatePolicy;

        // Create a context with which to call the service
        context = new Context();

        // Specify which company to use (sample company)
        companyKey = new CompanyKey();
        companyKey.Id = (-1);

        // Set up the context object
        context.OrganizationKey = (OrganizationKey)companyKey;

        // Create a sales order object
        salesOrder = new SalesOrder();

        // Create a sales document type key for the sales order
        salesOrderType = new SalesDocumentTypeKey();
        salesOrderType.Type = SalesDocumentType.Order;

        // Populate the document type key of the sales order object
        salesOrder.DocumentTypeKey = salesOrderType;

        // Create a customer key
        customerKey = new CustomerKey();
        customerKey.Id = "JONESJ008";

        // Set the customer key property of the sales order object
        salesOrder.CustomerKey = customerKey;
        // Create a batch key
        batchKey = new BatchKey();
        batchKey.Id = "SALES ORDERS";

        // Set the batch key property of the sales order object
        salesOrder.BatchKey = batchKey;

        // Create a sales order line to specify the ordered item
        salesOrderLine = new SalesOrderLine();

        // Create an item key
        orderedItem = new ItemKey();
        orderedItem.Id = "32X IDE";

        // Set the item key property of the sales order line object
        salesOrderLine.ItemKey = orderedItem;

        // Create a sales order quantity object
        orderedAmount = new Quantity();
        orderedAmount.Value = 4;

        // Set the quantity of the sales order line object
        salesOrderLine.Quantity = orderedAmount;

        // Create an array of sales order lines
        // Initialize the array with sales order line object
        SalesOrderLine[] orders = { salesOrderLine };

        // Add the sales order line array to the sales order
        salesOrder.Lines = orders;

        // Get the create policy for the sales order object
        salesOrderCreatePolicy = wsDynamicsGP.GetPolicyByOperation("CreateSalesOrder", context);

        // Create the sales order
        wsDynamicsGP.CreateSalesOrder(salesOrder, context, salesOrderCreatePolicy);


    }

我看过Sales>所有销售交易。我可以使用API​​来提取此订单。我正在使用样本公司文件Fabrikam,Inc。以下是我如何设置我的上下文:

        public GPOrders()
    {
        wsDynamicsGP = new DynamicsGP();
        // Be sure the default credentials are used
        wsDynamicsGP.UseDefaultCredentials = true;

        // Create a context with which to call the web service
        context = new Context();

        // Specify which company to use (sample company)
        companyKey = new CompanyKey();
        companyKey.Id = (-1);

        // Set up the context object
        context.OrganizationKey = (OrganizationKey)companyKey;
        context.CultureName = "en-US";

    }

1 个答案:

答案 0 :(得分:0)

我在Sales>下找到了它们销售文件。交易从未过帐,因此它们不在销售>所有销售交易。