diff --git a/server/AyaNova/DataList/PartInventoryDataList.cs b/server/AyaNova/DataList/PartInventoryDataList.cs index 4e6dbed3..d00dee81 100644 --- a/server/AyaNova/DataList/PartInventoryDataList.cs +++ b/server/AyaNova/DataList/PartInventoryDataList.cs @@ -10,10 +10,32 @@ namespace AyaNova.DataList { DefaultListObjectType = AyaType.PartInventory; - SQLFrom = "from apartinventory"; + SQLFrom = "from apartinventory " + + "left join apart on (apartinventory.apartid=apart.id) " + + "left join apartwarehouse on (apartinventory.apartwarehouseid=apartwarehouse.id) "; var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; + /* + + "PartInventoryList":"Part inventory", + "PartInventoryTransaction":"Inventory transaction", + "PartInventoryTransactionDescription":"Description", + "PartInventoryTransactionEntryDate":"Date", + "PartInventoryTransactionSource":"Transaction source", + "PartInventoryTransactionQuantity":"Quantity", + "PartInventoryBalance":"On hand quantity" + + await ExecQueryAsync("CREATE TABLE apartinventory (id BIGINT GENERATED ALWAYS AS + IDENTITY PRIMARY KEY, + description text null, " + + "entrydate timestamp not null, lastentrydate timestamp null, + partid bigint not null references apart, + partwarehouseid bigint not null references apartwarehouse, " + + "sourcetype integer not null, sourceid bigint not null, " + + "quantity decimal(19,4) not null, balance decimal(19,4) not null, + lastbalance decimal(19,4) null, " + + */ //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############ //Default ListView @@ -21,40 +43,27 @@ namespace AyaNova.DataList dynamic cm = null; cm = new JObject(); - cm.fld = "PartInventoryCreated"; + cm.fld = "PartInventoryTransactionEntryDate"; cm.sort = "-"; dlistView.Add(cm); + //part + //warehouse + cm = new JObject(); - cm.fld = "Object"; + cm.fld = "PartInventoryTransactionQuantity"; dlistView.Add(cm); cm = new JObject(); - cm.fld = "PartInventoryCurrency"; + cm.fld = "PartInventoryTransactionDescription"; dlistView.Add(cm); cm = new JObject(); - cm.fld = "PartInventoryCurrencyBalance"; + cm.fld = "PartInventoryTransactionSource"; dlistView.Add(cm); cm = new JObject(); - cm.fld = "PartInventoryIncidents"; - dlistView.Add(cm); - - cm = new JObject(); - cm.fld = "PartInventoryIncidentsBalance"; - dlistView.Add(cm); - - cm = new JObject(); - cm.fld = "PartInventoryHours"; - dlistView.Add(cm); - - cm = new JObject(); - cm.fld = "PartInventoryHoursBalance"; - dlistView.Add(cm); - - cm = new JObject(); - cm.fld = "PartInventoryDescription"; + cm.fld = "PartInventoryBalance"; dlistView.Add(cm); DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None); @@ -64,8 +73,8 @@ namespace AyaNova.DataList FieldDefinitions.Add(new AyaDataListFieldDefinition { - TKey = "PartInventorySourceRootObjectType", - FieldKey = "PartInventorySourceRootObjectType", + TKey = "PartInventoryTransactionSource", + FieldKey = "PartInventoryTransactionSource", UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "apartinventory.sourceid", SqlValueColumnName = "AYGETNAME(apartinventory.sourceid, apartinventory.sourcetype)", @@ -74,107 +83,62 @@ namespace AyaNova.DataList FieldDefinitions.Add(new AyaDataListFieldDefinition { - TKey = "Object", - FieldKey = "Object", + TKey = "PartPartNumber", + FieldKey = "PartPartNumber", + AyaObjectType = (int)AyaType.Part, UiFieldDataType = (int)UiFieldDataType.Text, - SqlIdColumnName = "apartinventory.objectid", - SqlValueColumnName = "AYGETNAME(apartinventory.objectid, apartinventory.objecttype)", - SqlAyTypeColumnName = "apartinventory.objecttype" + SqlIdColumnName = "apart.id", + SqlValueColumnName = "apart.partnumber" }); FieldDefinitions.Add(new AyaDataListFieldDefinition { - TKey = "AyaType", - FieldKey = "AyaType", - UiFieldDataType = (int)UiFieldDataType.Enum, - EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(AyaType).ToString()), - SqlValueColumnName = "apartinventory.objecttype" + TKey = "PartWarehouseName", + FieldKey = "PartWarehouseName", + AyaObjectType = (int)AyaType.PartWarehouse, + UiFieldDataType = (int)UiFieldDataType.Text, + SqlIdColumnName = "apartwarehouse.id", + SqlValueColumnName = "apartwarehouse.name" }); FieldDefinitions.Add(new AyaDataListFieldDefinition { - TKey = "PartInventoryDescription", - FieldKey = "PartInventoryDescription", + TKey = "PartInventoryTransactionDescription", + FieldKey = "PartInventoryTransactionDescription", AyaObjectType = (int)AyaType.PartInventory, UiFieldDataType = (int)UiFieldDataType.Text, SqlIdColumnName = "apartinventory.id", - SqlValueColumnName = "apartinventory.name", - IsRowId = true + SqlValueColumnName = "apartinventory.description", + IsRowId = true//should open to eventlog since no edit }); FieldDefinitions.Add(new AyaDataListFieldDefinition { - TKey = "PartInventoryCreated", - FieldKey = "PartInventoryCreated", + TKey = "PartInventoryTransactionEntryDate", + FieldKey = "PartInventoryTransactionEntryDate", UiFieldDataType = (int)UiFieldDataType.DateTime, SqlValueColumnName = "apartinventory.entrydate" }); FieldDefinitions.Add(new AyaDataListFieldDefinition { - TKey = "PartInventoryCurrency", - FieldKey = "PartInventoryCurrency", - UiFieldDataType = (int)UiFieldDataType.Currency, - SqlValueColumnName = "apartinventory.currency" - }); - - FieldDefinitions.Add(new AyaDataListFieldDefinition - { - TKey = "PartInventoryCurrencyBalance", - FieldKey = "PartInventoryCurrencyBalance", - UiFieldDataType = (int)UiFieldDataType.Currency, - SqlValueColumnName = "apartinventory.currencybalance" - }); - - FieldDefinitions.Add(new AyaDataListFieldDefinition - { - TKey = "PartInventoryIncidents", - FieldKey = "PartInventoryIncidents", + TKey = "PartInventoryTransactionQuantity", + FieldKey = "PartInventoryTransactionQuantity", UiFieldDataType = (int)UiFieldDataType.Decimal, - SqlValueColumnName = "apartinventory.incidents" + SqlValueColumnName = "apartinventory.quantity" }); FieldDefinitions.Add(new AyaDataListFieldDefinition { - TKey = "PartInventoryIncidentsBalance", - FieldKey = "PartInventoryIncidentsBalance", + TKey = "PartInventoryBalance", + FieldKey = "PartInventoryBalance", UiFieldDataType = (int)UiFieldDataType.Decimal, - SqlValueColumnName = "apartinventory.incidentsbalance" - }); - - FieldDefinitions.Add(new AyaDataListFieldDefinition - { - TKey = "PartInventoryHours", - FieldKey = "PartInventoryHours", - UiFieldDataType = (int)UiFieldDataType.Decimal, - SqlValueColumnName = "apartinventory.hours" - }); - - FieldDefinitions.Add(new AyaDataListFieldDefinition - { - TKey = "PartInventoryHoursBalance", - FieldKey = "PartInventoryHoursBalance", - UiFieldDataType = (int)UiFieldDataType.Decimal, - SqlValueColumnName = "apartinventory.hoursbalance" - }); - - //META object id column - FieldDefinitions.Add(new AyaDataListFieldDefinition - { - FieldKey = "metapartinventoryobjectid", - SqlIdColumnName = "apartinventory.objectid", - SqlValueColumnName = "apartinventory.objectid", - IsMeta = true + SqlValueColumnName = "apartinventory.balance" }); } - - - - - }//eoc }//eons \ No newline at end of file