This commit is contained in:
2021-05-25 23:09:11 +00:00
parent d1d9b85263
commit c430da05dd
9 changed files with 58 additions and 45 deletions

View File

@@ -81,6 +81,12 @@ namespace AyaNova.Biz
{
await GetCurrentContractFromContractIdAsync(newObject.ContractId);
await ProcessChangeOfContractAsync(newObject.Id);
//GRANDCHILD BIZ ACTIONS
foreach (WorkOrderItem wi in newObject.Items)
foreach (WorkOrderItemPart wip in wi.Parts)
await PartBizActionsAsync(AyaEvent.Created, wip, null, null);
await ct.SaveChangesAsync();
}
await WorkOrderPopulateVizFields(newObject, true);//doing this here ahead of notification because notification may require the viz field lookup anyway and afaict no harm in it
@@ -3061,6 +3067,8 @@ namespace AyaNova.Biz
Part part = null;
if (o.PartId != 0)
part = await ct.Part.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.PartId);
o.PartViz = part.Name;
TaxCode Tax = null;
if (o.TaxPartSaleId != null)
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxPartSaleId);
@@ -3166,7 +3174,7 @@ namespace AyaNova.Biz
return;
//SNAPSHOT PRICING
bool ApplyPricingUpdate = true;
bool SnapshotPricing = true;
//if modifed, see what has changed and should be re-applied
if (ayaEvent == AyaEvent.Modified)
@@ -3174,13 +3182,13 @@ namespace AyaNova.Biz
//If it wasn't a complete part change there is no need to set pricing
if (newObj.PartId == oldObj.PartId)
{
ApplyPricingUpdate = false;
SnapshotPricing = false;
}
}
//Pricing
if (ApplyPricingUpdate)
if (SnapshotPricing)
{
//default in case nothing to apply
newObj.Cost = 0;