【问题标题】:Add PO lines using Acumatica Contract based SOAP API使用基于 Acumatica 合同的 SOAP API 添加采购订单行
【发布时间】:2021-06-21 11:47:33
【问题描述】:

我正在尝试使用基于 Acumatica 合同的 API 创建 PO。如何添加循环遍历要添加到 PO 的项目列表的行。我看到的所有示例都有代码为添加到 PO 的每个项目创建一个新的 PurchaseOrderDetails

PurchaseOrders purchaseOrders = new PurchaseOrders()
{
    Vendor = new AcumaticaService.StringValue { Value = poList[0].VendorId }
};
purchaseOrders.Details = new PurchaseOrderDetails[]
{
    new PurchaseOrderDetails
    {
        InventoryID = new StringValue  {Value = "3BA0130" } ,
        OrderQty = new DecimalValue {Value = 3}
    },
    new PurchaseOrderDetails
    {
        InventoryID = new StringValue  {Value = "3BA0138" } ,
        OrderQty = new DecimalValue {Value = 5}
    }
};

我需要能够遍历产品列表并将它们添加到采购订单中。我期待能够做这样的事情

    foreach (POListProduct pOListProduct in pOListProducts)
    {
       // PurchaseOrderDetails purchaseOrderDetails = new PurchaseOrderDetails()
       {
          PurchaseOrderDetails purchaseOrderDetails = new PurchaseOrderDetails()
          {
            InventoryID = new StringValue { Value = pOListProduct.Product_No },
            OrderQty = new DecimalValue { Value = pOListProduct.AdjustedQuantity }
          };
       };
       purchaseOrders.Details.Add(purchaseOrderDetails);
    }

我该怎么做?

【问题讨论】:

    标签: api acumatica


    【解决方案1】:

    在另一篇关于其他内容的帖子中找到了答案。如果其他人有任何问题,请在此处更新。

                List<PurchaseOrderDetails> pODetail = new List<PurchaseOrderDetails>();
    
                foreach(POListProduct polp in pOListProduct)
                {
                    pODetail.Add(new PurchaseOrderDetails
                    {
                        InventoryID = new StringValue { Value = polp.Product_No },
                        OrderQty = new DecimalValue { Value = polp.AdjustedQuantity}
                    });
                }
    
                PurchaseOrders purchaseOrders = new PurchaseOrders()
                {
                    Vendor = new AcumaticaService.StringValue { Value = poList[0].VendorId },
                    Details = pODetail.ToArray<PurchaseOrderDetails>()
                };
    

    【讨论】:

      猜你喜欢
      • 2020-11-24
      • 1970-01-01
      • 2018-03-03
      • 1970-01-01
      • 1970-01-01
      • 2017-07-31
      • 1970-01-01
      • 1970-01-01
      • 2021-09-18
      相关资源
      最近更新 更多