diff --git a/server/AyaNova/biz/PMBiz.cs b/server/AyaNova/biz/PMBiz.cs index 581c5b45..ac07c45e 100644 --- a/server/AyaNova/biz/PMBiz.cs +++ b/server/AyaNova/biz/PMBiz.cs @@ -829,7 +829,10 @@ namespace AyaNova.Biz idList = idList.Skip(IReportAbleObject.REPORT_DATA_BATCH_SIZE).ToArray(); batchResults.Clear(); foreach (long batchId in batch) + { + if (!ReportRenderManager.KeepGoing(jobId)) return null; batchResults.Add(await PMGetPartialAsync(dataListSelectedRequest.AType, batchId, dataListSelectedRequest.IncludeWoItemDescendants, true)); + } foreach (PM w in batchResults) { diff --git a/server/AyaNova/biz/QuoteBiz.cs b/server/AyaNova/biz/QuoteBiz.cs index 874e354d..a0be228a 100644 --- a/server/AyaNova/biz/QuoteBiz.cs +++ b/server/AyaNova/biz/QuoteBiz.cs @@ -805,7 +805,10 @@ namespace AyaNova.Biz idList = idList.Skip(IReportAbleObject.REPORT_DATA_BATCH_SIZE).ToArray(); batchResults.Clear(); foreach (long batchId in batch) + { + if (!ReportRenderManager.KeepGoing(jobId)) return null; batchResults.Add(await QuoteGetPartialAsync(dataListSelectedRequest.AType, batchId, dataListSelectedRequest.IncludeWoItemDescendants, true)); + } foreach (Quote w in batchResults) { diff --git a/server/AyaNova/biz/ReportBiz.cs b/server/AyaNova/biz/ReportBiz.cs index 8b0e5833..e3f34184 100644 --- a/server/AyaNova/biz/ReportBiz.cs +++ b/server/AyaNova/biz/ReportBiz.cs @@ -11,6 +11,7 @@ using EnumsNET; using PuppeteerSharp; using Newtonsoft.Json.Linq; using System; +using System.Diagnostics; namespace AyaNova.Biz { @@ -460,7 +461,13 @@ namespace AyaNova.Biz //Get data log.LogDebug("Getting report data now"); + // var watch = new Stopwatch(); + // watch.Start(); 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 if (!ReportRenderManager.KeepGoing(job.GId)) return; @@ -490,7 +497,7 @@ namespace AyaNova.Biz var ReportJSFolderPath = Path.Combine(ServerBootConfig.AYANOVA_CONTENT_ROOT_PATH, "resource", "rpt"); - + //Keep for debugging headfully //var lo = new LaunchOptions { Headless = false }; var lo = new LaunchOptions { Headless = true }; @@ -516,7 +523,7 @@ namespace AyaNova.Biz */ } else - { + { log.LogDebug($"Windows: Calling browserFetcher download async now:"); await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultChromiumRevision); } @@ -760,7 +767,7 @@ namespace AyaNova.Biz if (!string.IsNullOrWhiteSpace(report.MarginOptionsTop)) PdfOptions.MarginOptions.Top = report.MarginOptionsTop; - + PdfOptions.PreferCSSPageSize = report.PreferCSSPageSize; PdfOptions.PrintBackground = report.PrintBackground; //Defaults to 1. Scale amount must be between 0.1 and 2. diff --git a/server/AyaNova/biz/UserBiz.cs b/server/AyaNova/biz/UserBiz.cs index 958ccd21..56319302 100644 --- a/server/AyaNova/biz/UserBiz.cs +++ b/server/AyaNova/biz/UserBiz.cs @@ -1035,8 +1035,6 @@ namespace AyaNova.Biz //order the results back into original var orderedList = from id in batch join z in batchResults on id equals z.Id select z; - - batchResults = null; foreach (var w in orderedList) { diff --git a/server/AyaNova/biz/WorkOrderBiz.cs b/server/AyaNova/biz/WorkOrderBiz.cs index 8ec35bec..918a0a1a 100644 --- a/server/AyaNova/biz/WorkOrderBiz.cs +++ b/server/AyaNova/biz/WorkOrderBiz.cs @@ -939,10 +939,7 @@ namespace AyaNova.Biz //REPORTING // public async Task 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 //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 @@ -952,19 +949,19 @@ namespace AyaNova.Biz List batchResults = new List(); while (idList.Any()) { - if (!ReportRenderManager.KeepGoing(jobId)) return null; + if (!ReportRenderManager.KeepGoing(jobId)) return null; var batch = idList.Take(IReportAbleObject.REPORT_DATA_BATCH_SIZE); idList = idList.Skip(IReportAbleObject.REPORT_DATA_BATCH_SIZE).ToArray(); batchResults.Clear(); 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)); } foreach (WorkOrder w in batchResults) { - if (!ReportRenderManager.KeepGoing(jobId)) return null; + if (!ReportRenderManager.KeepGoing(jobId)) return null; var jo = JObject.FromObject(w); //WorkOrder header custom fields