This commit is contained in:
@@ -1552,13 +1552,9 @@ namespace AyaNova.Util
|
|||||||
//
|
//
|
||||||
public async Task SeedPartAsync(ILogger log, int count)
|
public async Task SeedPartAsync(ILogger log, int count)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
for (int x = 0; x < count; x++)
|
for (int x = 0; x < count; x++)
|
||||||
{
|
{
|
||||||
Part o = new Part();
|
Part o = new Part();
|
||||||
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
o.PartNumber = Fake.Finance.Account(6);
|
o.PartNumber = Fake.Finance.Account(6);
|
||||||
@@ -1723,6 +1719,10 @@ namespace AyaNova.Util
|
|||||||
int partCount = Fake.Random.Int(1, 5);
|
int partCount = Fake.Random.Int(1, 5);
|
||||||
//simulate some items without tax codes
|
//simulate some items without tax codes
|
||||||
bool addTaxCode = (Fake.Random.Number(1, 3) == 2);
|
bool addTaxCode = (Fake.Random.Number(1, 3) == 2);
|
||||||
|
|
||||||
|
//simulate some items not received
|
||||||
|
bool isReceived = (Fake.Random.Number(1, 3) == 2);
|
||||||
|
|
||||||
for (int y = 0; y < partCount; y++)
|
for (int y = 0; y < partCount; y++)
|
||||||
{
|
{
|
||||||
long partId = 0;
|
long partId = 0;
|
||||||
@@ -1732,16 +1732,17 @@ namespace AyaNova.Util
|
|||||||
} while (partsAdded.Contains(partId));
|
} while (partsAdded.Contains(partId));
|
||||||
partsAdded.Add(partId);
|
partsAdded.Add(partId);
|
||||||
var qty = Fake.Random.Int(1, 100);
|
var qty = Fake.Random.Int(1, 100);
|
||||||
|
var cost = Fake.Random.Decimal(1, 25);
|
||||||
|
|
||||||
o.Items.Add(new PurchaseOrderItem()
|
o.Items.Add(new PurchaseOrderItem()
|
||||||
{
|
{
|
||||||
PartId = partId,
|
PartId = partId,
|
||||||
PartWarehouseId = Fake.Random.Long(1, 3),
|
PartWarehouseId = Fake.Random.Long(1, 3),
|
||||||
QuantityOrdered = qty,
|
QuantityOrdered = qty,
|
||||||
QuantityReceived = qty,
|
QuantityReceived = isReceived ? qty : 0,
|
||||||
PurchaseOrderCost = 10,
|
PurchaseOrderCost = cost,
|
||||||
ReceivedCost = 10,
|
ReceivedCost = isReceived ? cost : 0,
|
||||||
ReceivedDate = o.ExpectedReceiveDate,
|
ReceivedDate = isReceived ? o.ExpectedReceiveDate : null,
|
||||||
PurchaseTaxCodeId = addTaxCode ? 3 : null//sales and goods
|
PurchaseTaxCodeId = addTaxCode ? 3 : null//sales and goods
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user