【发布时间】:2019-09-17 20:17:21
【问题描述】:
在 QBFC 中一次可以从MsgSetRequest 添加/返回的报告查询数量是否有限制?
我目前正在创建多个 GeneralSummaryReportQuery 并将其添加到 MsgSetRequest(比如 30),但是在我执行请求之后,事情似乎出了问题。我可以看到ResponseList 的大小正确,但在列表中的前 10 个Response 之后,其余响应的状态代码更改为3320,这表明无法生成报告。如果我使用相同的过滤器运行相同的报告,但向请求中添加的查询更少,则报告会成功生成。
我浏览了 QBSDK ProGuide 这本书并进行了一些谷歌搜索,但我没有在网上看到任何提及此限制的内容。
以下是一些示例代码:
IMsgSetRequest msgSetReq = sessionManager.CreateMsgSetRequest("US", 13, 0);
msgSetReq.Attributes.OnError = ENRqOnError.roeContinue;
foreach (string key in traversalOrder) {
IGeneralSummaryReportQuery summaryReportQuery = msgSetReq.AppendGeneralSummaryReportQueryRq();
summaryReportQuery.GeneralSummaryReportType.SetValue(ENGeneralSummaryReportType.gsrtProfitAndLossByJob);
summaryReportQuery.ReportEntityFilter.ORReportEntityFilter.FullNameList.Add(tableData[key].FullName);
}
//Now do all the queries
IMsgSetResponse msgSetResp = sessionManager.DoRequests(msgSetReq);
for (int k = 0; k < msgSetResp.ResponseList.Count; k++) {
IResponse resp = msgSetResp.ResponseList.GetAt(k);
if (resp.StatusCode >= 0 && resp.Detail != null) {
//do stuff -- this only enters in the first 10 Responses in the ResponseList
}
}
我启用了详细日志记录并查看了日志 - 正在按预期以 XML 格式生成报告请求:
<GeneralSummaryReportQueryRq requestID = "9">
<GeneralSummaryReportType>ProfitAndLossByJob</GeneralSummaryReportType>
<ReportEntityFilter>
<FullName>TestGuy9</FullName>
</ReportEntityFilter>
</GeneralSummaryReportQueryRq>
<GeneralSummaryReportQueryRq requestID = "10">
<GeneralSummaryReportType>ProfitAndLossByJob</GeneralSummaryReportType>
<ReportEntityFilter>
<FullName>TestGuy10</FullName>
</ReportEntityFilter>
</GeneralSummaryReportQueryRq>
但是,在日志的更下方,我们看到报告生成失败,但没有说明原因。对于随后的任何剩余报告请求,这将继续。
20190919.103424 I 16112 QBSDKMsgSetHandler QUERY: General Summary Report
20190919.103424 D 16112 ReportStorage::DoQuery Processing request for report: ProfitAndLossByJob
20190919.103424 D 16112 ReportStorage::DoQuery Setting report type
20190919.103424 D 16112 ReportStorage::DoQuery Initializing report defaults
20190919.103424 D 16112 ReportStorage::DoQuery 1st override of defaults
20190919.103424 D 16112 ReportStorage::DoQuery Initializing report
20190919.103424 D 16112 ReportStorage::DoQuery 2nd override of defaults
20190919.103424 D 16112 ReportStorage::DoQuery Generating the report
20190919.103425 D 16112 ReportStorage::DoQuery Building the response
20190919.103425 D 16112 ReportHandler::BuildTheRetObject Number of column rows: 2
20190919.103425 D 16112 ReportStorage::DoQuery Finished building the response
20190919.103425 I 16112 QBSDKMsgSetHandler Request 9 completed successfully.
20190919.103425 I 16112 QBSDKMsgSetHandler QUERY: General Summary Report
20190919.103425 D 16112 ReportStorage::DoQuery Processing request for report: ProfitAndLossByJob
20190919.103425 D 16112 ReportStorage::DoQuery Setting report type
20190919.103425 D 16112 ReportStorage::DoQuery Initializing report defaults
20190919.103425 D 16112 ReportStorage::DoQuery 1st override of defaults
20190919.103425 D 16112 ReportStorage::DoQuery Initializing report
20190919.103425 D 16112 ReportStorage::DoQuery 2nd override of defaults
20190919.103425 D 16112 ReportStorage::DoQuery Generating the report
20190919.103425 E 16112 ReportHandler::GenerateReport Unable to generate the report
20190919.103425 I 16112 QBSDKMsgSetHandler Request 10 failed.
【问题讨论】:
-
打开任务管理器并在代码运行时检查内存使用情况。您可能有内存泄漏。
-
我不知道是否有限制,但由于它似乎适用于前 10 个,作为一种解决方法,您可以尝试以 10 个批次运行查询,然后手动组合结果。
-
@jdweng 我不认为内存是问题 - 我在运行查询时保持任务管理器打开,虽然 Quickbooks RAM 使用量确实增加了,但我的内存总量从未超过 75%(包括所有过程)。 Visual Studio 对我的应用程序的内存使用量约为 200MB(峰值)。 @Kei我当然可以批量运行它们,并计划将其作为备份。 :) 只是想知道在一个
MsgSetRequest中进行了 10 多次查询后报告停止返回是否有原因。 -
我不知道这个链接是否有帮助,但值得一读:stackoverflow.com/questions/23343880/…
标签: c# quickbooks qbfc