This commit is contained in:
2021-12-30 15:11:45 +00:00
parent f8d47551ee
commit e8ad7901ec
5 changed files with 20 additions and 12 deletions

View File

@@ -829,7 +829,10 @@ namespace AyaNova.Biz
idList = idList.Skip(IReportAbleObject.REPORT_DATA_BATCH_SIZE).ToArray(); idList = idList.Skip(IReportAbleObject.REPORT_DATA_BATCH_SIZE).ToArray();
batchResults.Clear(); batchResults.Clear();
foreach (long batchId in batch) foreach (long batchId in batch)
{
if (!ReportRenderManager.KeepGoing(jobId)) return null;
batchResults.Add(await PMGetPartialAsync(dataListSelectedRequest.AType, batchId, dataListSelectedRequest.IncludeWoItemDescendants, true)); batchResults.Add(await PMGetPartialAsync(dataListSelectedRequest.AType, batchId, dataListSelectedRequest.IncludeWoItemDescendants, true));
}
foreach (PM w in batchResults) foreach (PM w in batchResults)
{ {

View File

@@ -805,7 +805,10 @@ namespace AyaNova.Biz
idList = idList.Skip(IReportAbleObject.REPORT_DATA_BATCH_SIZE).ToArray(); idList = idList.Skip(IReportAbleObject.REPORT_DATA_BATCH_SIZE).ToArray();
batchResults.Clear(); batchResults.Clear();
foreach (long batchId in batch) foreach (long batchId in batch)
{
if (!ReportRenderManager.KeepGoing(jobId)) return null;
batchResults.Add(await QuoteGetPartialAsync(dataListSelectedRequest.AType, batchId, dataListSelectedRequest.IncludeWoItemDescendants, true)); batchResults.Add(await QuoteGetPartialAsync(dataListSelectedRequest.AType, batchId, dataListSelectedRequest.IncludeWoItemDescendants, true));
}
foreach (Quote w in batchResults) foreach (Quote w in batchResults)
{ {

View File

@@ -11,6 +11,7 @@ using EnumsNET;
using PuppeteerSharp; using PuppeteerSharp;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System; using System;
using System.Diagnostics;
namespace AyaNova.Biz namespace AyaNova.Biz
{ {
@@ -460,7 +461,13 @@ namespace AyaNova.Biz
//Get data //Get data
log.LogDebug("Getting report data now"); log.LogDebug("Getting report data now");
// var watch = new Stopwatch();
// watch.Start();
var ReportData = await GetReportData(reportRequest, job.GId, RequestIsCustomerWorkOrderReport); var ReportData = await GetReportData(reportRequest, job.GId, RequestIsCustomerWorkOrderReport);
// watch.Stop();
// log.LogInformation($"GetReportData took {watch.ElapsedMilliseconds}ms to execute");
//THIS is here to catch scenario where report data returned null because it expired, not because of an issue //THIS is here to catch scenario where report data returned null because it expired, not because of an issue
if (!ReportRenderManager.KeepGoing(job.GId)) if (!ReportRenderManager.KeepGoing(job.GId))
return; return;

View File

@@ -1035,8 +1035,6 @@ namespace AyaNova.Biz
//order the results back into original //order the results back into original
var orderedList = from id in batch join z in batchResults on id equals z.Id select z; var orderedList = from id in batch join z in batchResults on id equals z.Id select z;
batchResults = null; batchResults = null;
foreach (var w in orderedList) foreach (var w in orderedList)
{ {

View File

@@ -940,9 +940,6 @@ namespace AyaNova.Biz
// //
public async Task<JArray> GetReportData(DataListSelectedRequest dataListSelectedRequest, Guid jobId) public async Task<JArray> GetReportData(DataListSelectedRequest dataListSelectedRequest, Guid jobId)
{ {
// #if (DEBUG)
// var watch = System.Diagnostics.Stopwatch.StartNew();
// #endif
//workorder reports for entire workorder or just sub parts all go through here //workorder reports for entire workorder or just sub parts all go through here
//if the ayatype is a descendant of the workorder then only the portion of the workorder from that descendant directly up to the header will be populated and returned //if the ayatype is a descendant of the workorder then only the portion of the workorder from that descendant directly up to the header will be populated and returned
//however if the report template has includeWoItemDescendants=true then the woitems is fully populated //however if the report template has includeWoItemDescendants=true then the woitems is fully populated
@@ -952,19 +949,19 @@ namespace AyaNova.Biz
List<WorkOrder> batchResults = new List<WorkOrder>(); List<WorkOrder> batchResults = new List<WorkOrder>();
while (idList.Any()) while (idList.Any())
{ {
if (!ReportRenderManager.KeepGoing(jobId)) return null; if (!ReportRenderManager.KeepGoing(jobId)) return null;
var batch = idList.Take(IReportAbleObject.REPORT_DATA_BATCH_SIZE); var batch = idList.Take(IReportAbleObject.REPORT_DATA_BATCH_SIZE);
idList = idList.Skip(IReportAbleObject.REPORT_DATA_BATCH_SIZE).ToArray(); idList = idList.Skip(IReportAbleObject.REPORT_DATA_BATCH_SIZE).ToArray();
batchResults.Clear(); batchResults.Clear();
foreach (long batchId in batch) foreach (long batchId in batch)
{ {
if (!ReportRenderManager.KeepGoing(jobId)) return null; if (!ReportRenderManager.KeepGoing(jobId)) return null;
batchResults.Add(await WorkOrderGetPartialAsync(dataListSelectedRequest.AType, batchId, dataListSelectedRequest.IncludeWoItemDescendants, true)); batchResults.Add(await WorkOrderGetPartialAsync(dataListSelectedRequest.AType, batchId, dataListSelectedRequest.IncludeWoItemDescendants, true));
} }
foreach (WorkOrder w in batchResults) foreach (WorkOrder w in batchResults)
{ {
if (!ReportRenderManager.KeepGoing(jobId)) return null; if (!ReportRenderManager.KeepGoing(jobId)) return null;
var jo = JObject.FromObject(w); var jo = JObject.FromObject(w);
//WorkOrder header custom fields //WorkOrder header custom fields