diff --git a/server/AyaNova/biz/PMBiz.cs b/server/AyaNova/biz/PMBiz.cs index 6b6a597f..4c9e81e0 100644 --- a/server/AyaNova/biz/PMBiz.cs +++ b/server/AyaNova/biz/PMBiz.cs @@ -4842,8 +4842,29 @@ namespace AyaNova.Biz .Select(cl => new PMRestockListItem() { PartId = cl.First().PartId, WarehouseId = cl.First().WarehouseId, QuantityRequired = cl.Sum(c => c.QuantityRequired) }); //ok, should have all summarized partid/warehouseid required combos, can now build output - - + System.Text.StringBuilder sb = new System.Text.StringBuilder(); + foreach (var i in sumList) + { + var part = await ct.Part.AsNoTracking().Where(x => x.Id == i.PartId).Select(x => x.PartNumber).FirstOrDefaultAsync(); + var whs = await ct.PartWarehouse.AsNoTracking().Where(x => x.Id == i.WarehouseId).Select(x => x.Name).FirstOrDefaultAsync(); + sb.AppendLine($"{part} {whs} - {i.QuantityRequired}"); + } + if (sb.Length > 0) + { + NotifyEvent n = new NotifyEvent() + { + EventType = NotifyEventType.PMStopGeneratingDateReached, + UserId = sub.UserId, + AyaType = AyaType.PM, + ObjectId = p.Id, + NotifySubscriptionId = sub.Id, + Name = p.Serial.ToString(), + Message = sb.ToString() + }; + await ct.NotifyEvent.AddAsync(n); + log.LogDebug($"Adding NotifyEvent: [{n.ToString()}]"); + await ct.SaveChangesAsync(); + } }//each pmid