This commit is contained in:
@@ -418,27 +418,28 @@ namespace AyaNova.Biz
|
||||
|
||||
if (subscription.LinkReportId != null)
|
||||
{
|
||||
long overrideLanguageId = 2;
|
||||
long subTranslationId = (long)subscription.TranslationId;
|
||||
|
||||
ReportBiz biz = new ReportBiz(ct, 1, overrideLanguageId, AuthorizationRoles.BizAdmin);
|
||||
ReportBiz biz = new ReportBiz(ct, 1, subTranslationId, AuthorizationRoles.BizAdmin);
|
||||
//example with workorder report
|
||||
//{"AType":34,"selectedRowIds":[355],"ReportId":9,"ClientMeta":{"UserName":"AyaNova SuperUser","Authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOiIxNjQ2NzgyNTc4IiwiaXNzIjoiYXlhbm92YS5jb20iLCJpZCI6IjEifQ.ad7Acq54JCRGitDWKDJFFnqKkidbdaKaFmj-RA_RG5E","DownloadToken":"NdoU8ca3LG4L39Tj2oi3UReeeM7FLevTgbgopTPhGbA","TimeZoneName":"America/Los_Angeles","LanguageName":"en-US","Hour12":true,"CurrencyName":"USD","DefaultLocale":"en","PDFDate":"3/3/22","PDFTime":"3:38 PM"}}
|
||||
|
||||
var reportRequest = new DataListReportRequest();
|
||||
reportRequest.AType = AyaType.WorkOrder;
|
||||
reportRequest.ReportId = 9;
|
||||
reportRequest.SelectedRowIds = new long[] { 1 };
|
||||
var jwt = Api.Controllers.AuthController.GenRpt(overrideLanguageId);
|
||||
|
||||
reportRequest.AType = ne.AyaType;
|
||||
reportRequest.ReportId = (long)subscription.LinkReportId;
|
||||
reportRequest.SelectedRowIds = new long[] { ne.ObjectId };
|
||||
var jwt = Api.Controllers.AuthController.GenRpt(subTranslationId);
|
||||
|
||||
//this could be adjusted by culture if we allow user to set a culture but that's getting a bit into the weeds, likely the server default is fine
|
||||
var pdfDate = new DateTime().ToShortDateString();
|
||||
var pdfTime = new DateTime().ToShortTimeString();
|
||||
|
||||
reportRequest.ClientMeta = JToken.Parse($"{{'UserName':'-','Authorization':'Bearer {jwt}','TimeZoneName':'America/Los_Angeles','LanguageName':'en-US','Hour12':true,'CurrencyName':'USD','DefaultLocale':'en','PDFDate':'{pdfDate}','PDFTime':'{pdfTime}'}}");
|
||||
var h12=subscription.Hour12?"true":"false";
|
||||
reportRequest.ClientMeta = JToken.Parse($"{{'UserName':'-','Authorization':'Bearer {jwt}','TimeZoneName':'{subscription.TimeZoneOverride}','LanguageName':'{subscription.LanguageOverride}','Hour12':{h12},'CurrencyName':'{subscription.CurrencyName}','DefaultLocale':'en','PDFDate':'{pdfDate}','PDFTime':'{pdfTime}'}}");
|
||||
//get port number
|
||||
var match = System.Text.RegularExpressions.Regex.Match(ServerBootConfig.AYANOVA_USE_URLS, "[0-9]+");
|
||||
var API_URL = $"http://127.0.0.1:{match.Value}/api/{AyaNovaVersion.CurrentApiVersion}/";
|
||||
var jobid = await biz.RequestRenderReport(reportRequest, DateTime.UtcNow.AddMinutes(ServerBootConfig.AYANOVA_REPORT_RENDERING_TIMEOUT), API_URL, "AUTOMATED NO USER");
|
||||
var jobid = await biz.RequestRenderReport(reportRequest, DateTime.UtcNow.AddMinutes(ServerBootConfig.AYANOVA_REPORT_RENDERING_TIMEOUT), API_URL, "CUSTOMER NOTIFICATION - NO USER");
|
||||
if (jobid == null)
|
||||
{
|
||||
throw new ApplicationException($"Report render job id is null failed to start");
|
||||
|
||||
Reference in New Issue
Block a user