This commit is contained in:
2021-09-24 20:27:20 +00:00
parent 58241b8973
commit 03840ae759
3 changed files with 22 additions and 2 deletions

View File

@@ -10,7 +10,8 @@ namespace AyaNova.DataList
SQLFrom = "from apart "
+ "left join avendor as aman on (apart.manufacturerid=aman.id) "
+ "left join avendor as awhole on (apart.wholesalerid=awhole.id) "
+ "left join avendor as aaltwhole on (apart.alternativewholesalerid=aaltwhole.id)";
+ "left join avendor as aaltwhole on (apart.alternativewholesalerid=aaltwhole.id) ";
//+ "left join apartserial on apartserial.partid=apart.id";
var RoleSet = BizRoles.GetRoleSet(DefaultListAType);
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
DefaultColumns = new List<string>() { "PartPartNumber", "PartName", "PartManufacturerID", "PartWholesalerID", "Tags" };
@@ -146,6 +147,14 @@ namespace AyaNova.DataList
SqlValueColumnName = "apart.upc"
});
FieldDefinitions.Add(new DataListFieldDefinition
{
TKey = "PartSerialNumbersAvailable",
FieldKey = "PartSerialNumbersAvailable",
UiFieldDataType = (int)UiFieldDataType.Text,
SqlValueColumnName = "(select array_agg(serial) from apartserial where partid=apart.id group by partid) as sub_serials"
});
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartCustom1", FieldKey = "partcustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartCustom2", FieldKey = "partcustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartCustom3", FieldKey = "partcustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });

View File

@@ -524,6 +524,15 @@ namespace AyaNova.Biz
o.ManufacturerViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == o.ManufacturerId).Select(x => x.Name).FirstOrDefaultAsync();
if (o.AlternativeWholeSalerId != null)
o.AlternativeWholeSalerViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == o.AlternativeWholeSalerId).Select(x => x.Name).FirstOrDefaultAsync();
//Ok, this one I'm not comfortable with but it was insisted upon
//so if there turns out to be a situation where there are just too many serials slowing down the reporting always
//can look at tying this to the report data list column selection to check if serials are selected to display or not
o.PartSerialsViz = $"[{string.Join(',', (await ct.PartSerial.Where(z => z.PartId == o.Id).OrderBy(z => z.Serial).Select(z => $"'{z.Serial}'").ToListAsync()))}]";
}
////////////////////////////////////////////////////////////////////////////////////////////////
@@ -659,7 +668,7 @@ namespace AyaNova.Biz
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj = null)
{
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<PartBiz>();
if(ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
if (ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
bool isNew = currentObj == null;

View File

@@ -44,6 +44,8 @@ namespace AyaNova.Models
public string UnitOfMeasure { get; set; }
public string UPC { get; set; }
[NotMapped]
public string PartSerialsViz { get; set; }
public Part()