This commit is contained in:
2021-09-02 20:36:46 +00:00
parent 60c9aa3f82
commit 6df4acf0c2

View File

@@ -4255,7 +4255,7 @@ namespace AyaNova.Biz
{
//SEARCH INDEXING
var SearchParams = new Search.SearchIndexProcessObjectParameters(UserTranslationId, obj.Id, obj.AyaType);
SearchParams.AddText(obj.Notes).AddText(obj.Wiki).AddText(obj.Tags).AddCustomFields(obj.CustomFields);
SearchParams.AddText(obj.Notes).AddText(obj.Wiki).AddText(obj.Tags).AddCustomFields(obj.CustomFields);
if (isNew)
await Search.ProcessNewObjectKeywordsAsync(SearchParams);
@@ -4737,9 +4737,9 @@ namespace AyaNova.Biz
//
internal static async Task GenerateAsync(AyContext ct, ILogger log)
{
if(!KeepOnWorking(log)) return;
if (!KeepOnWorking(log)) return;
//Get a list of PM id's ready for conversion now
var l = await ct.PM.AsNoTracking()
.Where(z => z.GenerateDate < DateTime.UtcNow && (z.StopGeneratingDate == null || z.StopGeneratingDate > DateTime.UtcNow) && z.Active == true)
@@ -4755,7 +4755,9 @@ namespace AyaNova.Biz
{
if(!KeepOnWorking(log)) return;
if (!KeepOnWorking(log)) return;
#if (DEBUG)
@@ -4787,9 +4789,18 @@ namespace AyaNova.Biz
{
//extremely unlikely to happen but just in case...
log.LogError($"PM was not fetchable when attempting to process PM id: {pmid}, deleted during processing?");
if(!KeepOnWorking(log)) return;
if (!KeepOnWorking(log)) return;
continue;
}
//confirm customer is active before proceeding
if (!await ct.Customer.AsNoTracking().Where(x => x.Id == p.CustomerId).Select(x => x.Active).FirstOrDefaultAsync())
{
log.LogTrace($"PM {p.Serial} has an Inactive customer selected so it will be skipped for generation");
continue;
}
try
{
//make new workorder
@@ -4878,7 +4889,7 @@ namespace AyaNova.Biz
{
log.LogError(ex, $"error updating PM after generation {p.Serial}");
await NotifyEventHelper.AddGeneralNotifyEvent(AyaType.PM, p.Id, NotifyEventType.PMGenerationFailed, $"Error updating PM after generation {p.Serial}", "Preventive Maintenance", ex);
if(!KeepOnWorking(log)) return;
if (!KeepOnWorking(log)) return;
continue;
}
}
@@ -4888,7 +4899,7 @@ namespace AyaNova.Biz
{
log.LogError(ex, $"error generating Work order from PM {p.Serial}");
await NotifyEventHelper.AddGeneralNotifyEvent(AyaType.PM, p.Id, NotifyEventType.PMGenerationFailed, $"Error generating Work order from PM {p.Serial}", "Preventive Maintenance", ex);
if(!KeepOnWorking(log)) return;
if (!KeepOnWorking(log)) return;
continue;
}