This commit is contained in:
@@ -16,8 +16,6 @@ namespace AyaNova.DataList
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
|
||||
|
||||
//######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
||||
//Default ListView - show all transactions in order
|
||||
dynamic dlistView = new JArray();
|
||||
@@ -98,7 +96,6 @@ namespace AyaNova.DataList
|
||||
IsRowId = true//should open to eventlog since no edit
|
||||
});
|
||||
|
||||
|
||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
{
|
||||
TKey = "PartInventoryTransactionEntryDate",
|
||||
|
||||
@@ -62,6 +62,10 @@ namespace AyaNova.Biz
|
||||
newObject.LastBalance = LastEntry.Balance;
|
||||
newObject.Balance = LastEntry.Balance + newObject.Quantity;
|
||||
}
|
||||
else
|
||||
{
|
||||
newObject.Balance = newObject.Quantity;
|
||||
}
|
||||
|
||||
await ValidateAsync(newObject);
|
||||
if (HasErrors)
|
||||
@@ -186,7 +190,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
//values must add up
|
||||
if (proposedObj.LastBalance != null && proposedObj.Balance != proposedObj.LastBalance + proposedObj.Quantity)
|
||||
if (proposedObj.Balance != (proposedObj.LastBalance ?? 0 + proposedObj.Quantity))
|
||||
{
|
||||
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Balance", "Balance incorrect (LastBalance + Quantity not equal to Balance");
|
||||
return;
|
||||
|
||||
@@ -67,6 +67,12 @@ namespace AyaNova.Biz
|
||||
newObject.IncidentsBalance = LastEntry.IncidentsBalance + newObject.Incidents;
|
||||
newObject.CurrencyBalance = LastEntry.CurrencyBalance + newObject.Currency;
|
||||
}
|
||||
else
|
||||
{
|
||||
newObject.HoursBalance = newObject.Hours;
|
||||
newObject.IncidentsBalance = newObject.Incidents;
|
||||
newObject.CurrencyBalance = newObject.Currency;
|
||||
}
|
||||
|
||||
await ValidateAsync(newObject);
|
||||
if (HasErrors)
|
||||
@@ -197,17 +203,17 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
//values must add up
|
||||
if (proposedObj.LastIncidentsBalance != null && proposedObj.IncidentsBalance != proposedObj.LastIncidentsBalance + proposedObj.Incidents)
|
||||
if (proposedObj.IncidentsBalance != (proposedObj.LastIncidentsBalance ?? 0 + proposedObj.Incidents))
|
||||
{
|
||||
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "generalerror", "LT:ServiceBankIncidentsBalance");
|
||||
return;
|
||||
}
|
||||
if (proposedObj.LastCurrencyBalance != null && proposedObj.CurrencyBalance != proposedObj.LastCurrencyBalance + proposedObj.Currency)
|
||||
if (proposedObj.CurrencyBalance != (proposedObj.LastCurrencyBalance ?? 0 + proposedObj.Currency))
|
||||
{
|
||||
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "generalerror", "LT:ServiceBankCurrencyBalance");
|
||||
return;
|
||||
}
|
||||
if (proposedObj.LastHoursBalance != null && proposedObj.HoursBalance != proposedObj.LastHoursBalance + proposedObj.Hours)
|
||||
if (proposedObj.HoursBalance != (proposedObj.LastHoursBalance ?? 0 + proposedObj.Hours))
|
||||
{
|
||||
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "generalerror", "LT:ServiceBankHoursBalance");
|
||||
return;
|
||||
|
||||
@@ -1537,8 +1537,8 @@ namespace AyaNova.Util
|
||||
throw new System.Exception(err);
|
||||
}
|
||||
|
||||
// 50% chance it has serial numbers
|
||||
//MIGRATE_OUTSTANDING this is just temporary until inventory is coded fully
|
||||
PartInventoryBiz PartInventoryBizNess = PartInventoryBiz.GetBiz(ct);
|
||||
// 50% chance it has serial numbers
|
||||
if (Fake.Random.Number() == 1)
|
||||
{
|
||||
var serialCount = Fake.Random.Number(1, 5);
|
||||
@@ -1548,6 +1548,13 @@ namespace AyaNova.Util
|
||||
|
||||
}
|
||||
await ct.SaveChangesAsync();
|
||||
//add inventory to cover serials
|
||||
await PartInventoryBizNess.CreateAsync(new dtPartInventory() { PartId = NewObject.Id, PartWarehouseId = 1, Quantity = serialCount });
|
||||
}
|
||||
else
|
||||
{
|
||||
//add random inventory level
|
||||
await PartInventoryBizNess.CreateAsync(new dtPartInventory() { PartId = NewObject.Id, PartWarehouseId = 1, Quantity = Fake.Random.Number(1, 100) });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user