使用 Dynamics AX / Axapta Business Connector 插入发票交易记录
天哪,
好的,我现在完全重写了这个问题:
我正在尝试通过使用 Business Connector 将数据导入 Dynamics(理想情况下,我会直接通过 SQL 导入它,但我知道这不是一个好主意 -不过我愿意接受其他建议)。这是将发票从生产系统导入到 Dynamics / Axapta (v5)。
我可以编写代码将数据插入到 CUSTINVOICETABLE 表中,该表工作正常并生成 RECID。但是,刚刚插入的新发票没有发票 ID(直到它们被发布,我明白)。但是,我需要将行项目作为上述条目的子项插入到 CUSTINVOICETRANS 表中。为此,您需要设置 INVOICEID 字段以将上面的内容引用为父级的链接。但是,在发票过帐之前,这似乎是不可能的。或者我可能偏离了轨道?
有谁有任何想法或可以为我提供任何启发吗?我们将非常感激。
问候, 史蒂夫
G'day,
OK, I have now rewritten this question totally:
I am trying to import data into Dynamics through the use of the Business Connector (ideally, I would be importing it directly through SQL but I understand that is not a good idea - however I am open to other suggestions). This is to import invoices from a production system into Dynamics / Axapta (v5).
I can code to insert data into the CUSTINVOICETABLE table, which works fine and generates the RECID. However, new invoices just inserted exist without an Invoice ID (until they are posted I understand). However, I need to insert line items into the CUSTINVOICETRANS table as children of the above entry. For this you need to set the INVOICEID field to refer the above as the link to the parent. However, this does not appear possible before the invoice has been posted. Or I may be way off track?
Does anyone have any ideas or can shed any light for me? That would be much appreciated.
Regards,
Steve
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要发布“普通发票”,只需调用 custPostInvoiceJob.run() 方法即可。
您必须首先创建对象,然后使用新创建的 CustInvoiceTable 记录调用方法。
在 X++ 中:
您必须将其翻译为您首选语言的 Business Connector 调用。
To post a "Free text invoice" simply call
custPostInvoiceJob.run()
method.You will have have to make the object first, then call a method with your newly created
CustInvoiceTable
record.In X++:
You will have to translate that into Business Connector calls in your preferred language.
好吧,实际上就这么简单。
在插入语句之后,只需使用 get_Field 调用:
axRecord.Insert();
recID = (long)axRecord.get_Field("RECID");
您将行项目插入 CUSTINVOICELINE 表(使用 PARENTRECID)中,然后在过帐时将项目插入到链接到相应发票编号的 CUSTINVOICETRANS 表中。
我希望这可以让人们不必自己解决这个问题。
史蒂夫
Ok, it's actually as easy as it should be.
After the insert statement, simply use the get_Field call:
axRecord.Insert();
recID = (long)axRecord.get_Field("RECID");
You insert the line items in the CUSTINVOICELINE table (which uses a PARENTRECID), then upon posting the items get inserted into the CUSTINVOICETRANS table linked to the appropriate invoice number.
I hope this saves someone from having to work this out themselves.
Steve