0

Web サービスを使用して Dynamics GP 2010 で発注書を作成しようとしています。次のエラーが表示されますVendorItemNumber not setup for ItemKeyまず、そのエラーが実際に何を意味するのかわかりません。第二に、なぜそれを取得しているのかわかりません。私のコードは以下です。助言がありますか?

Public Sub PO()
    Dim context As Context
    Dim purchaseOrderKey As PurchaseTransactionKey
    Dim vendorKey As VendorKey
    Dim purchaseOrder As PurchaseOrder
    Dim purchaseOrderLine As PurchaseOrderLine
    Dim warehouseKey As WarehouseKey
    Dim quantityOrdered As Quantity
    Dim purchaseOrderCreatePolicy As Policy

    context = gpr.ws.getContext()

    '// Create a purchase transaction key to identify the purchase order
    purchaseOrderKey = New PurchaseTransactionKey()
    purchaseOrderKey.Id = poId

    '// Create a vendor key object to specify the vendor
    vendorKey = New VendorKey()
    vendorKey.Id = "SYN001"

    '// Create a purchase order object
    purchaseOrder = New PurchaseOrder()

    '// Populate the required properties
    purchaseOrder.Key = purchaseOrderKey
    purchaseOrder.VendorKey = vendorKey

    '// Create a purchase order line object for the purchase order object
    purchaseOrderLine = New PurchaseOrderLine()

    '// Create a quantity object to specify the quantity ordered
    quantityOrdered = New Quantity()
    quantityOrdered.Value = 1

    '// Add the quantity to the purchase order line object
    purchaseOrderLine.QuantityOrdered = quantityOrdered

    '// Specify the inventory item being purchased
    purchaseOrderLine.VendorItemNumber = dvi1

    Dim itemKey As ItemKey = New ItemKey()
    itemKey.Id = dvi1
    purchaseOrderLine.ItemKey = itemKey

    '// Create an array to hold the purchase order line object
    Dim lines As PurchaseOrderLine() = New PurchaseOrderLine() {purchaseOrderLine}

    '// Add the array of purchase order lines to the purchase order object
    purchaseOrder.Lines = lines

    '// Get the create policy for purchase order objects
    purchaseOrderCreatePolicy = gpr.GetWebService.GetPolicyByOperation("CreatePurchaseOrder", context)

    '// Create the purchase order
    gpr.GetWebService.CreatePurchaseOrder(purchaseOrder, context, purchaseOrderCreatePolicy)
End Sub
4

2 に答える 2

1

GPインターフェースに移動し、このアイテムを発注書を作成しているベンダーにマップして、在庫に入力するだけです。その後、再試行してください!

于 2012-02-16T14:43:34.487 に答える