This commit is contained in:
2021-07-26 19:41:31 +00:00
parent cd56594286
commit c5a5f102ab
3 changed files with 76 additions and 30 deletions

View File

@@ -12,13 +12,14 @@ namespace AyaNova.DataList
DefaultListAType = AyaType.Quote; DefaultListAType = AyaType.Quote;
SQLFrom = "from aquote " SQLFrom = "from aquote "
+ "left join aquotestatus on (aquote.laststatusid = aquotestatus.id) " + "left join aquotestatus on (aquote.laststatusid = aquotestatus.id) "
+ "left join acustomer on (aquote.customerid=acustomer.id) " + "left join acustomer on (aquote.customerid = acustomer.id) "
+ "left join aheadoffice on (acustomer.headofficeid=aheadoffice.id) " + "left join aheadoffice on (acustomer.headofficeid = aheadoffice.id) "
+ "left join aproject on (aquote.projectid=aproject.id) " + "left join aproject on (aquote.projectid = aproject.id) "
+ "left join acontract on (aquote.contractid=acontract.id)"; + "left join auser on (aquote.preparedbyid = auser.id) "
+ "left join acontract on (aquote.contractid = acontract.id)";
var RoleSet = BizRoles.GetRoleSet(DefaultListAType); var RoleSet = BizRoles.GetRoleSet(DefaultListAType);
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
DefaultColumns = new List<string>() { "QuoteSerialNumber", "Customer", "QuoteStatus", "Project" }; DefaultColumns = new List<string>() { "QuoteSerialNumber", "Customer", "QuoteQuoteStatusType", "QuoteQuoteRequestDate", "QuotePreparedByID" };
DefaultSortBy = new Dictionary<string, string>() { { "QuoteSerialNumber", "-" } }; DefaultSortBy = new Dictionary<string, string>() { { "QuoteSerialNumber", "-" } };
FieldDefinitions = new List<DataListFieldDefinition>(); FieldDefinitions = new List<DataListFieldDefinition>();
@@ -53,6 +54,16 @@ namespace AyaNova.DataList
SqlValueColumnName = "aheadoffice.name" SqlValueColumnName = "aheadoffice.name"
}); });
FieldDefinitions.Add(new DataListFieldDefinition
{
TKey = "QuotePreparedByID",
FieldKey = "QuotePreparedByID",
UiFieldDataType = (int)UiFieldDataType.Text,
AType = (int)AyaType.User,
SqlIdColumnName = "aquote.preparedbyid",
SqlValueColumnName = "auser.name"
});
FieldDefinitions.Add(new DataListFieldDefinition FieldDefinitions.Add(new DataListFieldDefinition
{ {
TKey = "QuoteQuoteStatusType", TKey = "QuoteQuoteStatusType",
@@ -124,29 +135,45 @@ namespace AyaNova.DataList
SqlValueColumnName = "aquote.customercontactname" SqlValueColumnName = "aquote.customercontactname"
}); });
// FieldDefinitions.Add(new DataListFieldDefinition FieldDefinitions.Add(new DataListFieldDefinition
// { {
// TKey = "QuoteServiceDate", TKey = "QuoteQuoteRequestDate",
// FieldKey = "QuoteServiceDate", FieldKey = "QuoteQuoteRequestDate",
// UiFieldDataType = (int)UiFieldDataType.DateTime, UiFieldDataType = (int)UiFieldDataType.DateTime,
// SqlValueColumnName = "aquote.servicedate" SqlValueColumnName = "aquote.requested"
// }); });
// FieldDefinitions.Add(new DataListFieldDefinition FieldDefinitions.Add(new DataListFieldDefinition
// { {
// TKey = "QuoteCloseByDate", TKey = "QuoteValidUntilDate",
// FieldKey = "QuoteCloseByDate", FieldKey = "QuoteValidUntilDate",
// UiFieldDataType = (int)UiFieldDataType.DateTime, UiFieldDataType = (int)UiFieldDataType.DateTime,
// SqlValueColumnName = "aquote.completebydate" SqlValueColumnName = "aquote.validuntil"
// }); });
FieldDefinitions.Add(new DataListFieldDefinition
{
TKey = "QuoteDateSubmitted",
FieldKey = "QuoteDateSubmitted",
UiFieldDataType = (int)UiFieldDataType.DateTime,
SqlValueColumnName = "aquote.submitted"
});
FieldDefinitions.Add(new DataListFieldDefinition
{
TKey = "QuoteDateApproved",
FieldKey = "QuoteDateApproved",
UiFieldDataType = (int)UiFieldDataType.DateTime,
SqlValueColumnName = "aquote.approved"
});
// FieldDefinitions.Add(new DataListFieldDefinition FieldDefinitions.Add(new DataListFieldDefinition
// { {
// TKey = "QuoteInvoiceNumber", TKey = "QuoteIntroduction",
// FieldKey = "QuoteInvoiceNumber", FieldKey = "QuoteIntroduction",
// UiFieldDataType = (int)UiFieldDataType.Text, UiFieldDataType = (int)UiFieldDataType.Text,
// SqlValueColumnName = "aquote.invoicenumber" SqlValueColumnName = "aquote.introduction"
// }); });
FieldDefinitions.Add(new DataListFieldDefinition FieldDefinitions.Add(new DataListFieldDefinition
{ {

View File

@@ -2208,6 +2208,7 @@
"NextPMNumber": "Next preventive maintenance", "NextPMNumber": "Next preventive maintenance",
"WorkOrderErrorLocked": "Work order is set to a locked status and can't be changed", "WorkOrderErrorLocked": "Work order is set to a locked status and can't be changed",
"WorkOrderSerialNumber": "Number", "WorkOrderSerialNumber": "Number",
"QuoteSerialNumber": "Number",
"Sequence": "Sequence", "Sequence": "Sequence",
"SoftDelete": "Mark for deletion", "SoftDelete": "Mark for deletion",
"SoftDeleteAll": "Mark all for deletion", "SoftDeleteAll": "Mark all for deletion",

View File

@@ -579,7 +579,7 @@ namespace AyaNova.Util
KnownUserTechRestrictedId = await SeedUserAsync(log, 1, AuthorizationRoles.TechRestricted, UserType.Service, "TechRestricted", "TechRestricted", KnownUserTags); KnownUserTechRestrictedId = await SeedUserAsync(log, 1, AuthorizationRoles.TechRestricted, UserType.Service, "TechRestricted", "TechRestricted", KnownUserTags);
KnownUserTechId = await SeedUserAsync(log, 1, AuthorizationRoles.Tech, UserType.Service, "Tech", "Tech", KnownUserTags); KnownUserTechId = await SeedUserAsync(log, 1, AuthorizationRoles.Tech, UserType.Service, "Tech", "Tech", KnownUserTags);
await SeedUserAsync(log, 1, AuthorizationRoles.SalesRestricted, UserType.NotService, "SalesRestricted", "SalesRestricted", KnownUserTags); await SeedUserAsync(log, 1, AuthorizationRoles.SalesRestricted, UserType.NotService, "SalesRestricted", "SalesRestricted", KnownUserTags);
await SeedUserAsync(log, 1, AuthorizationRoles.Sales, UserType.NotService, "Sales", "Sales", KnownUserTags); KnownUserSalesId = await SeedUserAsync(log, 1, AuthorizationRoles.Sales, UserType.NotService, "Sales", "Sales", KnownUserTags);
@@ -1692,6 +1692,7 @@ namespace AyaNova.Util
public long KnownUserCustomerId = 0; public long KnownUserCustomerId = 0;
public long KnownUserCustomerRestrictedId = 0; public long KnownUserCustomerRestrictedId = 0;
public long KnownCustomerForShadownUnitsId = 0; public long KnownCustomerForShadownUnitsId = 0;
public long KnownUserSalesId = 0;
public async Task<long> SeedUserAsync( public async Task<long> SeedUserAsync(
@@ -2770,6 +2771,15 @@ namespace AyaNova.Util
return ServiceUserIds[Fake.Random.Int(1, ServiceUserIds.Count - 1)]; return ServiceUserIds[Fake.Random.Int(1, ServiceUserIds.Count - 1)];
} }
/*
██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗ ██████╗ ██████╗ ██████╗ ███████╗██████╗
██║ ██║██╔═══██╗██╔══██╗██║ ██╔╝ ██╔═══██╗██╔══██╗██╔══██╗██╔════╝██╔══██╗
██║ █╗ ██║██║ ██║██████╔╝█████╔╝█████╗██║ ██║██████╔╝██║ ██║█████╗ ██████╔╝
██║███╗██║██║ ██║██╔══██╗██╔═██╗╚════╝██║ ██║██╔══██╗██║ ██║██╔══╝ ██╔══██╗
╚███╔███╔╝╚██████╔╝██║ ██║██║ ██╗ ╚██████╔╝██║ ██║██████╔╝███████╗██║ ██║
╚══╝╚══╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═════╝ ╚══════╝╚═╝ ╚═╝
*/
private int TotalSeededWorkOrders = 0; private int TotalSeededWorkOrders = 0;
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
//WORK ORDER //WORK ORDER
@@ -3239,8 +3249,15 @@ namespace AyaNova.Util
//--------------------- QUOTE --------------------------
/*
██████╗ ██╗ ██╗ ██████╗ ████████╗███████╗
██╔═══██╗██║ ██║██╔═══██╗╚══██╔══╝██╔════╝
██║ ██║██║ ██║██║ ██║ ██║ █████╗
██║▄▄ ██║██║ ██║██║ ██║ ██║ ██╔══╝
╚██████╔╝╚██████╔╝╚██████╔╝ ██║ ███████╗
╚══▀▀═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝
*/
private int TotalSeededQuotes = 0; private int TotalSeededQuotes = 0;
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
//Quote //Quote
@@ -3261,8 +3278,8 @@ namespace AyaNova.Util
var woDate = DesiredTimeInUtc(new DateTime(tempDate.Year, tempDate.Month, tempDate.Day, tempHour, 0, 0)); var woDate = DesiredTimeInUtc(new DateTime(tempDate.Year, tempDate.Month, tempDate.Day, tempHour, 0, 0));
o.CreatedDate = woDate > DateTime.UtcNow ? DateTime.UtcNow : woDate;//no created dates in future but want a range of past dates to show off age of wo o.CreatedDate = woDate > DateTime.UtcNow ? DateTime.UtcNow : woDate;//no created dates in future but want a range of past dates to show off age of wo
// o.CompleteByDate = woDate.AddDays(5); o.Requested = woDate.AddDays(-2);
// o.CustomerContactName = "contact name here"; o.PreparedById = KnownUserSalesId;
o.CustomerId = GetRandomCustomerId();//Fake.Random.Long(1, TotalSeededCustomers); o.CustomerId = GetRandomCustomerId();//Fake.Random.Long(1, TotalSeededCustomers);
using (AyContext ct = ServiceProviderProvider.DBContext) using (AyContext ct = ServiceProviderProvider.DBContext)
@@ -3620,6 +3637,7 @@ namespace AyaNova.Util
Created = woDate.AddMinutes(5) Created = woDate.AddMinutes(5)
}; };
o.States.Add(WoState); o.States.Add(WoState);
o.LastStatusId = WoState.QuoteStatusId;
} }