This commit is contained in:
@@ -30,7 +30,7 @@ namespace AyaNova.Util
|
||||
|
||||
public static class Level
|
||||
{
|
||||
public enum SeedLevel { NotValid, Small, Medium, Large, Huge };
|
||||
public enum SeedLevel { NotValid, Small, Medium, Large, Huge, Mega };
|
||||
public static SeedLevel StringToSeedLevel(string size)
|
||||
{
|
||||
switch (size.ToLowerInvariant())
|
||||
@@ -47,6 +47,9 @@ namespace AyaNova.Util
|
||||
case "huge":
|
||||
return SeedLevel.Huge;
|
||||
|
||||
case "mega":
|
||||
return SeedLevel.Mega;
|
||||
|
||||
default:
|
||||
return SeedLevel.NotValid;
|
||||
}
|
||||
@@ -480,6 +483,87 @@ namespace AyaNova.Util
|
||||
}
|
||||
break;
|
||||
|
||||
case Level.SeedLevel.Mega:
|
||||
{
|
||||
#region GenMega
|
||||
//this is the MEGA dataset for 100k workorder kpi and other testing
|
||||
//same as huge but with way more customers and service work orders going back longer time frame
|
||||
//intended to simulate better a v7 customer's real world data to test performance and bug finding
|
||||
//It is acceptable for this seeding to take many hours as it would normally be used rarely
|
||||
|
||||
//PERF
|
||||
await LogStatusAsync(JobId, LogJob, log, $"Seeding MEGA sample data....");
|
||||
var watch = new Stopwatch();
|
||||
watch.Start();
|
||||
|
||||
|
||||
//INSIDE USERS - 730 total inside users here plus couple dozen known users below
|
||||
//IT administrator, can change ops but nothing else
|
||||
await SeedUserAsync(log, 10, AuthorizationRoles.OpsAdmin, UserType.NotService, forceEmail, appendPassword);
|
||||
//business administrator, can view ops issues
|
||||
await SeedUserAsync(log, 10, AuthorizationRoles.BizAdmin | AuthorizationRoles.OpsAdminRestricted, UserType.NotService, forceEmail, appendPassword);
|
||||
//owner / upper management who doesn't control anything but views stuff
|
||||
await SeedUserAsync(log, 20, AuthorizationRoles.BizAdminRestricted | AuthorizationRoles.ServiceRestricted | AuthorizationRoles.InventoryRestricted | AuthorizationRoles.OpsAdminRestricted, UserType.NotService, forceEmail, appendPassword);
|
||||
|
||||
////////////////////////////////////////////////
|
||||
//TECHS (LICENSE CONSUMERS)
|
||||
//
|
||||
//
|
||||
|
||||
//########### WARNING: if more than 250 techs must update Rockfish::ravenkeyfactory::GetRavenTrialKey to allow for more
|
||||
//regular techs
|
||||
await SeedUserAsync(log, 15, AuthorizationRoles.Tech | AuthorizationRoles.ServiceRestricted, UserType.Service, forceEmail, appendPassword);
|
||||
//Restricted techs
|
||||
await SeedUserAsync(log, 2, AuthorizationRoles.TechRestricted | AuthorizationRoles.ServiceRestricted, UserType.Service, forceEmail, appendPassword);
|
||||
//subcontractors
|
||||
await SeedUserAsync(log, 2, AuthorizationRoles.SubContractor, UserType.ServiceContractor, forceEmail, appendPassword);
|
||||
//Restricted subcontractors
|
||||
await SeedUserAsync(log, 1, AuthorizationRoles.SubContractorRestricted, UserType.ServiceContractor, forceEmail, appendPassword);
|
||||
///////////////////////////////////////////
|
||||
|
||||
//generic office people people
|
||||
await SeedUserAsync(log, 500, AuthorizationRoles.ServiceRestricted | AuthorizationRoles.InventoryRestricted, UserType.NotService, forceEmail, appendPassword);
|
||||
//20 Full sales people
|
||||
await SeedUserAsync(log, 60, AuthorizationRoles.Sales, UserType.NotService, forceEmail, appendPassword);
|
||||
//10 Restricted sales people
|
||||
await SeedUserAsync(log, 10, AuthorizationRoles.SalesRestricted, UserType.NotService, forceEmail, appendPassword);
|
||||
//Service manager
|
||||
await SeedUserAsync(log, 20, AuthorizationRoles.Service | AuthorizationRoles.InventoryRestricted, UserType.NotService, forceEmail, appendPassword);
|
||||
//Inventory manager
|
||||
await SeedUserAsync(log, 40, AuthorizationRoles.Inventory | AuthorizationRoles.ServiceRestricted, UserType.NotService, forceEmail, appendPassword);
|
||||
//Inventory manager assistants
|
||||
await SeedUserAsync(log, 20, AuthorizationRoles.InventoryRestricted, UserType.NotService, forceEmail, appendPassword);
|
||||
//accountant / bookkeeper
|
||||
await SeedUserAsync(log, 20, AuthorizationRoles.Accounting | AuthorizationRoles.BizAdminRestricted, UserType.NotService, forceEmail, appendPassword);
|
||||
|
||||
await SeedVendorAsync(log, 5000, forceEmail);
|
||||
await SeedUnitModelAsync(log, 400);
|
||||
|
||||
//######### WARNING trial license size limits: Each Head office is up to 3 users generated, each customer is up to 1 generated so assume fully generated
|
||||
await SeedCustomerAsync(log, 10000, slevel, forceEmail, appendPassword);//## WARNING AFFECTS LICENSE potentially 10,000 CUSTOMER users
|
||||
await SeedHeadOfficeAsync(log, 500, slevel, forceEmail, appendPassword);//## WARNING AFFECTS LICENSE potentially 1500 CUSTOMER users
|
||||
|
||||
await SeedProjectAsync(log, 1000);
|
||||
await SeedServiceRateAsync(log, 200);
|
||||
await SeedTravelRateAsync(log, 100);
|
||||
|
||||
await SeedLoanLoanUnitAsync(log, 200);
|
||||
await SeedCustomerServiceRequestAsync(log, 200, forceEmail, appendPassword);//## WARNING AFFECTS LICENSE potentially 200 CUSTOMER users from this
|
||||
await SeedPartWarehouseAsync(log, 200);
|
||||
await SeedPartAsync(log, 10000, 1000);
|
||||
await SeedPartAssemblyAsync(log, 500);
|
||||
await SeedPurchaseOrderAsync(log, 1000);
|
||||
await SeedQuoteAsync(log, 10);
|
||||
await SeedPMAsync(log, 3);//DO NOT want too many of these as they affect performance
|
||||
await SeedWorkOrderAsync(log, slevel);
|
||||
|
||||
//PERF
|
||||
watch.Stop();
|
||||
await LogStatusAsync(JobId, LogJob, log, "MEGA level sample data seeded in " + AyaNova.Util.DateUtil.FormatTimeSpan(watch.Elapsed));
|
||||
#endregion genMEGA
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
//Seed logo files
|
||||
@@ -1758,7 +1842,7 @@ namespace AyaNova.Util
|
||||
{
|
||||
User u = new User();
|
||||
u.Active = active;
|
||||
u.AllowLogin=true;
|
||||
u.AllowLogin = true;
|
||||
do
|
||||
{
|
||||
u.Name = Fake.Name.FullName();
|
||||
@@ -1910,6 +1994,7 @@ namespace AyaNova.Util
|
||||
break;
|
||||
case Level.SeedLevel.Large:
|
||||
case Level.SeedLevel.Huge:
|
||||
case Level.SeedLevel.Mega:
|
||||
await SeedUnitAsync(log, 10, NewObject.Id);
|
||||
break;
|
||||
}
|
||||
@@ -2825,6 +2910,7 @@ namespace AyaNova.Util
|
||||
int MaximumWorkOrderItemCount = 2;
|
||||
int woItemUnitCount = 2;
|
||||
|
||||
bool IsMegaSeedLevel = false;
|
||||
switch (seedLevel)
|
||||
{
|
||||
case Level.SeedLevel.Medium:
|
||||
@@ -2842,6 +2928,14 @@ namespace AyaNova.Util
|
||||
MaximumWorkOrderItemCount = 2;
|
||||
woItemUnitCount = 1;
|
||||
break;
|
||||
case Level.SeedLevel.Mega:
|
||||
//intention is to have at least 100000 (100k) workorders in system
|
||||
//so over 10 years 3650 days that needs to be 27.2 per day
|
||||
PastMonthsToSeed = 121;
|
||||
MaximumWorkOrderItemCount = 2;
|
||||
woItemUnitCount = 1;
|
||||
IsMegaSeedLevel = true;
|
||||
break;
|
||||
|
||||
}
|
||||
DateTime seedStartWindow = DateTime.UtcNow.AddMonths(-PastMonthsToSeed);//goes back based on seed level
|
||||
@@ -2855,6 +2949,9 @@ namespace AyaNova.Util
|
||||
for (int x = 0; x < totalDays; x++)
|
||||
{
|
||||
int thisDayGenerateThisMany = Fake.Random.Int(0, 3) + 3;
|
||||
if (IsMegaSeedLevel)
|
||||
thisDayGenerateThisMany = 27;//to get to 100k
|
||||
|
||||
for (int perDay = 0; perDay < thisDayGenerateThisMany; perDay++)
|
||||
{
|
||||
WorkOrder o = new WorkOrder();
|
||||
@@ -3257,7 +3354,18 @@ namespace AyaNova.Util
|
||||
//if it's in the past tag it with a completed type status
|
||||
if (olderThanOneWeekAgo)
|
||||
{
|
||||
if (Fake.Random.Int(1, 10) != 3) //10% overdue for showing off widget overdue
|
||||
bool IsClosed = true;
|
||||
|
||||
if (IsMegaSeedLevel)
|
||||
{
|
||||
IsClosed = (Fake.Random.Int(1, 10) > 3); //30% overdue for hammering some widget queries as a test
|
||||
}
|
||||
else
|
||||
{
|
||||
IsClosed = (Fake.Random.Int(1, 10) != 3); //10% overdue for showing off widget overdue
|
||||
}
|
||||
|
||||
if (IsClosed) //10% overdue for showing off widget overdue
|
||||
{
|
||||
var WoState = new WorkOrderState()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user