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();
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)
{

View File

@@ -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)
{

View File

@@ -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.

View File

@@ -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)
{

View File

@@ -939,10 +939,7 @@ namespace AyaNova.Biz
//REPORTING
//
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
//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<WorkOrder> batchResults = new List<WorkOrder>();
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