This commit is contained in:
2021-02-24 15:50:58 +00:00
parent 12782bec71
commit b801b0548d
5 changed files with 37 additions and 31 deletions

2
.vscode/launch.json vendored
View File

@@ -53,7 +53,7 @@
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles", "AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles", "AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles", "AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
"AYANOVA_SERVER_TEST_MODE": "false", "AYANOVA_SERVER_TEST_MODE": "true",
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small", "AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7", "AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\" "AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"

View File

@@ -16,7 +16,7 @@ namespace AyaNova.DataList
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
DefaultColumns = new List<string>() { "PurchaseOrderPONumber", "Vendor", "PurchaseOrderOrderedDate", "PurchaseOrderStatus", DefaultColumns = new List<string>() { "PurchaseOrderPONumber", "Vendor", "PurchaseOrderOrderedDate", "PurchaseOrderStatus",
"PurchaseOrderExpectedReceiveDate" }; "PurchaseOrderExpectedReceiveDate" };
DefaultSortBy = new Dictionary<string, string>() { { "PurchaseOrderPONumber", "+" } }; DefaultSortBy = new Dictionary<string, string>() { { "PurchaseOrderPONumber", "-" } };
FieldDefinitions = new List<DataListFieldDefinition>(); FieldDefinitions = new List<DataListFieldDefinition>();
FieldDefinitions.Add(new DataListFieldDefinition FieldDefinitions.Add(new DataListFieldDefinition

View File

@@ -568,10 +568,15 @@ namespace AyaNova.Biz
var batch = idList.Take(IReportAbleObject.REPORT_DATA_BATCH_SIZE); var batch = idList.Take(IReportAbleObject.REPORT_DATA_BATCH_SIZE);
idList = idList.Skip(IReportAbleObject.REPORT_DATA_BATCH_SIZE).ToArray(); idList = idList.Skip(IReportAbleObject.REPORT_DATA_BATCH_SIZE).ToArray();
//query for this batch, comes back in db natural order unfortunately //query for this batch, comes back in db natural order unfortunately
var batchResults = await ct.Project.AsNoTracking().Where(z => batch.Contains(z.Id)).ToArrayAsync(); //TODO: for reporting this would be more ideal if it populated the displayName fields
//I'm doing that in this object already by fluke, and don't really want to populate them always and in other objects but for reporting maybe
//have a report mode get or I guess just do it all here (but then need for export as well, but then again this is the way it gets for export via getreportdata)
//so perhaps we have a REPORT format of a biz object model and that format has display names mirroring all the fields
//it's fetching it here anyway, might as well do the whole shebang?
var batchResults = await ct.PurchaseOrder.AsNoTracking().Where(z => batch.Contains(z.Id)).ToArrayAsync();
//order the results back into original //order the results back into original
var orderedList = from id in batch join z in batchResults on id equals z.Id select z; var orderedList = from id in batch join z in batchResults on id equals z.Id select z;
foreach (Project w in orderedList) foreach (PurchaseOrder w in orderedList)
{ {
var jo = JObject.FromObject(w); var jo = JObject.FromObject(w);
if (!JsonUtil.JTokenIsNullOrEmpty(jo["CustomFields"])) if (!JsonUtil.JTokenIsNullOrEmpty(jo["CustomFields"]))
@@ -689,7 +694,7 @@ namespace AyaNova.Biz
// //
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj = null) public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj = null)
{ {
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<ProjectBiz>(); ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<PurchaseOrderBiz>();
if (ServerBootConfig.SEEDING) return; if (ServerBootConfig.SEEDING) return;
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]"); log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");

View File

@@ -2,8 +2,6 @@ using AyaNova.Models;
using System.Linq; using System.Linq;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
namespace AyaNova.Biz namespace AyaNova.Biz
{ {
//VALIDATE **USER DEFINED** (not stock) REQUIRED FIELDS THAT ARE NOT CUSTOM //VALIDATE **USER DEFINED** (not stock) REQUIRED FIELDS THAT ARE NOT CUSTOM
@@ -16,12 +14,8 @@ namespace AyaNova.Biz
//No form custom = no template to check against so nothing to do //No form custom = no template to check against so nothing to do
if (formCustom == null || string.IsNullOrWhiteSpace(formCustom.Template)) if (formCustom == null || string.IsNullOrWhiteSpace(formCustom.Template))
return; return;
//var OuterJson=JObject.Parse(formCustom.Template);
var FormTemplate = JArray.Parse(formCustom.Template); var FormTemplate = JArray.Parse(formCustom.Template);
// var FormTemplate=(JArray)OuterJson["template"];
var FormFields = Biz.FormFieldOptionalCustomizableReference.FormFieldReferenceList(formCustom.FormKey); var FormFields = Biz.FormFieldOptionalCustomizableReference.FormFieldReferenceList(formCustom.FormKey);
// var ThisFormNormalFieldsList = FormFields.Where(z => z.Custom == false).Select(z => z.Key).ToList();
foreach (JObject jo in FormTemplate) foreach (JObject jo in FormTemplate)
{ {
@@ -35,10 +29,8 @@ namespace AyaNova.Biz
FormField FF = FormFields.Where(z => z.FieldKey == FldLtKey).Single(); FormField FF = FormFields.Where(z => z.FieldKey == FldLtKey).Single();
//don't validate custom fields, just skip them //don't validate custom fields, just skip them
// if (!string.IsNullOrWhiteSpace(FF.PropertyName))//this used to work because there would be no property name but now there is so it doesn't
if (!FF.IsCustomField) if (!FF.IsCustomField)
{ {
//Now get the actual property name from the available fields using the lt key //Now get the actual property name from the available fields using the lt key
string RequiredPropertyName = FF.FieldKey; string RequiredPropertyName = FF.FieldKey;
@@ -87,21 +79,6 @@ namespace AyaNova.Biz
GrandParentIndex++; GrandParentIndex++;
} }
} }
// var item = proposedObject.GetType().GetProperty(FieldKeyParts[0]).GetValue(proposedObject, null);
// if (item is System.Collections.IEnumerable)
// {
// foreach (object o in (item as System.Collections.IEnumerable))
// {
// var subitem = o.GetType().GetProperty(FieldKeyParts[1]).GetValue(o, null);
// }
// }
// else
// {
// // reflect over item
// }
// // object propertyValue = proposedObject.GetType().GetProperty(RequiredPropertyName).GetValue(proposedObject, null);
} }
else else
{ {

View File

@@ -714,8 +714,13 @@ namespace AyaNova.Util
} }
} }
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
//TAX CODES //TAX CODES
long TCSales = 0, TCGoods = 0, TCBoth = 0;
{ {
{ {
TaxCode tc = new TaxCode(); TaxCode tc = new TaxCode();
@@ -737,6 +742,7 @@ namespace AyaNova.Util
log.LogError(err); log.LogError(err);
throw new System.Exception(err); throw new System.Exception(err);
} }
TCSales = NewObject.Id;
} }
} }
{ {
@@ -759,6 +765,7 @@ namespace AyaNova.Util
log.LogError(err); log.LogError(err);
throw new System.Exception(err); throw new System.Exception(err);
} }
TCGoods = NewObject.Id;
} }
} }
{ {
@@ -781,11 +788,28 @@ namespace AyaNova.Util
log.LogError(err); log.LogError(err);
throw new System.Exception(err); throw new System.Exception(err);
} }
TCBoth = NewObject.Id;
} }
} }
} }
/////////////////////////////////////////////////////
//GLOBAL SETTINGS
{
using (AyContext ct = ServiceProviderProvider.DBContext)
{
GlobalBizSettingsBiz biz = GlobalBizSettingsBiz.GetBiz(ct);
var gbiz = await biz.GetAsync(false);
gbiz.TaxPartPurchaseId = TCGoods;
gbiz.TaxPartSaleId = TCGoods;
gbiz.TaxRateSaleId = TCSales;
await biz.PutAsync(gbiz);
}
}
/////////////////////////////////////////////// ///////////////////////////////////////////////
} }
@@ -1719,10 +1743,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, 4) != 3); bool addTaxCode = (Fake.Random.Number(1, 4) != 3);
//simulate some items not received //simulate some items not received
bool isReceived = (Fake.Random.Number(1, 4) != 3); bool isReceived = (Fake.Random.Number(1, 4) != 3);
o.Status = isReceived ? PurchaseOrderStatus.ClosedFullReceived : PurchaseOrderStatus.OpenOrdered; o.Status = isReceived ? PurchaseOrderStatus.ClosedFullReceived : PurchaseOrderStatus.OpenOrdered;