Web Services Dynamics Navision 2017 -使用Web服务插入销售订单

sz81bmfz  于 2022-11-15  发布在  其他
关注(0)|答案(3)|浏览(147)

我们有Navision Dynamics 2017,它将销售订单公开为SOAP Web服务。从技术上讲,我应该能够通过此Web服务创建销售订单。
我们还有另一个用C# .NET构建的系统,该系统包含需要输入Navision的员工销售订单。该订购系统包含客户、项目、数量、价格等所有信息,以便能够在Navision中创建有效订单。
有人能告诉我如何调用该服务,并从员工销售订单系统创建销售题头和行到Navision中吗?
最好是一个步行通过教程将是理想的。我已经搜索,似乎不能找到一个,我可以遵循

ehxuflar

ehxuflar3#

下面是我在使用.NET Core 5开发的其余API中所做的工作,我创建了2个页面(一个用于销售标题,一个用于销售行)和一个代码单元,用于在NAV上调用计算折扣操作。

[Route("order")]
[HttpPost]
private async Task<dynamic> createOrder(orderDTO request)
    {
        var systemService = this.OrderServiceProvider.GetProxy();
        List<OrderServiceReference.Sales_Quote_Line> lineList = new List<OrderServiceReference.Sales_Quote_Line>();
        foreach (OrderLine orderLine in request.Sales_Quote_Line)
        {
            Sales_Quote_Line line = new Sales_Quote_Line()
            {
                Type = OrderServiceReference.Type.Item,
                TypeSpecified = true,
                No = orderLine.No,
                Quantity = orderLine.Quantity,
                QuantitySpecified = true
            };
            lineList.Add(line);
        }
        var task = await systemService.CreateAsync(new OrderServiceReference.Create()
        {
            Dis_SQ = new Dis_SQ()
            {
                Salesperson_Code = request.Salesperson_Code,
                Sell_to_Customer_No = request.Sell_to_Customer_No,
                Order_Date = new DateTime(),
                SalesLines = lineList.ToArray()
            }
        });
        var salesQuotes = task.Dis_SQ;
        // var systemService2 = new DiscountServiceReference.Dis_Discount_Cal_PortClient();
        var calculateSystemWebService = this.CalculateDiscountServiceProvider.GetProxy();
        await calculateSystemWebService.CalcOffersSHAsync(new CalcOffersSH()
        {
            Body = new CalcOffersSHBody()
            {
                pDocNo = salesQuotes.No,
                pDocType = 0
            }
        });
        // get sales lines
        var systemService1 = this.OrderLinesServiceProvider.GetProxy();
        var task1 = await systemService1.ReadMultipleAsync(new SalesOrderServiceReference.ReadMultiple()
        {
            filter = new HHT_SO_Filter[]
            {
                new HHT_SO_Filter()
                {
                    Criteria = salesQuotes.No,
                    Field = HHT_SO_Fields.Document_No
                }
            },
            bookmarkKey = "",
            setSize = 200
        });
        return new
        {
            sales_header = task.Dis_SQ,
            sales_line = task1.ReadMultiple_Result1
        };
 }

如果您需要更多帮助,请在下面留言。

相关问题