This commit is contained in:
@@ -106,11 +106,17 @@ namespace AyaNova.Biz
|
||||
{
|
||||
var ret = await ct.PurchaseOrder.Include(z => z.Items).AsNoTracking().SingleOrDefaultAsync(z => z.Id == id);
|
||||
//populate names for client ui
|
||||
var pl = new PickListBiz(ct, UserId, UserTranslationId, CurrentUserRoles);
|
||||
var log = AyaNova.Util.ApplicationLogging.CreateLogger("PurchaseOrderBiz::GetAsync");
|
||||
|
||||
foreach (PurchaseOrderItem item in ret.Items)
|
||||
{
|
||||
item.PartName = await pl.GetTemplatedNameAsync(AyaType.Part, item.PartId, null, log);
|
||||
item.DisplayPartNumber = await ct.Part.AsNoTracking().Where(x => x.Id == item.PartId).Select(x => x.PartNumber).SingleAsync();
|
||||
item.DisplayWarehouse = await ct.PartWarehouse.AsNoTracking().Where(x => x.Id == item.PartWarehouseId).Select(x => x.Name).SingleAsync();
|
||||
if (item.PartRequestedById != null)
|
||||
item.DisplayRequestUser = await ct.User.AsNoTracking().Where(x => x.Id == item.PartRequestedById).Select(x => x.Name).SingleAsync();
|
||||
if (item.WorkorderItemPartRequestId != null)
|
||||
item.DisplayRequestWorkorder = "todo:woidfromleafnode";//MIGRATE_OUTSTANDING routine to get wo id from the woitempartrequestid
|
||||
if (item.PurchaseTaxCodeId != null)
|
||||
item.DisplayTaxCode = await ct.TaxCode.AsNoTracking().Where(x => x.Id == item.PurchaseTaxCodeId).Select(x => x.Name).SingleAsync();
|
||||
}
|
||||
if (logTheGetEvent && ret != null)
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, id, BizType, AyaEvent.Retrieved), ct);
|
||||
|
||||
@@ -30,14 +30,25 @@ namespace AyaNova.Models
|
||||
public long? PurchaseTaxCodeId { get; set; }
|
||||
public string VendorPartNumber { get; set; }
|
||||
|
||||
//mirror name fields to save a roundtrip to the UI, not persisted
|
||||
[NotMapped]
|
||||
public string PartName { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public PurchaseOrder PurchaseOrder { get; set; }
|
||||
|
||||
|
||||
//mirror fields to save a roundtrip to the UI, not persisted
|
||||
[NotMapped]
|
||||
public string DisplayPartNumber { get; set; }
|
||||
[NotMapped]
|
||||
public string DisplayWarehouse { get; set; }
|
||||
[NotMapped]
|
||||
public string DisplayRequestUser { get; set; }
|
||||
[NotMapped]
|
||||
public string DisplayRequestWorkorder { get; set; }
|
||||
[NotMapped]
|
||||
public string DisplayTaxCode { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
}//eoc
|
||||
|
||||
}//eons
|
||||
|
||||
Reference in New Issue
Block a user