This commit is contained in:
2021-01-22 16:01:56 +00:00
parent ef9d48eabe
commit c66d080f9f
4 changed files with 124 additions and 6 deletions

2
.vscode/launch.json vendored
View File

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

View File

@@ -0,0 +1,116 @@
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using AyaNova.Models;
using AyaNova.Biz;
namespace AyaNova.DataList
{
internal class PartInventoryOnHandDataList : AyaDataList
{
public PartInventoryOnHandDataList()
{
DefaultListObjectType = AyaType.PartInventory;
SQLFrom = "from vpartinventorynow "
+ "left join apart on (vpartinventorynow.partid=apart.id) "
+ "left join apartwarehouse on (vpartinventorynow.partwarehouseid=apartwarehouse.id) ";
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();
dynamic cm = null;
cm = new JObject();
cm.fld = "PartPartNumber";
cm.sort = "+";
dlistView.Add(cm);
cm = new JObject();
cm.fld = "PartWarehouseName";
cm.sort = "+";
dlistView.Add(cm);
cm = new JObject();
cm.fld = "PartInventoryBalance";
dlistView.Add(cm);
cm = new JObject();
cm.fld = "PartInventoryTransactionDescription";
dlistView.Add(cm);
DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined table need to be specified completely
FieldDefinitions = new List<AyaDataListFieldDefinition>();
// FieldDefinitions.Add(new AyaDataListFieldDefinition
// {
// TKey = "PartInventoryTransactionSource",
// FieldKey = "PartInventoryTransactionSource",
// UiFieldDataType = (int)UiFieldDataType.Text,
// SqlIdColumnName = "vpartinventorynow.sourceid",
// SqlValueColumnName = "AYGETNAME(vpartinventorynow.sourceid, vpartinventorynow.sourcetype)",
// SqlAyTypeColumnName = "vpartinventorynow.sourcetype"
// });
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "PartPartNumber",
FieldKey = "PartPartNumber",
AyaObjectType = (int)AyaType.Part,
UiFieldDataType = (int)UiFieldDataType.Text,
SqlIdColumnName = "apart.id",
SqlValueColumnName = "apart.partnumber"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "PartWarehouseName",
FieldKey = "PartWarehouseName",
AyaObjectType = (int)AyaType.PartWarehouse,
UiFieldDataType = (int)UiFieldDataType.Text,
SqlIdColumnName = "apartwarehouse.id",
SqlValueColumnName = "apartwarehouse.name"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "PartInventoryTransactionDescription",
FieldKey = "PartInventoryTransactionDescription",
AyaObjectType = (int)AyaType.PartInventory,
UiFieldDataType = (int)UiFieldDataType.Text,
SqlIdColumnName = "vpartinventorynow.id",
SqlValueColumnName = "vpartinventorynow.description",
IsRowId = true//should open to eventlog since no edit
});
// FieldDefinitions.Add(new AyaDataListFieldDefinition
// {
// TKey = "PartInventoryTransactionEntryDate",
// FieldKey = "PartInventoryTransactionEntryDate",
// UiFieldDataType = (int)UiFieldDataType.DateTime,
// SqlValueColumnName = "vpartinventorynow.entrydate"
// });
// FieldDefinitions.Add(new AyaDataListFieldDefinition
// {
// TKey = "PartInventoryTransactionQuantity",
// FieldKey = "PartInventoryTransactionQuantity",
// UiFieldDataType = (int)UiFieldDataType.Decimal,
// SqlValueColumnName = "vpartinventorynow.quantity"
// });
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "PartInventoryBalance",
FieldKey = "PartInventoryBalance",
UiFieldDataType = (int)UiFieldDataType.Decimal,
SqlValueColumnName = "vpartinventorynow.balance"
});
}
}//eoc
}//eons

View File

@@ -49,13 +49,15 @@ namespace AyaNova.Biz
return new LoanUnitBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
case AyaType.Part:
return new PartBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
case AyaType.PartWarehouse:
case AyaType.PartWarehouse:
return new PartWarehouseBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
case AyaType.PartAssembly:
return new PartAssemblyBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
case AyaType.PartInventory:
return new PartInventoryBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
case AyaType.PM:
return new PMBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
case AyaType.PMTemplate:
return new PMTemplateBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);

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 = 687;
internal const long EXPECTED_COLUMN_COUNT = 699;
internal const long EXPECTED_INDEX_COUNT = 122;
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
@@ -149,7 +149,7 @@ namespace AyaNova.Util
log = logger;
//Check if ayschemaversion table exists
BOOL aySchemaVersionExists = false;
bool aySchemaVersionExists = false;
using (var command = ct.Database.GetDbConnection().CreateCommand())
{
@@ -701,7 +701,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
" )");
//PART INVENTORY VIEW
await ExecQueryAsync("");
await ExecQueryAsync("CREATE VIEW vpartinventorynow AS WITH T AS (SELECT *, ROW_NUMBER() OVER(PARTITION BY partid, partwarehouseid ORDER BY entrydate DESC) AS rn FROM apartinventory) SELECT * FROM T WHERE rn = 1");
//MIGRATE_OUTSTANDING: index(s) to support inventory ops
//recheck this again once have full inventory in place and run some manual queries taken from inventory methods and issued by ef core