获取最新的凭证号DynamicsGPClient

时间:2018-02-19 16:47:00

标签: vb.net microsoft-dynamics dynamics-gp

是否可以通过DynamicsGPClient获取应付交易的下一个凭证编号?

我可以进行查询,但此凭证结果只有几条记录。

    Dim PayablesInvoiceCriteria As New PayablesInvoiceCriteria() With {.Date = New BetweenRestrictionOfNullableOfdateTime() With {.GreaterThan = Date.now}}
    Dim InvoiceSummaries As PayablesInvoiceSummary() = wsDynamicsGP.GetPayablesInvoiceList(PayablesInvoiceCriteria, context)
    Dim Last = InvoiceSummaries(InvoiceSummaries.Length - 1).Key.Id

1 个答案:

答案 0 :(得分:1)

关于密钥生成如何在GP中进行交易的一些信息。密钥保存在PM00400表中,并在用户启动事务时创建/生成密钥。当用户保存记录时,它们在密钥表中变为“永久”。因此,您所看到的行为可能与该过程有关。

我不确定是否可以在没有eConnect的情况下完成此操作。所以我建议,作为一种解决方法,您可以使用eConnect命名空间。

https://msdn.microsoft.com/en-us/library/ff623620.aspx

<强>类

Microsoft.Dynamics.GP.eConnect.GetNextDocNumbers

<强>语法

public virtual string GetPMNextVoucherNumber(
    GetNextDocNumbers.IncrementDecrement incDec,
    string connString
)

示例

Dim connString as String = string.Empty
Dim sqlserver as String = "localhost"
Dim database as String = "TWO"

connString = "data source=" + sqlserver + ";" + "initial catalog=" + database + ";" + "Integrated Security=SSPI;"

Dim NextDocNumber as New String
Dim getNextDocNumbers = new Microsoft.Dynamics.GP.eConnect.GetNextDocNumbers()
NextDocNumber = getNextDocNumbers.GetPMNextVoucherNumber(Microsoft.Dynamics.GP.eConnect.IncrementDecrement.Increment, connString)

可在此处找到其他示例:

https://carldesouza.com/get-next-document-number-econnect/