From 765b98a567fea597975cfb1d94854055186140ae Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 21 Jan 2021 17:50:16 +0000 Subject: [PATCH] --- .../AyaNova/DataList/PartInventoryDataList.cs | 180 ++++++++++++++++++ server/AyaNova/biz/PartInventoryBiz.cs | 2 +- server/AyaNova/resource/de.json | 9 +- server/AyaNova/resource/en.json | 10 +- server/AyaNova/resource/es.json | 9 +- server/AyaNova/resource/fr.json | 9 +- 6 files changed, 214 insertions(+), 5 deletions(-) create mode 100644 server/AyaNova/DataList/PartInventoryDataList.cs diff --git a/server/AyaNova/DataList/PartInventoryDataList.cs b/server/AyaNova/DataList/PartInventoryDataList.cs new file mode 100644 index 00000000..4e6dbed3 --- /dev/null +++ b/server/AyaNova/DataList/PartInventoryDataList.cs @@ -0,0 +1,180 @@ +using System.Collections.Generic; +using Newtonsoft.Json.Linq; +using AyaNova.Models; +using AyaNova.Biz; +namespace AyaNova.DataList +{ + internal class PartInventoryDataList : AyaDataList + { + public PartInventoryDataList() + { + + DefaultListObjectType = AyaType.PartInventory; + SQLFrom = "from apartinventory"; + var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; + + + //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############ + //Default ListView + dynamic dlistView = new JArray(); + dynamic cm = null; + + cm = new JObject(); + cm.fld = "PartInventoryCreated"; + cm.sort = "-"; + dlistView.Add(cm); + + cm = new JObject(); + cm.fld = "Object"; + dlistView.Add(cm); + + cm = new JObject(); + cm.fld = "PartInventoryCurrency"; + dlistView.Add(cm); + + cm = new JObject(); + cm.fld = "PartInventoryCurrencyBalance"; + 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"; + 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(); + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "PartInventorySourceRootObjectType", + FieldKey = "PartInventorySourceRootObjectType", + UiFieldDataType = (int)UiFieldDataType.Text, + SqlIdColumnName = "apartinventory.sourceid", + SqlValueColumnName = "AYGETNAME(apartinventory.sourceid, apartinventory.sourcetype)", + SqlAyTypeColumnName = "apartinventory.sourcetype" + }); + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "Object", + FieldKey = "Object", + UiFieldDataType = (int)UiFieldDataType.Text, + SqlIdColumnName = "apartinventory.objectid", + SqlValueColumnName = "AYGETNAME(apartinventory.objectid, apartinventory.objecttype)", + SqlAyTypeColumnName = "apartinventory.objecttype" + }); + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "AyaType", + FieldKey = "AyaType", + UiFieldDataType = (int)UiFieldDataType.Enum, + EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(AyaType).ToString()), + SqlValueColumnName = "apartinventory.objecttype" + }); + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "PartInventoryDescription", + FieldKey = "PartInventoryDescription", + AyaObjectType = (int)AyaType.PartInventory, + UiFieldDataType = (int)UiFieldDataType.Text, + SqlIdColumnName = "apartinventory.id", + SqlValueColumnName = "apartinventory.name", + IsRowId = true + }); + + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "PartInventoryCreated", + FieldKey = "PartInventoryCreated", + 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", + UiFieldDataType = (int)UiFieldDataType.Decimal, + SqlValueColumnName = "apartinventory.incidents" + }); + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "PartInventoryIncidentsBalance", + FieldKey = "PartInventoryIncidentsBalance", + 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 + }); + + } + + + + + + + + }//eoc +}//eons \ No newline at end of file diff --git a/server/AyaNova/biz/PartInventoryBiz.cs b/server/AyaNova/biz/PartInventoryBiz.cs index d24aa83a..b340cea9 100644 --- a/server/AyaNova/biz/PartInventoryBiz.cs +++ b/server/AyaNova/biz/PartInventoryBiz.cs @@ -45,7 +45,7 @@ namespace AyaNova.Biz { using (var transaction = await ct.Database.BeginTransactionAsync()) { - //get the last record if exists (may not if opening balance) + //get the last record if exists (will not if opening balance) var LastEntry = await ct.PartInventory.OrderByDescending(m => m.EntryDate).FirstOrDefaultAsync(m => m.PartId == newDtObject.PartId && m.PartWarehouseId == newDtObject.PartWarehouseId); PartInventory newObject = new PartInventory(); newObject.Description = newDtObject.Description; diff --git a/server/AyaNova/resource/de.json b/server/AyaNova/resource/de.json index 2b7362f7..ffc8ea6b 100644 --- a/server/AyaNova/resource/de.json +++ b/server/AyaNova/resource/de.json @@ -2133,5 +2133,12 @@ "TaxCodeCustom13": "Angepasstes Feld 13", "TaxCodeCustom14": "Angepasstes Feld 14", "TaxCodeCustom15": "Angepasstes Feld 15", - "TaxCodeCustom16": "Angepasstes Feld 16" + "TaxCodeCustom16": "Angepasstes Feld 16", + "PartInventoryList":"Teileinventar", + "PartInventoryTransaction":"Inventartransaktion", + "PartInventoryTransactionDescription":"Beschreibung", + "PartInventoryTransactionEntryDate":"Datum", + "PartInventoryTransactionSource":"Transaktionsquelle", + "PartInventoryTransactionQuantity":"Menge", + "PartInventoryBalance":"Menge zur Hand" } \ No newline at end of file diff --git a/server/AyaNova/resource/en.json b/server/AyaNova/resource/en.json index 558b1a41..da3b6d90 100644 --- a/server/AyaNova/resource/en.json +++ b/server/AyaNova/resource/en.json @@ -2133,5 +2133,13 @@ "TaxCodeCustom13": "Custom13", "TaxCodeCustom14": "Custom14", "TaxCodeCustom15": "Custom15", - "TaxCodeCustom16": "Custom16" + "TaxCodeCustom16": "Custom16", + "PartInventoryList":"Part inventory", + "PartInventoryTransaction":"Inventory transaction", + "PartInventoryTransactionDescription":"Description", + "PartInventoryTransactionEntryDate":"Date", + "PartInventoryTransactionSource":"Transaction source", + "PartInventoryTransactionQuantity":"Quantity", + "PartInventoryBalance":"On hand quantity" + } \ No newline at end of file diff --git a/server/AyaNova/resource/es.json b/server/AyaNova/resource/es.json index 7690a56d..5c5cc8fc 100644 --- a/server/AyaNova/resource/es.json +++ b/server/AyaNova/resource/es.json @@ -2133,5 +2133,12 @@ "TaxCodeCustom13": "Campo personalizado 13", "TaxCodeCustom14": "Campo personalizado 14", "TaxCodeCustom15": "Campo personalizado 15", - "TaxCodeCustom16": "Campo personalizado 16" + "TaxCodeCustom16": "Campo personalizado 16", + "PartInventoryList":"Inventario de piezas", + "PartInventoryTransaction":"Transacción de inventario", + "PartInventoryTransactionDescription":"Descripción", + "PartInventoryTransactionEntryDate":"Fecha", + "PartInventoryTransactionSource":"Origen de la transacción", + "PartInventoryTransactionQuantity":"Cantidad", + "PartInventoryBalance":"Cantidad en mano" } \ No newline at end of file diff --git a/server/AyaNova/resource/fr.json b/server/AyaNova/resource/fr.json index 8261cdfa..b958db59 100644 --- a/server/AyaNova/resource/fr.json +++ b/server/AyaNova/resource/fr.json @@ -2133,5 +2133,12 @@ "TaxCodeCustom13": "Champ personnalisé 13", "TaxCodeCustom14": "Champ personnalisé 14", "TaxCodeCustom15": "Champ personnalisé 15", - "TaxCodeCustom16": "Champ personnalisé 16" + "TaxCodeCustom16": "Champ personnalisé 16", + "PartInventoryList":"Inventaire des pièces", + "PartInventoryTransaction":"Transaction d'inventaire", + "PartInventoryTransactionDescription":"La description", + "PartInventoryTransactionEntryDate":"Date", + "PartInventoryTransactionSource":"Source de transaction", + "PartInventoryTransactionQuantity":"Quantité", + "PartInventoryBalance":"Quantité disponible" } \ No newline at end of file