应用 RU6 后,NF-e 联邦表单将为空

应用对象
Microsoft Dynamics AX 2009

症状

应用汇总 6 (KB2405516) 后,NF-e 联邦表单将为空。 无法验证与之前发布的 NF-e 联邦发票相关的状态,并且无法知道应采取什么操作。

原因

RelaseUpdateDB60_Cust 类中存在编码缺陷,updateReferencesInEFDocument_BR 方法。 

此方法更新表EFDocument_BR,使其始终引用FiscalDocJour_BR表。 在以前的版本中,EFDocument_BR用于保留对源自巴西财政文档的发票的引用,例如 CustInvoiceJour 和 VendInvoiceJour。 从现在起,RefTableId 和 RefRecId 字段对将始终引用巴西会计文档表:FiscalDocJour_BR。

在创建新 NF-e 的汇总 5 环境中执行此方法时,这些 NF-e 的 (已经正常,) 现在将失去与FiscalDocJour_BR的关系,从而导致空白表单。 仅应针对 NF-e 引用 CustInvoiceJour 和 VendInvoiceJour 执行此方法。 

解决方法

强烈建议在执行此知识库文章中所述的步骤之前,先执行 AX 数据库的完整备份。

1. 何时应用修补程序
应用 RU6 包后,启动 AX 客户端,并显示“升级清单”。 在运行“Presynchronize”之前,必须应用此修补程序。

2. 打开 AOT 并在 RelaseUpdateDB60_Cust 类中插入以下“WHERE”语句,updateReferencesInEFDocument_BR 方法。

之前:
    同时选择“forupdate eFDocument”
    {
        fiscalDocJour = FiscalDocJour_BR::findRefRecId (eFDocument.RefTableId, eFDocument.RefRecId) ;
        eFDocument.RefTableId = fiscalDocJour.TableId;
        eFDocument.RefRecId = fiscalDocJour.RecId;

        eFDocument.doUpdate () ;
    }

之后:
    同时选择“forupdate eFDocument”
        其中 eFDocument.RefTableId != tablenum (FiscalDocJour_BR)
    {
        fiscalDocJour = FiscalDocJour_BR::findRefRecId (eFDocument.RefTableId, eFDocument.RefRecId) ;
        eFDocument.RefTableId = fiscalDocJour.TableId;
        eFDocument.RefRecId = fiscalDocJour.RecId;

        eFDocument.doUpdate () ;
    }