This commit is contained in:
2021-02-18 15:42:07 +00:00
parent 495dfcf619
commit a740177d7c
2 changed files with 9 additions and 4 deletions

View File

@@ -317,7 +317,8 @@ namespace AyaNova.Biz
//Some kind of update so fetch the parts so the default part values can be set on the poItem if necessary
var PoParts = await ct.Part.AsNoTracking().Where(x => newObj.Items.Any(z => z.PartId == x.Id)).ToListAsync();
var listOfPoPartIds = newObj.Items.Select(x => x.PartId).ToList();
var PoParts = await ct.Part.AsNoTracking().Where(x => listOfPoPartIds.Contains(x.Id)).ToListAsync();
//CREATED
if (ayaEvent == AyaEvent.Created)

View File

@@ -1567,12 +1567,16 @@ namespace AyaNova.Util
o.Active = true;
o.Notes = Fake.Lorem.Sentence();
o.Tags = RandomTags();
o.ManufacturerId = Fake.Random.Long(1, TotalSeededVendors);//random picks in range Inclusive but sql id's start at 1 so this is kosher (not zero based)
o.ManufacturerId = Fake.Random.Long(1, 3);//There are minimum 10 vendors seeded, want parts all in the first few so that some po stuff can kick in (vendorpartnumber etc)
o.ManufacturerNumber = "man-" + o.PartNumber;
o.UPC = Fake.Commerce.Ean13();
o.WholeSalerId = Fake.Random.Long(1, TotalSeededVendors);//random picks in range Inclusive but sql id's start at 1 so this is kosher (not zero based)
o.WholeSalerId = Fake.Random.Long(4, 6);
o.WholeSalerNumber = "ws-" + o.PartNumber;
o.AlternativeWholeSalerId = Fake.Random.Long(7, 9);
o.AlternativeWholeSalerNumber = "aws-" + o.PartNumber;
o.Cost = Fake.Random.Decimal(1, 25);
o.Retail = o.Cost * 1.2m;
o.UnitOfMeasure = "each";
@@ -1700,7 +1704,7 @@ namespace AyaNova.Util
for (int x = 0; x < count; x++)
{
PurchaseOrder o = new PurchaseOrder();
o.VendorId = Fake.Random.Long(1, TotalSeededVendors);
o.VendorId = Fake.Random.Long(1, 9);//this matches the range set in parts so that we get some vendor numbers being set
var poDate = Fake.Date.Between(seedStartWindow, seedEndWindow);
o.OrderedDate = poDate.ToUniversalTime();
o.ExpectedReceiveDate = poDate.AddDays(5).ToUniversalTime();