This commit is contained in:
2021-08-03 20:15:45 +00:00
parent 0a12b35d20
commit 30363f6c5b
5 changed files with 28 additions and 15 deletions

View File

@@ -4780,6 +4780,13 @@ namespace AyaNova.Biz
log.LogInformation($"Found {l.Count} inventory checkable PM orders for subscription id {sub.Id}");
#endif
//Get the translations for this user
List<string> transl=new List<string>();
transl.Add("Part");
transl.Add("PartWarehouse");
transl.Add("required");
TranslationBiz.GetSubsetForUserStaticAsync(,sub.UserId);
//process those pms
foreach (long pmid in l)
{
@@ -4787,16 +4794,17 @@ namespace AyaNova.Biz
log.LogInformation($"processing pm id {pmid}");
#endif
//look for same delivery already made and skip if already notified (sb one time only but will repeat for > 90 days as delivery log gets pruned)
if (await ct.NotifyDeliveryLog.AnyAsync(z => z.NotifySubscriptionId == sub.Id && z.ObjectId == pmid))
{
log.LogTrace($"PM {pmid} insufficient inventory already notified to subscriber within last 90 days, no need to send again, skipping");
//############### TODO UNCOMMENT THIS AFTER TESTING ############################
// //look for same delivery already made and skip if already notified (sb one time only but will repeat for > 90 days as delivery log gets pruned)
// if (await ct.NotifyDeliveryLog.AnyAsync(z => z.NotifySubscriptionId == sub.Id && z.ObjectId == pmid))
// {
// log.LogTrace($"PM {pmid} insufficient inventory already notified to subscriber within last 90 days, no need to send again, skipping");
#if (DEBUG)
log.LogInformation($"PM {pmid} insufficient inventory already notified to subscriber within last 90 days, no need to send again, skipping");
#endif
continue;
}
// #if (DEBUG)
// log.LogInformation($"PM {pmid} insufficient inventory already notified to subscriber within last 90 days, no need to send again, skipping");
// #endif
// continue;
// }
//Ok, it's worth checking out and could be a potential notification
@@ -4853,14 +4861,15 @@ namespace AyaNova.Biz
{
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 - dBalance}");
var qty=(i.QuantityRequired-dBalance).ToString("G29", System.Globalization.CultureInfo.InvariantCulture);
sb.Append($"~part~ {part}, ~whs~ {whs} ~required~ {qty}\n");
}
}
if (sb.Length > 0)
{
NotifyEvent n = new NotifyEvent()
{
EventType = NotifyEventType.PMStopGeneratingDateReached,
EventType = NotifyEventType.PMInsufficientInventory,
UserId = sub.UserId,
AyaType = AyaType.PM,
ObjectId = p.Id,

View File

@@ -2300,5 +2300,6 @@
"PMNextWoGenerateDate":"Nächstes Generierungsdatum",
"ExcludeDaysOfWeek":"Wochentage ausschließen",
"ErrorGenBeforeTooSmall":"Muss kleiner sein als Wiederholungsintervall",
"ErrorRepeatIntervalTooSmall":"Mindestens eine Stunde"
"ErrorRepeatIntervalTooSmall":"Mindestens eine Stunde",
"QuantityRequired":"Quantity required"
}

View File

@@ -2300,6 +2300,7 @@
"PMNextWoGenerateDate":"Next generate event",
"ExcludeDaysOfWeek":"Exclude days of week",
"ErrorGenBeforeTooSmall":"Must be smaller than Repeat interval",
"ErrorRepeatIntervalTooSmall":"Minimum one hour"
"ErrorRepeatIntervalTooSmall":"Minimum one hour",
"QuantityRequired":"Quantity required"
}

View File

@@ -2300,5 +2300,6 @@
"PMNextWoGenerateDate":"Siguiente evento de generación",
"ExcludeDaysOfWeek":"Excluir días de la semana",
"ErrorGenBeforeTooSmall":"Debe ser menor que el intervalo de repetición",
"ErrorRepeatIntervalTooSmall":"Mínimo una hora"
"ErrorRepeatIntervalTooSmall":"Mínimo una hora",
"QuantityRequired":"Quantity required"
}

View File

@@ -2300,5 +2300,6 @@
"PMNextWoGenerateDate":"Prochain événement de génération",
"ExcludeDaysOfWeek":"Exclure les jours de la semaine",
"ErrorGenBeforeTooSmall":"Doit être inférieur à l'intervalle de répétition",
"ErrorRepeatIntervalTooSmall":"Au moins une heure"
"ErrorRepeatIntervalTooSmall":"Au moins une heure",
"QuantityRequired":"Quantity required"
}