This commit is contained in:
2021-07-29 23:01:12 +00:00
parent 3d86154162
commit e677fa56e4
4 changed files with 32 additions and 7 deletions

2
.vscode/launch.json vendored
View File

@@ -53,7 +53,7 @@
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles", "AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles", "AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles", "AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
"AYANOVA_SERVER_TEST_MODE": "false", "AYANOVA_SERVER_TEST_MODE": "true",
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small", "AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7", "AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\" "AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"

View File

@@ -18,7 +18,7 @@ namespace AyaNova.DataList
var RoleSet = BizRoles.GetRoleSet(DefaultListAType); var RoleSet = BizRoles.GetRoleSet(DefaultListAType);
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
DefaultColumns = new List<string>() { "PMSerialNumber", "Customer", "PMNextServiceDate", "PMNextWoGenerateDate", "pmactive", "PMStopGeneratingDate" }; DefaultColumns = new List<string>() { "PMSerialNumber", "Customer", "PMNextServiceDate", "PMNextWoGenerateDate", "pmactive", "PMStopGeneratingDate" };
DefaultSortBy = new Dictionary<string, string>() { { "PMSerialNumber", "-" } }; DefaultSortBy = new Dictionary<string, string>() { { "PMNextWoGenerateDate", "-" } };
FieldDefinitions = new List<DataListFieldDefinition>(); FieldDefinitions = new List<DataListFieldDefinition>();
FieldDefinitions.Add(new DataListFieldDefinition FieldDefinitions.Add(new DataListFieldDefinition

View File

@@ -5196,7 +5196,7 @@ namespace AyaNova.Biz
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
// Process generation of pms to workorders // Process generation of pms to workorders
// //
internal static async Task Generate(AyContext ct, ILogger log) internal static async Task GenerateAsync(AyContext ct, ILogger log)
{ {
#if (DEBUG) #if (DEBUG)
log.LogInformation("PMBiz - Generating"); log.LogInformation("PMBiz - Generating");
@@ -5216,7 +5216,28 @@ namespace AyaNova.Biz
#if (DEBUG) #if (DEBUG)
log.LogInformation($"PMBiz - processing pm id {pmid}"); log.LogInformation($"PMBiz - processing pm id {pmid}");
#endif #endif
var p = await ct.PM.Where(x => x.Id == pmid).FirstOrDefaultAsync(); var p = await ct.PM.AsSplitQuery()
.Include(w => w.Items.OrderBy(item => item.Sequence))
.ThenInclude(wi => wi.Expenses)
.Include(w => w.Items)
.ThenInclude(wi => wi.Labors)
.Include(w => w.Items)
.ThenInclude(wi => wi.Loans)
.Include(w => w.Items)
.ThenInclude(wi => wi.Parts)
.Include(w => w.Items)
.ThenInclude(wi => wi.ScheduledUsers)
.Include(w => w.Items)
.ThenInclude(wi => wi.Tasks.OrderBy(t => t.Sequence))
.Include(w => w.Items)
.ThenInclude(wi => wi.Travels)
.Include(w => w.Items)
.ThenInclude(wi => wi.Units)
.Include(w => w.Items)
.ThenInclude(wi => wi.OutsideServices)
.SingleOrDefaultAsync(z => z.Id == pmid);
if (p == null) if (p == null)
{ {
log.LogError($"PMBiz - PM was not fetchable when attempting to process PM id: {pmid}, deleted during processing?"); log.LogError($"PMBiz - PM was not fetchable when attempting to process PM id: {pmid}, deleted during processing?");
@@ -5301,6 +5322,9 @@ namespace AyaNova.Biz
try try
{ {
await ct.SaveChangesAsync(); await ct.SaveChangesAsync();
#if (DEBUG)
log.LogInformation($"PMBiz::GenerateAsync updated PM after successful generation {p.Serial}");
#endif
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -5323,9 +5347,7 @@ namespace AyaNova.Biz
internal static async Task<bool> NewServiceWorkOrderFromPMAsync(PM p, AyContext ct, ILogger log) internal static async Task<bool> NewServiceWorkOrderFromPMAsync(PM p, AyContext ct, ILogger log)
{ {
WorkOrder wo = new WorkOrder(); WorkOrder wo = new WorkOrder();
wo.Address = p.Address; wo.Address = p.Address;
wo.City = p.City; wo.City = p.City;
//o.CompleteByDate=?? //o.CompleteByDate=??
@@ -5520,6 +5542,9 @@ namespace AyaNova.Biz
//todo: NOTIFY FAIL //todo: NOTIFY FAIL
return false; return false;
} }
#if (DEBUG)
log.LogInformation($"PMBiz::NewServiceWorkOrderFromPMAsync created new workorder {NewObject.Serial}");
#endif
return true; return true;
} }
#endregion #endregion

View File

@@ -50,7 +50,7 @@ namespace AyaNova.Biz
using (AyContext ct = AyaNova.Util.ServiceProviderProvider.DBContext) using (AyContext ct = AyaNova.Util.ServiceProviderProvider.DBContext)
{ {
await PMBiz.Generate(ct, log); await PMBiz.GenerateAsync(ct, log);
} }
} }
catch (Exception ex) catch (Exception ex)