This commit is contained in:
@@ -4775,14 +4775,14 @@ namespace AyaNova.Biz
|
|||||||
.Where(z => z.GenerateDate < checkUpToDate && z.Active == true)
|
.Where(z => z.GenerateDate < checkUpToDate && z.Active == true)
|
||||||
.Select(z => z.Id)
|
.Select(z => z.Id)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
#if (DEBUG)
|
|
||||||
if (l.Count > 0)
|
if (l.Count > 0)
|
||||||
log.LogInformation($"Found {l.Count} inventory checkable PM orders for subscription id {sub.Id}");
|
log.LogDebug($"Found {l.Count} inventory checkable PM orders for subscription id {sub.Id}");
|
||||||
#endif
|
|
||||||
|
|
||||||
//Get the translations for this user
|
//Get the translations for this user
|
||||||
List<string> transl = new List<string>();
|
List<string> transl = new List<string>();
|
||||||
transl.Add("Part");
|
transl.Add("PartPartNumber");
|
||||||
transl.Add("PartWarehouse");
|
transl.Add("PartWarehouse");
|
||||||
transl.Add("QuantityRequired");
|
transl.Add("QuantityRequired");
|
||||||
var Trans = await TranslationBiz.GetSubsetForUserStaticAsync(transl, sub.UserId);
|
var Trans = await TranslationBiz.GetSubsetForUserStaticAsync(transl, sub.UserId);
|
||||||
@@ -4790,21 +4790,17 @@ namespace AyaNova.Biz
|
|||||||
//process those pms
|
//process those pms
|
||||||
foreach (long pmid in l)
|
foreach (long pmid in l)
|
||||||
{
|
{
|
||||||
#if (DEBUG)
|
|
||||||
log.LogInformation($"processing pm id {pmid}");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//############### TODO UNCOMMENT THIS AFTER TESTING ############################
|
log.LogDebug($"processing pm id {pmid}");
|
||||||
// //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
|
//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)
|
||||||
// continue;
|
if (await ct.NotifyDeliveryLog.AnyAsync(z => z.NotifySubscriptionId == sub.Id && z.ObjectId == pmid))
|
||||||
// }
|
{
|
||||||
|
log.LogDebug($"PM {pmid} insufficient inventory already notified to subscriber within last 90 days, no need to send again, skipping");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//Ok, it's worth checking out and could be a potential notification
|
//Ok, it's worth checking out and could be a potential notification
|
||||||
|
|
||||||
@@ -4820,11 +4816,12 @@ namespace AyaNova.Biz
|
|||||||
log.LogError($"PM was not fetchable when attempting to process PM id: {pmid}, deleted during processing?");
|
log.LogError($"PM was not fetchable when attempting to process PM id: {pmid}, deleted during processing?");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
//Tag match? (will be true if no sub tags so always safe to call this)
|
||||||
//check inventory and notify
|
if (!NotifyEventHelper.ObjectHasAllSubscriptionTags(p.Tags, sub.Tags))
|
||||||
//if so, iterate pm examine inventory and determine if short of anything and build a notification for it line by line to send as message:
|
{
|
||||||
//title = pm insufficient and id and object link to pm
|
log.LogDebug($"PM tags don't match subscription required tags PM id: {pmid}, skipping");
|
||||||
//message = list: part name, -xx (short quantity), no text if possible so no translate needed
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//collect the parts on the pm
|
//collect the parts on the pm
|
||||||
List<PMRestockListItem> PartsOnPM = new List<PMRestockListItem>();
|
List<PMRestockListItem> PartsOnPM = new List<PMRestockListItem>();
|
||||||
@@ -4862,7 +4859,7 @@ namespace AyaNova.Biz
|
|||||||
var part = await ct.Part.AsNoTracking().Where(x => x.Id == i.PartId).Select(x => x.PartNumber).FirstOrDefaultAsync();
|
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();
|
var whs = await ct.PartWarehouse.AsNoTracking().Where(x => x.Id == i.WarehouseId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||||
var qty = (i.QuantityRequired - dBalance).ToString("G29", System.Globalization.CultureInfo.InvariantCulture);
|
var qty = (i.QuantityRequired - dBalance).ToString("G29", System.Globalization.CultureInfo.InvariantCulture);
|
||||||
sb.Append($"{Trans["Part"]}: {part}, {Trans["PartWarehouse"]}: {whs}, {Trans["QuantityRequired"]}: {qty}\n");
|
sb.Append($"{Trans["PartPartNumber"]}: {part}, {Trans["PartWarehouse"]}: {whs}, {Trans["QuantityRequired"]}: {qty}\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sb.Length > 0)
|
if (sb.Length > 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user