This commit is contained in:
2021-01-21 17:50:16 +00:00
parent 9a2defe9c5
commit 765b98a567
6 changed files with 214 additions and 5 deletions

View File

@@ -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<AyaDataListFieldDefinition>();
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

View File

@@ -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;

View File

@@ -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"
}

View File

@@ -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"
}

View File

@@ -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"
}

View File

@@ -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"
}