This commit is contained in:
2021-02-25 16:03:16 +00:00
parent 6358a94fd3
commit d70b1f3066
4 changed files with 38 additions and 3 deletions

View File

@@ -22,7 +22,7 @@ namespace AyaNova.Util
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
private const int DESIRED_SCHEMA_LEVEL = 15;
internal const long EXPECTED_COLUMN_COUNT = 735;
internal const long EXPECTED_COLUMN_COUNT = 736;
internal const long EXPECTED_INDEX_COUNT = 125;
internal const long EXPECTED_CHECK_CONSTRAINTS = 328;
internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 70;
@@ -744,7 +744,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
await ExecQueryAsync("CREATE TABLE apurchaseorderitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, purchaseorderid BIGINT NOT NULL REFERENCES apurchaseorder ON DELETE CASCADE, " +
"partid BIGINT NOT NULL REFERENCES apart, partwarehouseid BIGINT NOT NULL REFERENCES apartwarehouse, quantityordered DECIMAL(19,4) NOT NULL default 0, " +
"quantityreceived DECIMAL(19,4) NOT NULL default 0, purchaseordercost DECIMAL(19,4) NOT NULL default 0, receivedcost DECIMAL(19,4) NOT NULL default 0, " +
"receiveddate TIMESTAMP, partrequestedbyid BIGINT REFERENCES auser, purchasetaxcodeid BIGINT REFERENCES ataxcode, vendorpartnumber TEXT " +
"receiveddate TIMESTAMP, partrequestedbyid BIGINT REFERENCES auser, purchasetaxcodeid BIGINT REFERENCES ataxcode, vendorpartnumber TEXT, serials TEXT " +
")");

View File

@@ -1742,6 +1742,9 @@ namespace AyaNova.Util
List<long> partsAdded = new List<long>();
int partCount = Fake.Random.Int(1, 5);
//simulate some items without tax codes
bool addTaxCode = (Fake.Random.Number(1, 4) != 3);
@@ -1761,6 +1764,19 @@ namespace AyaNova.Util
var qty = Fake.Random.Int(1, 100);
var cost = Fake.Random.Decimal(1, 25);
// 50% chance it has received serial numbers
string serials = string.Empty;
if (isReceived && Fake.Random.Number() == 1)
{
var serialStart = Fake.Finance.Account().ToString();
for (int si = 0; si < qty; si++)
{
serials += serialStart + si.ToString() + ", ";
}
serials = serials.TrimEnd().TrimEnd(',');
}
o.Items.Add(new PurchaseOrderItem()
{
PartId = partId,
@@ -1770,7 +1786,8 @@ namespace AyaNova.Util
PurchaseOrderCost = cost,
ReceivedCost = isReceived ? cost : 0,
ReceivedDate = isReceived ? o.ExpectedReceiveDate : null,
PurchaseTaxCodeId = addTaxCode ? 3 : null//sales and goods
PurchaseTaxCodeId = addTaxCode ? 3 : null,//sales and goods
Serials = serials
});
}