diff --git a/EgwCoreLib.Lux.Core/EgwCoreLib.Lux.Core.csproj b/EgwCoreLib.Lux.Core/EgwCoreLib.Lux.Core.csproj index 59a004c1..cf161881 100644 --- a/EgwCoreLib.Lux.Core/EgwCoreLib.Lux.Core.csproj +++ b/EgwCoreLib.Lux.Core/EgwCoreLib.Lux.Core.csproj @@ -21,6 +21,8 @@ - + + + diff --git a/EgwCoreLib.Lux.Core/ParamDict.cs b/EgwCoreLib.Lux.Core/ParamDict.cs new file mode 100644 index 00000000..05b6fad2 --- /dev/null +++ b/EgwCoreLib.Lux.Core/ParamDict.cs @@ -0,0 +1,89 @@ +using Newtonsoft.Json; + +namespace EgwCoreLib.Lux.Core +{ + /// + /// Generico dizionario parametri con funzione ricerca valore (SE presente) + /// + public class ParamDict + { + #region Public Constructors + + /// + /// init classe dal valore serializzato del dizionario + /// + /// + public ParamDict(string rawVal) + { + DictVals = JsonConvert.DeserializeObject>(rawVal) ?? new Dictionary(); + } + + /// + /// init classe da dizionario + /// + /// + public ParamDict(Dictionary newDict) + { + DictVals = newDict; + } + + #endregion Public Constructors + + #region Public Properties + + /// + /// Versione serializzata del dizionario + /// + public string Serialized + { + get => JsonConvert.SerializeObject(DictVals); + } + + #endregion Public Properties + + #region Public Methods + + /// + /// Ricerca (se disponibile) il valore della chiave richiesta + /// + /// + /// + public string GetVal(string reqKey) + { + string answ = ""; + if (DictVals.ContainsKey(reqKey)) + { + answ = DictVals[reqKey]; + } + return answ; + } + + /// + /// Imposta valore (aggiungendo se mancasse) + /// + /// + /// + public void SetVal(string Key, string Val) + { + if (DictVals.ContainsKey(Key)) + { + DictVals[Key] = Val; + } + else + { + DictVals.Add(Key, Val); + } + } + + #endregion Public Methods + + #region Private Properties + + /// + /// Dizionario interno valori + /// + private Dictionary DictVals { get; set; } = new Dictionary(); + + #endregion Private Properties + } +} \ No newline at end of file diff --git a/EgwCoreLib.Lux.Data/AdminContext.cs b/EgwCoreLib.Lux.Data/AdminContext.cs index 275d7b2e..e78ef64f 100644 --- a/EgwCoreLib.Lux.Data/AdminContext.cs +++ b/EgwCoreLib.Lux.Data/AdminContext.cs @@ -1,4 +1,4 @@ -using EgwCoreLib.Lux.Data.DbModel; +using EgwCoreLib.Lux.Data.Data.DbModel.Admin; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using System; diff --git a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs index 89182996..ef5f0a93 100644 --- a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs +++ b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs @@ -1,34 +1,353 @@ using EgwCoreLib.Lux.Core.RestPayload; -using EgwCoreLib.Lux.Data.DbModel; +using EgwCoreLib.Lux.Data.DbModel.Config; +using EgwCoreLib.Lux.Data.DbModel.Items; +using EgwCoreLib.Lux.Data.DbModel.Sales; +using EgwCoreLib.Lux.Data.DbModel.Utils; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Newtonsoft.Json; using NLog; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Cryptography; -using System.Text; -using System.Threading.Tasks; using static EgwCoreLib.Lux.Core.Enums; -using static System.Runtime.InteropServices.JavaScript.JSType; namespace EgwCoreLib.Lux.Data.Controllers { - public class LuxController + internal class LuxController { // manca costruttore parametrico contoller... - #region Public Methods + #region Internal Methods + + internal async Task> ConfEnvirParamGetAllAsync() + { + List dbResult = new List(); + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + dbResult = await dbCtx + .DbSetEnvirPar + .ToListAsync(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante ConfEnvirParamGetAllAsync{Environment.NewLine}{exc}"); + } + } + return dbResult; + } + + /// + /// Esegue eliminazione + /// + /// + /// + internal async Task ConfGlassDeleteAsync(GlassModel rec2del) + { + bool answ = false; + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + var dbResult = dbCtx + .DbSetConfGlass + .Where(x => x.GlassID == rec2del.GlassID) + .FirstOrDefault(); + + // se trovato --> elimino e sposto i rimanenti... + if (dbResult != null) + { + // elimino + dbCtx.DbSetConfGlass.Remove(dbResult); + // salvo tutto + await dbCtx.SaveChangesAsync(); + } + } + catch (Exception exc) + { + Log.Error($"Eccezione durante ConfGlassDeleteAsync{Environment.NewLine}{exc}"); + } + } + return answ; + } + + /// + /// Elenco completo Config Glass + /// + /// + internal async Task> ConfGlassGetAllAsync() + { + List dbResult = new List(); + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + dbResult = await dbCtx + .DbSetConfGlass + .ToListAsync(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante ConfGlassGetAllAsync{Environment.NewLine}{exc}"); + } + } + return dbResult; + } + + /// + /// Upsert record ConfGlass + /// + /// + /// + internal async Task ConfGlassUpsertAsync(GlassModel upsRec) + { + bool answ = false; + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + var currRec = dbCtx + .DbSetConfGlass + .Where(x => upsRec.GlassID > 0 && x.GlassID == upsRec.GlassID) + .FirstOrDefault(); + // se trovato --> aggiorno + if (currRec != null) + { + currRec.Code = string.IsNullOrEmpty(upsRec.Code) ? $"{upsRec.GlassID:0000}" : upsRec.Code; + currRec.Description = upsRec.Description; + currRec.Thickness = upsRec.Thickness; + dbCtx.Entry(currRec).State = EntityState.Modified; + } + // se mancasse --> aggiungo + else + { + dbCtx.DbSetConfGlass.Add(upsRec); + } + // salvo... + int numAct = await dbCtx.SaveChangesAsync(); + answ = numAct > 0; + } + catch (Exception exc) + { + Log.Error($"Eccezione durante ConfGlassUpsertAsync{Environment.NewLine}{exc}"); + } + } + return answ; + } + + /// + /// Esegue eliminazione + /// + /// + /// + internal async Task ConfProfileDeleteAsync(ProfileModel rec2del) + { + bool answ = false; + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + var dbResult = dbCtx + .DbSetConfProfile + .Where(x => x.ProfileID == rec2del.ProfileID) + .FirstOrDefault(); + + // se trovato --> elimino e sposto i rimanenti... + if (dbResult != null) + { + // elimino + dbCtx.DbSetConfProfile.Remove(dbResult); + // salvo tutto + await dbCtx.SaveChangesAsync(); + } + } + catch (Exception exc) + { + Log.Error($"Eccezione durante ConfProfileDeleteAsync{Environment.NewLine}{exc}"); + } + } + return answ; + } + + /// + /// Elenco completo Config Profile + /// + /// + internal async Task> ConfProfileGetAllAsync() + { + List dbResult = new List(); + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + dbResult = await dbCtx + .DbSetConfProfile + .ToListAsync(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante ConfProfileGetAllAsync{Environment.NewLine}{exc}"); + } + } + return dbResult; + } + + /// + /// Upsert record ConfProfile + /// + /// + /// + internal async Task ConfProfileUpsertAsync(ProfileModel upsRec) + { + bool answ = false; + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + var currRec = dbCtx + .DbSetConfProfile + .Where(x => upsRec.ProfileID > 0 && x.ProfileID == upsRec.ProfileID) + .FirstOrDefault(); + // se trovato --> aggiorno + if (currRec != null) + { + currRec.Code = string.IsNullOrEmpty(upsRec.Code) ? $"{upsRec.ProfileID:0000}" : upsRec.Code; + currRec.Description = upsRec.Description; + currRec.Thickness = upsRec.Thickness; + dbCtx.Entry(currRec).State = EntityState.Modified; + } + // se mancasse --> aggiungo + else + { + dbCtx.DbSetConfProfile.Add(upsRec); + } + // salvo... + int numAct = await dbCtx.SaveChangesAsync(); + answ = numAct > 0; + } + catch (Exception exc) + { + Log.Error($"Eccezione durante ConfProfileUpsertAsync{Environment.NewLine}{exc}"); + } + } + return answ; + } + + /// + /// Esegue eliminazione + /// + /// + /// + internal async Task ConfWoodDeleteAsync(WoodModel rec2del) + { + bool answ = false; + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + var dbResult = dbCtx + .DbSetConfWood + .Where(x => x.WoodID == rec2del.WoodID) + .FirstOrDefault(); + + // se trovato --> elimino e sposto i rimanenti... + if (dbResult != null) + { + // elimino + dbCtx.DbSetConfWood.Remove(dbResult); + // salvo tutto + await dbCtx.SaveChangesAsync(); + } + } + catch (Exception exc) + { + Log.Error($"Eccezione durante ConfWoodDeleteAsync{Environment.NewLine}{exc}"); + } + } + return answ; + } + + /// + /// Elenco completo Config Wood + /// + /// + internal async Task> ConfWoodGetAllAsync() + { + List dbResult = new List(); + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + dbResult = await dbCtx + .DbSetConfWood + .ToListAsync(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante ConfWoodGetAllAsync{Environment.NewLine}{exc}"); + } + } + return dbResult; + } + + /// + /// Upsert record ConfWood + /// + /// + /// + internal async Task ConfWoodUpsertAsync(WoodModel upsRec) + { + bool answ = false; + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + var currRec = dbCtx + .DbSetConfWood + .Where(x => upsRec.WoodID > 0 && x.WoodID == upsRec.WoodID) + .FirstOrDefault(); + // se trovato --> aggiorno + if (currRec != null) + { + currRec.Code = string.IsNullOrEmpty(upsRec.Code) ? $"{upsRec.WoodID:0000}" : upsRec.Code; + currRec.Description = upsRec.Description; + currRec.Type = upsRec.Type; + dbCtx.Entry(currRec).State = EntityState.Modified; + } + // se mancasse --> aggiungo + else + { + dbCtx.DbSetConfWood.Add(upsRec); + } + // salvo... + int numAct = await dbCtx.SaveChangesAsync(); + answ = numAct > 0; + } + catch (Exception exc) + { + Log.Error($"Eccezione durante ConfWoodUpsertAsync{Environment.NewLine}{exc}"); + } + } + return answ; + } /// /// Elenco completo Customers da DB /// /// - public List CustomersGetAll() + internal List CustomersGetAll() { List dbResult = new List(); - //using (DataLayerContext dbCtx = new DataLayerContext(configuration)) + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) using (DataLayerContext dbCtx = new DataLayerContext()) { try @@ -49,10 +368,10 @@ namespace EgwCoreLib.Lux.Data.Controllers /// Elenco completo Dealers da DB /// /// - public List DealersGetAll() + internal List DealersGetAll() { List dbResult = new List(); - //using (DataLayerContext dbCtx = new DataLayerContext(configuration)) + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) using (DataLayerContext dbCtx = new DataLayerContext()) { try @@ -69,15 +388,296 @@ namespace EgwCoreLib.Lux.Data.Controllers return dbResult; } + /// + /// Esegue eliminazione + /// + /// + /// + internal async Task GenClassDeleteAsync(GenClassModel rec2del) + { + bool answ = false; + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + var dbResult = dbCtx + .DbSetGenClass + .Where(x => x.ClassCod == rec2del.ClassCod) + .FirstOrDefault(); + + var numChild = dbCtx + .DbSetGenVal + .Count(x => x.ClassCod == rec2del.ClassCod); + // se trovato e NON HA record child --> elimino + if (dbResult != null && numChild == 0) + { + dbCtx.DbSetGenClass.Remove(dbResult); + await dbCtx.SaveChangesAsync(); + } + } + catch (Exception exc) + { + Log.Error($"Eccezione durante GenClassDeleteAsync{Environment.NewLine}{exc}"); + } + } + return answ; + } + + /// + /// Elenco completo GenClass + /// + /// + internal async Task> GenClassGetAllAsync() + { + List dbResult = new List(); + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + dbResult = await dbCtx + .DbSetGenClass + .Include(o => o.GenValNav) + .ToListAsync(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante GenClassGetAllAsync{Environment.NewLine}{exc}"); + } + } + return dbResult; + } + + /// + /// Upsert record GenClass + /// + /// + /// + internal async Task GenClassUpsertAsync(GenClassModel upsRec) + { + bool answ = false; + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + var currRec = dbCtx + .DbSetGenClass + .Where(x => x.ClassCod == upsRec.ClassCod) + .FirstOrDefault(); + // se trovato --> aggiorno + if (currRec != null) + { + currRec.Description = upsRec.Description; + dbCtx.Entry(currRec).State = EntityState.Modified; + } + // se mancasse --> aggiungo + else + { + dbCtx.DbSetGenClass.Add(upsRec); + } + // salvo... + int numAct = await dbCtx.SaveChangesAsync(); + answ = numAct > 0; + } + catch (Exception exc) + { + Log.Error($"Eccezione durante GenClassUpsertAsync{Environment.NewLine}{exc}"); + } + } + return answ; + } + + /// + /// Esegue eliminazione + /// + /// + /// + internal async Task GenValDeleteAsync(GenValueModel rec2del) + { + bool answ = false; + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + var dbResult = dbCtx + .DbSetGenVal + .Where(x => x.GenValID == rec2del.GenValID) + .FirstOrDefault(); + + // se trovato --> elimino e sposto i rimanenti... + if (dbResult != null) + { + // modifico record successivi... + var list2Move = dbCtx + .DbSetGenVal + .Where(x => x.ClassCod == rec2del.ClassCod && x.Ordinal > dbResult.Ordinal) + .ToList(); + foreach (var item in list2Move) + { + item.Ordinal--; + dbCtx.Entry(item).State = EntityState.Modified; + } + // elimino + dbCtx.DbSetGenVal.Remove(dbResult); + // salvo tutto + await dbCtx.SaveChangesAsync(); + } + } + catch (Exception exc) + { + Log.Error($"Eccezione durante GenValDeleteAsync{Environment.NewLine}{exc}"); + } + } + return answ; + } + + /// + /// Elenco valori x classe richiesta + /// + /// + /// + internal async Task> GenValGetFiltAsync(string codClass) + { + List dbResult = new List(); + if (!string.IsNullOrEmpty(codClass)) + { + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + dbResult = await dbCtx + .DbSetGenVal + .Where(x => x.ClassCod == codClass) + .ToListAsync(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante GenValGetFiltAsync{Environment.NewLine}{exc}"); + } + } + } + return dbResult; + } + + /// + /// Esegue spostamento nell'ordinamento relativo alla classe + /// NB: verifica spostamento sia ammissibile: se primo rec non "sale", se ultimo non "scende"... + /// + /// + /// + /// + internal async Task GenValMoveAsync(GenValueModel selRec, bool moveUp) + { + bool answ = false; + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + var currRec = dbCtx + .DbSetGenVal + .Where(x => x.GenValID == selRec.GenValID) + .FirstOrDefault(); + + if (currRec != null) + { + // recupero info del num rec del suo gruppo + int numRec = dbCtx + .DbSetGenVal + .Count(x => x.ClassCod == selRec.ClassCod); + + // verifico NON sia primo/ultimo... + bool canMove = false; + int newPos = moveUp ? currRec.Ordinal - 1 : currRec.Ordinal + 1; + if (moveUp) + { + canMove = newPos > 0; + } + else + { + canMove = newPos <= numRec; + } + // se abilitato --> aggiorno i 2 record... + if (canMove) + { + var otherRec = dbCtx + .DbSetGenVal + .Where(x => x.ClassCod == selRec.ClassCod && x.Ordinal == newPos) + .FirstOrDefault(); + if (otherRec != null) + { + otherRec.Ordinal = currRec.Ordinal; + dbCtx.Entry(otherRec).State = EntityState.Modified; + currRec.Ordinal = newPos; + dbCtx.Entry(currRec).State = EntityState.Modified; + } + // salvo... + int numAct = await dbCtx.SaveChangesAsync(); + answ = numAct > 0; + } + } + } + catch (Exception exc) + { + Log.Error($"Eccezione durante GenValMoveAsync{Environment.NewLine}{exc}"); + } + } + return answ; + } + + /// + /// Esegue Upsert del record ricevuto + /// + /// + /// + internal async Task GenValUpsertAsync(GenValueModel upsRec) + { + bool answ = false; + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + var currRec = dbCtx + .DbSetGenVal + .Where(x => x.GenValID == upsRec.GenValID) + .FirstOrDefault(); + // se trovato --> aggiorno + if (currRec != null) + { + currRec.ValString = upsRec.ValString; + dbCtx.Entry(currRec).State = EntityState.Modified; + } + // se mancasse --> aggiungo + else + { + dbCtx.DbSetGenVal.Add(upsRec); + } + // salvo... + int numAct = await dbCtx.SaveChangesAsync(); + answ = numAct > 0; + } + catch (Exception exc) + { + Log.Error($"Eccezione durante GenValUpsertAsync{Environment.NewLine}{exc}"); + } + } + return answ; + } + /// /// Eliminazione record item /// /// /// - public async Task ItemDeleteAsync(ItemModel rec2del) + internal async Task ItemDeleteAsync(ItemModel rec2del) { bool result = false; - //using (DataLayerContext dbCtx = new DataLayerContext(configuration)) + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) using (DataLayerContext dbCtx = new DataLayerContext()) { try @@ -104,10 +704,10 @@ namespace EgwCoreLib.Lux.Data.Controllers /// Elenco completo Items /// /// - public List ItemGetAll() + internal List ItemGetAll() { List dbResult = new List(); - //using (DataLayerContext dbCtx = new DataLayerContext(configuration)) + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) using (DataLayerContext dbCtx = new DataLayerContext()) { try @@ -130,7 +730,7 @@ namespace EgwCoreLib.Lux.Data.Controllers /// /// ID parent (valido quindi >0) /// - public List ItemGetChild(int ItemIdParent) + internal List ItemGetChild(int ItemIdParent) { List dbResult = new List(); if (ItemIdParent > 0) @@ -160,12 +760,12 @@ namespace EgwCoreLib.Lux.Data.Controllers /// /// ID item corrente (valido quindi >0) /// - public List ItemGetAlt(int ItemId) + internal List ItemGetAlt(int ItemId) { List dbResult = new List(); if (ItemId > 0) { - //using (DataLayerContext dbCtx = new DataLayerContext(configuration)) + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) using (DataLayerContext dbCtx = new DataLayerContext()) { try @@ -211,10 +811,10 @@ namespace EgwCoreLib.Lux.Data.Controllers /// /// /// - public List ItemGetFilt(string CodGroup, ItemClassType ItemType) + internal List ItemGetFilt(string CodGroup, ItemClassType ItemType) { List dbResult = new List(); - //using (DataLayerContext dbCtx = new DataLayerContext(configuration)) + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) using (DataLayerContext dbCtx = new DataLayerContext()) { try @@ -240,10 +840,10 @@ namespace EgwCoreLib.Lux.Data.Controllers /// /// /// - public List ItemGetFilt(string CodGroup, ItemClassType ItemType, string SearchVal) + internal List ItemGetFilt(string CodGroup, ItemClassType ItemType, string SearchVal) { List dbResult = new List(); - //using (DataLayerContext dbCtx = new DataLayerContext(configuration)) + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) using (DataLayerContext dbCtx = new DataLayerContext()) { try @@ -274,10 +874,10 @@ namespace EgwCoreLib.Lux.Data.Controllers /// /// /// - public async Task> ItemGetFiltAsync(string CodGroup, ItemClassType ItemType) + internal async Task> ItemGetFiltAsync(string CodGroup, ItemClassType ItemType) { List dbResult = new List(); - //using (DataLayerContext dbCtx = new DataLayerContext(configuration)) + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) using (DataLayerContext dbCtx = new DataLayerContext()) { try @@ -304,10 +904,10 @@ namespace EgwCoreLib.Lux.Data.Controllers /// /// /// - public async Task> ItemGetFiltAsync(string CodGroup, ItemClassType ItemType, string SearchVal) + internal async Task> ItemGetFiltAsync(string CodGroup, ItemClassType ItemType, string SearchVal) { List dbResult = new List(); - //using (DataLayerContext dbCtx = new DataLayerContext(configuration)) + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) using (DataLayerContext dbCtx = new DataLayerContext()) { try @@ -336,10 +936,10 @@ namespace EgwCoreLib.Lux.Data.Controllers /// /// /// - public List ItemGetSearch(string SearchVal) + internal List ItemGetSearch(string SearchVal) { List dbResult = new List(); - //using (DataLayerContext dbCtx = new DataLayerContext(configuration)) + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) using (DataLayerContext dbCtx = new DataLayerContext()) { try @@ -362,10 +962,10 @@ namespace EgwCoreLib.Lux.Data.Controllers /// /// /// - public async Task> ItemGetSearchAsync(string SearchVal) + internal async Task> ItemGetSearchAsync(string SearchVal) { List dbResult = new List(); - //using (DataLayerContext dbCtx = new DataLayerContext(configuration)) + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) using (DataLayerContext dbCtx = new DataLayerContext()) { try @@ -387,10 +987,10 @@ namespace EgwCoreLib.Lux.Data.Controllers /// Elenco completo ItemGroup gestiti /// /// - public List ItemGroupGetAll() + internal List ItemGroupGetAll() { List dbResult = new List(); - //using (DataLayerContext dbCtx = new DataLayerContext(configuration)) + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) using (DataLayerContext dbCtx = new DataLayerContext()) { try @@ -411,17 +1011,17 @@ namespace EgwCoreLib.Lux.Data.Controllers /// Elenco completo ItemGroup gestiti async /// /// - public async Task> ItemGroupGetAllAsync() + internal async Task> ItemGroupGetAllAsync() { List dbResult = new List(); - //using (DataLayerContext dbCtx = new DataLayerContext(configuration)) + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) using (DataLayerContext dbCtx = new DataLayerContext()) { try { dbResult = await dbCtx - .DbSetItemGroup - .ToListAsync(); + .DbSetItemGroup + .ToListAsync(); } catch (Exception exc) { @@ -431,10 +1031,10 @@ namespace EgwCoreLib.Lux.Data.Controllers return dbResult; } - public bool ItemUpsert(ItemModel newRec) + internal bool ItemUpsert(ItemModel newRec) { bool answ = false; - //using (DataLayerContext dbCtx = new DataLayerContext(configuration)) + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) using (DataLayerContext dbCtx = new DataLayerContext()) { try @@ -476,10 +1076,10 @@ namespace EgwCoreLib.Lux.Data.Controllers /// /// /// - public async Task ItemUpsertAsync(ItemModel currRec) + internal async Task ItemUpsertAsync(ItemModel currRec) { bool result = false; - //using (DataLayerContext dbCtx = new DataLayerContext(configuration)) + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) using (DataLayerContext dbCtx = new DataLayerContext()) { try @@ -523,10 +1123,10 @@ namespace EgwCoreLib.Lux.Data.Controllers /// /// /// - public bool ItemUpsertFromBom(List bomList) + internal bool ItemUpsertFromBom(List bomList) { bool answ = false; - //using (DataLayerContext dbCtx = new DataLayerContext(configuration)) + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) using (DataLayerContext dbCtx = new DataLayerContext()) { try @@ -581,10 +1181,10 @@ namespace EgwCoreLib.Lux.Data.Controllers /// Elenco completo offerte da DB /// /// - public async Task> OfferGetAll() + internal async Task> OfferGetAll() { List dbResult = new List(); - //using (DataLayerContext dbCtx = new DataLayerContext(configuration)) + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) using (DataLayerContext dbCtx = new DataLayerContext()) { try @@ -609,10 +1209,10 @@ namespace EgwCoreLib.Lux.Data.Controllers /// /// /// - public List OfferRowGetByOffer(int OfferID) + internal List OfferRowGetByOffer(int OfferID) { List dbResult = new List(); - //using (DataLayerContext dbCtx = new DataLayerContext(configuration)) + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) using (DataLayerContext dbCtx = new DataLayerContext()) { try @@ -632,16 +1232,114 @@ namespace EgwCoreLib.Lux.Data.Controllers return dbResult; } + /// + /// Elimina riga e sposta eventuali righe successive... + /// + /// + /// + internal async Task OffertRowDelete(OfferRowModel rec2Del) + { + bool answ = false; + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + // recupero offerta... + var currRec = dbCtx + .DbSetOfferRow + .Where(x => x.OfferRowID == rec2Del.OfferRowID) + .FirstOrDefault(); + + // se non trovo aggiungo + if (currRec != null) + { + // recupero indice attuale... + int currRowNum = rec2Del.RowNum; + // cerco righe successive + var list2move = dbCtx + .DbSetOfferRow + .Where(x => x.OfferID == rec2Del.OfferID && x.RowNum > currRowNum) + .ToList(); + // se ci sono aggiorno! + if (list2move != null && list2move.Count > 0) + { + foreach (var item in list2move) + { + item.RowNum--; + dbCtx.Entry(item).State = EntityState.Modified; + } + } + // infine rimuovo riga + dbCtx.DbSetOfferRow.Remove(currRec); + } + + // salvo TUTTI i cambiamenti... + var result = await dbCtx.SaveChangesAsync(); + answ = result > 0; + } + catch (Exception exc) + { + Log.Error($"Eccezione durante OffertRowDelete{Environment.NewLine}{exc}"); + } + } + return answ; + } + + /// + /// Aggiornamento valore UID non calcolato + ritorno elenco UID da aggiornare + /// + /// + /// + internal List OffertRowFixUid(int offertID) + { + List answ = new List(); + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + var currList = dbCtx + .DbSetOfferRow + .Where(x => x.OfferID == offertID) + .ToList(); + // se trovato --> verifico valori differenti, aggiorno e restituisco da calcolare + if (currList != null) + { + var list2fix = currList.Where(x => string.IsNullOrEmpty(x.OfferRowUID) || x.OfferRowUID != x.OfferRowDtx).ToList(); + if (list2fix != null && list2fix.Count > 0) + { + // salvo elenco + answ = list2fix.Select(x => x.OfferRowDtx).ToList(); + // sistemo UID + foreach (var item in list2fix) + { + item.OfferRowUID = item.OfferRowDtx; + dbCtx.Entry(item).State = EntityState.Modified; + } + // salvo... + var result = dbCtx.SaveChanges(); + } + } + } + catch (Exception exc) + { + Log.Error($"Eccezione durante OffertRowFixUid{Environment.NewLine}{exc}"); + } + } + return answ; + } + /// /// Effettua update dei costi di tutte le righe dell'offerta indicata /// /// ID riga offerta da aggiornare /// Bom aggiornata da salvare /// - public async Task OffertRowUpdateBom(int OfferRowID, List newBomList) + internal async Task OffertRowUpdateBom(int OfferRowID, List newBomList) { bool answ = false; - //using (DataLayerContext dbCtx = new DataLayerContext(configuration)) + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) using (DataLayerContext dbCtx = new DataLayerContext()) { try @@ -667,21 +1365,25 @@ namespace EgwCoreLib.Lux.Data.Controllers // calcolo il NUOVO costo e lo aggiorno... double totCost = 0; + double totPrice = 0; int numGroupOk = 0; int numItemOk = 0; int numElems = newBomList.Count; // validazione e completamento BOM - validateBom(itemGroupList, bomGenList, ref newBomList, ref totCost, ref numGroupOk, ref numItemOk); + validateBom(itemGroupList, bomGenList, ref newBomList, null, ref totCost, ref totPrice, ref numGroupOk, ref numItemOk); // salvo BOM... string itemBom = JsonConvert.SerializeObject(newBomList); currRec.ItemBOM = itemBom; - currRec.Cost = totCost; + // salvo arrotondato alla 3° decimale + currRec.BomCost = Math.Round(totCost, 3); + currRec.BomPrice = Math.Round(totPrice, 3); currRec.BomOk = numElems == numGroupOk; currRec.ItemOk = numElems == numItemOk; dbCtx.Entry(currRec).State = EntityState.Modified; } // salvo modifiche... - await dbCtx.SaveChangesAsync(); + var result = await dbCtx.SaveChangesAsync(); + answ = result > 0; } catch (Exception exc) { @@ -691,15 +1393,178 @@ namespace EgwCoreLib.Lux.Data.Controllers return answ; } + /// + /// Aggiorno sul DB i dati del file associato + /// + /// + /// + internal async Task OffertRowUpdateFileData(OfferRowModel updRec) + { + bool answ = false; + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + // recupero righe offerta... + var currRec = dbCtx + .DbSetOfferRow + .Where(x => x.OfferRowID == updRec.OfferRowID) + .FirstOrDefault(); + + // aggiorno parametri (se inviati) + if (currRec != null) + { + currRec.FileName = updRec.FileName; + currRec.FileResource = updRec.FileResource; + currRec.FileSize = updRec.FileSize; + dbCtx.Entry(currRec).State = EntityState.Modified; + } + + // salvo i cambiamenti... + var result = await dbCtx.SaveChangesAsync(); + answ = result > 0; + } + catch (Exception exc) + { + Log.Error($"Eccezione durante OffertRowUpdateFileData{Environment.NewLine}{exc}"); + } + } + return answ; + } + + /// + /// Effettua update serStruct per l'offerta indicata + /// + /// ID singola riga offerta + /// Se non nullo è il nuovo stato await BOM + /// Se non nullo è stato await Price + /// + internal async Task OffertRowUpdateSerStruct(int offerRowID, string serStruct) + { + bool answ = false; + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + // recupero righe offerta... + var currRec = dbCtx + .DbSetOfferRow + .Where(x => x.OfferRowID == offerRowID) + .FirstOrDefault(); + + // aggiorno parametri (se inviati) + if (currRec != null) + { + currRec.SerStruct = serStruct; + dbCtx.Entry(currRec).State = EntityState.Modified; + } + + // salvo i cambiamenti... + var result = await dbCtx.SaveChangesAsync(); + answ = result > 0; + } + catch (Exception exc) + { + Log.Error($"Eccezione durante OffertRowUpdateSerStruct{Environment.NewLine}{exc}"); + } + } + return answ; + } + + /// + /// Upsert record riga offerta + /// + /// + /// + internal async Task OffertRowUpsert(OfferRowModel updRec) + { + bool answ = false; + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + // recupero offerta... + var currRec = dbCtx + .DbSetOfferRow + .Where(x => x.OfferRowID == updRec.OfferRowID) + .FirstOrDefault(); + + // se non trovo aggiungo + if (currRec == null) + { + dbCtx.DbSetOfferRow.Add(updRec); + } + // altrimenti aggiorno + else + { + dbCtx.Entry(currRec).CurrentValues.SetValues(updRec); + } + + // salvo TUTTI i cambiamenti... + var result = await dbCtx.SaveChangesAsync(); + answ = result > 0; + } + catch (Exception exc) + { + Log.Error($"Eccezione durante OffertRowUpsert{Environment.NewLine}{exc}"); + } + } + return answ; + } + + /// + /// Effettua update stato await BOM/PRICE per l'offerta indicata + /// + /// ID singola riga offerta + /// Se non nullo è il nuovo stato await BOM + /// Se non nullo è stato await Price + /// + internal async Task OffertUpdateAwaitState(int offerRowID, bool? awaitBom, bool? awaitPrice) + { + bool answ = false; + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + // recupero righe offerta... + var currRec = dbCtx + .DbSetOfferRow + .Where(x => x.OfferRowID == offerRowID) + .FirstOrDefault(); + + // aggiorno parametri (se inviati) + if (currRec != null) + { + currRec.AwaitBom = awaitBom ?? currRec.AwaitBom; + currRec.AwaitPrice = awaitPrice ?? currRec.AwaitPrice; + dbCtx.Entry(currRec).State = EntityState.Modified; + } + + // salvo i cambiamenti... + var result = await dbCtx.SaveChangesAsync(); + answ = result > 0; + } + catch (Exception exc) + { + Log.Error($"Eccezione durante OffertUpdateAwait{Environment.NewLine}{exc}"); + } + } + return answ; + } + /// /// Effettua update dei costi di tutte le righe dell'offerta indicata /// /// /// - public async Task OffertUpdateCost(int OfferID) + internal async Task OffertUpdateCost(int OfferID) { bool answ = false; - //using (DataLayerContext dbCtx = new DataLayerContext(configuration)) + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) using (DataLayerContext dbCtx = new DataLayerContext()) { try @@ -734,60 +1599,18 @@ namespace EgwCoreLib.Lux.Data.Controllers { // calcolo il NUOVO costo e lo aggiorno... double totCost = 0; + double totPrice = 0; int numGroupOk = 0; int numItemOk = 0; int numElems = bomList.Count; // validazione e completamento BOM - validateBom(itemGroupList, bomGenList, ref bomList, ref totCost, ref numGroupOk, ref numItemOk); -#if false - // ciclo x ogni elemento della BOM, cercando x gruppo e ExtItemCode - foreach (var item in bomList) - { - // verifico item group esistente... - if (itemGroupList.Where(x => x.CodGroup == item.ClassCode).Count() > 0) - { - numGroupOk++; - } - // 2025.09.16: se il prezzo arriva dalla BOM calcolata uso quello... - if (item.Price > 0) - { - // resetto ItemID ma NON il prezzo - item.ItemID = 0; - // conto l'item - numItemOk++; - item.PriceEff = item.Price; - } - else - { - // cerco nella tab in memoria che ho precaricato il costo... cercando x dati di selezione + qtyRange - var recCost = bomGenList - .Where(x => x.CodGroup == item.ClassCode - && x.ExtItemCode == item.ItemCode - && item.Qty >= x.QtyMin - && item.Qty < x.QtyMax) - .OrderByDescending(x => x.Cost) - .FirstOrDefault(); - // se trovato valorizzo! - if (recCost != null) - { - numItemOk++; - item.ItemID = recCost.ItemID; - item.PriceEff = recCost.Cost * (1 + recCost.Margin); - } - else - { - item.ItemID = 0; - item.PriceEff = 0; - } - // ...e aggiorno totale - totCost += item.TotalCost; - } - } -#endif + validateBom(itemGroupList, bomGenList, ref bomList, null, ref totCost, ref totPrice, ref numGroupOk, ref numItemOk); // salvo BOM... string itemBom = JsonConvert.SerializeObject(bomList); currRec.ItemBOM = itemBom; - currRec.Cost = totCost; + // salvo arrotondato alla 3° decimale + currRec.BomCost = Math.Round(totCost, 3); + currRec.BomPrice = Math.Round(totPrice, 3); currRec.BomOk = numElems == numGroupOk; currRec.ItemOk = numElems == numItemOk; dbCtx.Entry(currRec).State = EntityState.Modified; @@ -796,7 +1619,8 @@ namespace EgwCoreLib.Lux.Data.Controllers } // salvo TUTTI i cambiamenti... - await dbCtx.SaveChangesAsync(); + var result = await dbCtx.SaveChangesAsync(); + answ = result > 0; } catch (Exception exc) { @@ -806,15 +1630,57 @@ namespace EgwCoreLib.Lux.Data.Controllers return answ; } + /// + /// Upsert record offerta + /// + /// + /// + internal async Task OffertUpsert(OfferModel updRec) + { + bool answ = false; + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + // recupero offerta... + var currRec = dbCtx + .DbSetOffer + .Where(x => x.OfferID == updRec.OfferID) + .FirstOrDefault(); + + // se non trovo aggiungo + if (currRec == null) + { + dbCtx.DbSetOffer.Add(updRec); + } + // altrimenti aggiorno + else + { + dbCtx.Entry(currRec).CurrentValues.SetValues(updRec); + } + + // salvo TUTTI i cambiamenti... + var result = await dbCtx.SaveChangesAsync(); + answ = result > 0; + } + catch (Exception exc) + { + Log.Error($"Eccezione durante OffertUpsert{Environment.NewLine}{exc}"); + } + } + return answ; + } + /// /// Esegue upsert del record offerta data la BOM ricevuta /// /// /// - public bool OfferUpsertFromBom(string uID, List bomList) + internal bool OfferUpsertFromBom(string uID, List bomList) { bool answ = false; - //using (DataLayerContext dbCtx = new DataLayerContext(configuration)) + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) using (DataLayerContext dbCtx = new DataLayerContext()) { try @@ -834,27 +1700,38 @@ namespace EgwCoreLib.Lux.Data.Controllers // recupero il subset item da BOM... var bomGenList = dbCtx .DbSetItem - .Where(x => x.ItemType == Core.Enums.ItemClassType.Bom) + //.Where(x => x.ItemType == Core.Enums.ItemClassType.Bom) + .Where(x => (x.ItemType == Core.Enums.ItemClassType.Bom || x.ItemType == Core.Enums.ItemClassType.BomAlt)) .ToList(); + // recupero la BOM list precedente + var bomListPrev = JsonConvert.DeserializeObject>(currRec.ItemBOM); + // calcolo il NUOVO costo e lo aggiorno... double totCost = 0; + double totPrice = 0; int numGroupOk = 0; int numItemOk = 0; int numElems = bomList.Count; // validazione e completamento BOM - validateBom(itemGroupList, bomGenList, ref bomList, ref totCost, ref numGroupOk, ref numItemOk); + validateBom(itemGroupList, bomGenList, ref bomList, bomListPrev, ref totCost, ref totPrice, ref numGroupOk, ref numItemOk); // salvo BOM... string itemBom = JsonConvert.SerializeObject(bomList); currRec.ItemBOM = itemBom; - currRec.Cost = totCost; + // salvo arrotondato alla 3° decimale + currRec.BomCost = Math.Round(totCost, 3); + currRec.BomPrice = Math.Round(totPrice, 3); currRec.BomOk = numElems == numGroupOk; currRec.ItemOk = numElems == numItemOk; + // setto ok await di BOM e Price + currRec.AwaitBom = false; + currRec.AwaitPrice = false; dbCtx.Entry(currRec).State = EntityState.Modified; } // salvo... - dbCtx.SaveChanges(); + var result = dbCtx.SaveChanges(); + answ = result > 0; } catch (Exception exc) { @@ -864,7 +1741,7 @@ namespace EgwCoreLib.Lux.Data.Controllers return answ; } - #endregion Public Methods + #endregion Internal Methods #region Private Fields @@ -880,17 +1757,22 @@ namespace EgwCoreLib.Lux.Data.Controllers /// Esegue completamento e la validazione dei dati BOM da lista articoli + gruppi, /// validando i dati stessi /// - /// - /// - /// - /// - /// - /// - private static void validateBom(List itemGroupList, List bomGenList, ref List bomList, ref double totCost, ref int numGroupOk, ref int numItemOk) + /// Elenco ItemGroup da considerare + /// Item di tipo BOM/BomAlt AMMESSI + /// Lista BOM ricevuta da validare + /// Lista BOM precedente da confrontare x scelta alternativi + /// Costo netto componenti BOM calcolato + /// Prezzo complessivo calcolato (con aggiunta marginalità) + /// Controllo coerenza calcoli sui gruppi items + /// Controllo coerenza calcoli su num items + private static void validateBom(List itemGroupList, List bomGenList, ref List bomList, List? bomListPrev, ref double totCost, ref double totPrice, ref int numGroupOk, ref int numItemOk) { + double margin = 0; // ciclo x ogni elemento della BOM, cercando x gruppo e ExtItemCode foreach (var item in bomList) { + // init del margine + margin = 0; // verifico item group esistente... if (itemGroupList.Where(x => x.CodGroup == item.ClassCode).Count() > 0) { @@ -905,6 +1787,8 @@ namespace EgwCoreLib.Lux.Data.Controllers // conto l'item numItemOk++; item.PriceEff = item.Price; + // dovrei recuperare margine da BOM... da rivedere, x ora cablato 20%... + margin = 0.2; } else { @@ -924,9 +1808,33 @@ namespace EgwCoreLib.Lux.Data.Controllers else { recCost = bomGenList - .Where(x => x.CodGroup == item.ClassCode && x.ExtItemCode == item.ItemCode && item.Qty >= x.QtyMin && item.Qty < x.QtyMax) + .Where(x => x.CodGroup == item.ClassCode + && x.ItemIDParent == 0 // voglio NON sia un record CHILD + && x.ExtItemCode == item.ItemCode + && item.Qty >= x.QtyMin + && item.Qty < x.QtyMax) .OrderByDescending(x => x.Cost) .FirstOrDefault(); + // 2025.09.24: se ho un elenco item della BOM precedente + if (bomListPrev != null && bomListPrev.Count > 0 && recCost != null) + { + // ...cerco item trovato come PARENT di altri item + var listAlt = bomGenList.Where(x => x.ItemIDParent == recCost.ItemID).ToList(); + + // che cerco nella nella BOM precedente... + var result = listAlt + .Join( + bomListPrev, + l1 => l1.ItemID, + l2 => l2.ItemID, + (l1, l2) => l1) + .ToList(); + // nel caso ne trovassi solo 1 uso quello al posto del recCost... + if (result.Count == 1) + { + recCost = result.FirstOrDefault(); + } + } } // se trovato valorizzo! @@ -934,14 +1842,15 @@ namespace EgwCoreLib.Lux.Data.Controllers { numItemOk++; item.ItemID = recCost.ItemID; - //item.PriceEff = recCost.Cost * (1 + recCost.Margin); + //item.PriceEff = recCost.BomCost * (1 + recCost.Margin); item.PriceEff = recCost.Cost; // se selezione esatta sovrascrivo altri valori if (selExact) { item.ItemCode = recCost.ExtItemCode; - //item.DescriptionCode = recCost.Description; + //item.DescriptionCode = recCost.Name; } + margin = recCost.Margin; } else { @@ -951,6 +1860,8 @@ namespace EgwCoreLib.Lux.Data.Controllers } // ...e aggiorno totale totCost += item.TotalCost; + // e prezzo totale compreso margine + totPrice += item.TotalCost * (1 + margin); } } diff --git a/EgwCoreLib.Lux.Data/DataLayerContext.cs b/EgwCoreLib.Lux.Data/DataLayerContext.cs index 90cdcf13..af58ebce 100644 --- a/EgwCoreLib.Lux.Data/DataLayerContext.cs +++ b/EgwCoreLib.Lux.Data/DataLayerContext.cs @@ -1,4 +1,11 @@ -using EgwCoreLib.Lux.Data.DbModel; +using EgwCoreLib.Lux.Data.DbModel.Config; +using EgwCoreLib.Lux.Data.DbModel.Cost; +using EgwCoreLib.Lux.Data.DbModel.Items; +using EgwCoreLib.Lux.Data.DbModel.Production; +using EgwCoreLib.Lux.Data.DbModel.Sales; +using EgwCoreLib.Lux.Data.DbModel.Stock; +using EgwCoreLib.Lux.Data.DbModel.Task; +using EgwCoreLib.Lux.Data.DbModel.Utils; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using NLog; @@ -39,12 +46,16 @@ namespace EgwCoreLib.Lux.Data } } - public virtual DbSet DbSetCounters { get; set; } + public virtual DbSet DbSetConfGlass { get; set; } + public virtual DbSet DbSetConfProfile { get; set; } + public virtual DbSet DbSetConfWood { get; set; } + public virtual DbSet DbSetEnvirPar { get; set; } + public virtual DbSet DbSetItemGroup { get; set; } public virtual DbSet DbSetItem { get; set; } public virtual DbSet DbSetSellItem { get; set; } - public virtual DbSet DbSetRole { get; set; } + public virtual DbSet DbSetTags { get; set; } public virtual DbSet DbSetCustomer { get; set; } public virtual DbSet DbSetDealer { get; set; } public virtual DbSet DbSetSupplier { get; set; } @@ -55,14 +66,18 @@ namespace EgwCoreLib.Lux.Data public virtual DbSet DbSetResource { get; set; } public virtual DbSet DbSetPhase { get; set; } public virtual DbSet DbSetJob { get; set; } - public virtual DbSet DbSetJobRow { get; set; } - public virtual DbSet DbSetJobRowItem { get; set; } + public virtual DbSet DbSetJobRow { get; set; } + public virtual DbSet DbSetJobRowItem { get; set; } public virtual DbSet DbSetProdBatch { get; set; } public virtual DbSet DbSetProdItem { get; set; } - public virtual DbSet DbSetProdItemRow { get; set; } + public virtual DbSet DbSetProdItemRow { get; set; } public virtual DbSet DbSetStockStatus { get; set; } public virtual DbSet DbSetMovType { get; set; } public virtual DbSet DbSetStockMov { get; set; } + public virtual DbSet DbSetGenClass { get; set; } + public virtual DbSet DbSetGenVal { get; set; } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); @@ -73,12 +88,23 @@ namespace EgwCoreLib.Lux.Data string connString = DbConfig.CONNECTION_STRING; if (string.IsNullOrEmpty(connString)) { +#if DEBUG connString = "Server=mdb.ufficio;port=3306;database=Lux_000;uid=lux_user;pwd=Egal_pwd!;sslmode=None;"; + //connString = "Server=mdb.ufficio;port=3306;database=Lux_000_dev;uid=lux_user;pwd=Egal_pwd!;sslmode=None;"; +#else + connString = "Server=mdb.ufficio;port=3306;database=Lux_000;uid=lux_user;pwd=Egal_pwd!;sslmode=None;"; +#endif } if (!optionsBuilder.IsConfigured) { var serverVersion = ServerVersion.AutoDetect(connString); optionsBuilder.UseMySql(connString, serverVersion); + // verificare setup componente +#if false + optionsBuilder + .UseMySql(connString, serverVersion) + .UseSnakeCaseNamingConvention(); // via EFCore.NamingConventions +#endif } } @@ -93,6 +119,13 @@ namespace EgwCoreLib.Lux.Data modelBuilder.Entity() .HasKey(c => new { c.RefYear, c.CountName}); + modelBuilder.Entity() + .HasKey(c => new { c.GlassID }); + modelBuilder.Entity() + .HasKey(c => new { c.ProfileID }); + modelBuilder.Entity() + .HasKey(c => new { c.WoodID }); + // fix valori timestamp modelBuilder.Entity(entity => { diff --git a/EgwCoreLib.Lux.Data/DbConfig.cs b/EgwCoreLib.Lux.Data/DbConfig.cs index 9d91849e..23862df5 100644 --- a/EgwCoreLib.Lux.Data/DbConfig.cs +++ b/EgwCoreLib.Lux.Data/DbConfig.cs @@ -74,8 +74,12 @@ namespace EgwCoreLib.Lux.Data DATABASE_NAME = $"Lux_{nKey}"; DATABASE_USER = $"user_{nKey}"; DATABASE_PWD = $"pwd_{sKey}"; - CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database={DATABASE_NAME};uid={DATABASE_USER};pwd={DATABASE_PWD};sslmode=None"; // stringa admin con utente root egalware... +#if DEBUG + CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database={DATABASE_NAME}_dev;uid={DATABASE_USER};pwd={DATABASE_PWD};sslmode=None"; +#else + CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database={DATABASE_NAME};uid={DATABASE_USER};pwd={DATABASE_PWD};sslmode=None"; +#endif ADMIN_CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database=mysql;uid=root;pwd=Egalware_24068!;sslmode=None"; } diff --git a/EgwCoreLib.Lux.Data/DbModel/UserPrivModel.cs b/EgwCoreLib.Lux.Data/DbModel/Admin/UserPrivModel.cs similarity index 91% rename from EgwCoreLib.Lux.Data/DbModel/UserPrivModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Admin/UserPrivModel.cs index fa2a83c6..54831403 100644 --- a/EgwCoreLib.Lux.Data/DbModel/UserPrivModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Admin/UserPrivModel.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace EgwCoreLib.Lux.Data.DbModel +namespace EgwCoreLib.Lux.Data.Data.DbModel.Admin { /// /// Tabella dei USER di MySql diff --git a/EgwCoreLib.Lux.Data/DbModel/Config/EnvirParamModel.cs b/EgwCoreLib.Lux.Data/DbModel/Config/EnvirParamModel.cs new file mode 100644 index 00000000..aef7f46a --- /dev/null +++ b/EgwCoreLib.Lux.Data/DbModel/Config/EnvirParamModel.cs @@ -0,0 +1,26 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace EgwCoreLib.Lux.Data.DbModel.Config +{ + /// + /// Risorsa tipo di Glass x EF + /// + [Table("conf_envir")] + public class EnvirParamModel + { + /// + /// ID / Environment definito + /// + [Key] + public EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS EnvirID { get; set; } = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW; + + /// + /// Chiave da impiegare nel dizionario x inviare la struttura serializzata da calcolare + /// + public string SerStrucKey { get; set; } = "SerStr"; + } +} diff --git a/EgwCoreLib.Lux.Data/DbModel/Config/GlassModel .cs b/EgwCoreLib.Lux.Data/DbModel/Config/GlassModel .cs new file mode 100644 index 00000000..1bab5f49 --- /dev/null +++ b/EgwCoreLib.Lux.Data/DbModel/Config/GlassModel .cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace EgwCoreLib.Lux.Data.DbModel.Config +{ + /// + /// Risorsa tipo di Glass x EF + /// + [Table("conf_glass")] + public class GlassModel : Egw.Window.Data.Glass + { + } +} diff --git a/EgwCoreLib.Lux.Data/DbModel/Config/HardwareModel.cs b/EgwCoreLib.Lux.Data/DbModel/Config/HardwareModel.cs new file mode 100644 index 00000000..59fb9cb7 --- /dev/null +++ b/EgwCoreLib.Lux.Data/DbModel/Config/HardwareModel.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace EgwCoreLib.Lux.Data.DbModel.Config +{ + /// + /// Risorsa tipo di Hardware x EF + /// + [Table("conf_Hardware")] + public class HardwareModel : Egw.Window.Data.Hardware + { + public HardwareModel(string Id, string FamilyName, string Description, Egw.Window.Data.Enums.OpeningTypes OpeningType, string Shape, int SashQty, int SashPosition) : base(Id, FamilyName, Description, OpeningType, Shape, SashQty, SashPosition) + { + } + } +} diff --git a/EgwCoreLib.Lux.Data/DbModel/Config/ProfileModel.cs b/EgwCoreLib.Lux.Data/DbModel/Config/ProfileModel.cs new file mode 100644 index 00000000..e6a9db9a --- /dev/null +++ b/EgwCoreLib.Lux.Data/DbModel/Config/ProfileModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace EgwCoreLib.Lux.Data.DbModel.Config +{ + /// + /// Risorsa tipo di Wood x EF + /// + [Table("conf_profile")] + public class ProfileModel : Egw.Window.Data.Profile + { + } +} diff --git a/EgwCoreLib.Lux.Data/DbModel/Config/WoodModel.cs b/EgwCoreLib.Lux.Data/DbModel/Config/WoodModel.cs new file mode 100644 index 00000000..cd2aa5d7 --- /dev/null +++ b/EgwCoreLib.Lux.Data/DbModel/Config/WoodModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace EgwCoreLib.Lux.Data.DbModel.Config +{ + /// + /// Risorsa tipo di Wood x EF + /// + [Table("conf_wood")] + public class WoodModel : Egw.Window.Data.Wood + { + } +} diff --git a/EgwCoreLib.Lux.Data/DbModel/Cost/CostDriverModel.cs b/EgwCoreLib.Lux.Data/DbModel/Cost/CostDriverModel.cs new file mode 100644 index 00000000..a5ba4046 --- /dev/null +++ b/EgwCoreLib.Lux.Data/DbModel/Cost/CostDriverModel.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace EgwCoreLib.Lux.Data.DbModel.Cost +{ + /// + /// Rappresenta la definizione di un Driver Risorsa da convertire in WorkOur (driver di ResourceModel) + /// + [Table("cost_driver")] + public class CostDriverModel + { + [Key] + public int CostDriverID { get; set; } + + /// + /// Nome driver + /// e.g. "WorkHour" + /// + public string Name { get; set; } = ""; + + /// + /// Nome dell'UM + /// e.g. "hour", "meter" + /// + public string Unit { get; set; } = ""; + + /// + /// Descrizione driver + /// e.g. "WorkHour" + /// + public string Descript { get; set; } = ""; + } + +} diff --git a/EgwCoreLib.Lux.Data/DbModel/Cost/ResourceModel.cs b/EgwCoreLib.Lux.Data/DbModel/Cost/ResourceModel.cs new file mode 100644 index 00000000..96d49aad --- /dev/null +++ b/EgwCoreLib.Lux.Data/DbModel/Cost/ResourceModel.cs @@ -0,0 +1,149 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace EgwCoreLib.Lux.Data.DbModel.Cost +{ + /// + /// Risorsa / Centro di Costo, con costi / Hourly + /// + [Table("cost_resource")] + public class ResourceModel + { + /// + /// ID del record + /// + [Key] + public int ResourceID { get; set; } + + /// + /// Nome/Descrizione + /// + public string Name { get; set; } = string.Empty; + + /// + /// ID del driver di costo impiegato, tipicamente 1 = WorkHour + /// + public int CostDriverID { get; set; } + + /// + /// Valore di riferimento del CostDriver per il calcolo dell'importo unitario della risorsa + /// Se è basato su WorkHour diventa il budget annuale della risorsa disponibile + /// Tipicamente le Ore di impiego a buget risorsa, es 220gg x 8h + /// + public decimal CostDriverBudget { get; set; } = 1; + + /// + /// Costo totale (rif al CostDriverBudget) componente FIXED (macchinari) della risorsa (ove applicabile), comprendendo + /// - ammortamenti + /// - costi di manutenzione ordinaria + /// - costi di manutenzione straordinaria (se stimabili, in periodo post ammortamento) + /// + public decimal FixedCost { get; set; } = 0; + + /// + /// Costo totale (rif al CostDriverBudget) componente variabile (tipicamente Energia) + /// nb: stima basata sul (costo medio energia aziendale) * consumo effettivo (se disponibile), altrimenti (stima potenza media impiegata) * (ore di impiego stimate) + /// + public decimal VariableCost { get; set; } = 0; + + /// + /// Costo della componente HR sulla gestione impianto (rif al CostDriverBudget) + /// + public decimal LaborCost { get; set; } = 0; + + /// + /// Costi di OverHead (rif al CostDriverBudget) da ribaltare su risorsa (tipicamente struttura) + /// + public decimal OverHeadCost { get; set; } = 0; + + /// + /// Costo di overhead (come % on top del resto) + /// + public decimal OverHeadPerc { get; set; } = 0.15M; + + /// + /// EBT ovvero marginalità minima garantita on top del resto dei costi e OH + /// + public decimal EBTPerc { get; set; } = 0.1M; + + /// + /// Margine sul prezzo ovvero valore da potersi eventualmente scontare + /// + public decimal PriceMargin { get; set; } = 0.2M; + + /// + /// Costo Netto la risorsa su base CostDriver + /// + + [NotMapped] + private decimal BaseNetCost + { + get => CostDriverBudget == 0 ? 0 : (FixedCost + VariableCost + OverHeadCost) / CostDriverBudget; + } + + /// + /// Costo RockBottom Risorsa su base CostDriver + /// + [NotMapped] + public decimal BaseRockBottomCost + { + get => BaseNetCost * (1 + OverHeadPerc) * (1 + EBTPerc); + } + + /// + /// Prezzo comprensivo di margine di ricarico massimo scontabile (sul RockBottom) + /// + [NotMapped] + public decimal BasePrice + { + get => BaseRockBottomCost * (1 + PriceMargin); + } + + + /// + /// Navigazione Driver costo + /// + [ForeignKey("CostDriverID")] + public virtual CostDriverModel DriverNav { get; set; } = null!; +#if false + /// + /// Indica gli asset/cespiti + /// + public bool IsAsset { get; set; } = false; + + /// + /// Indica che è un operatore umano + /// + public bool IsHuman { get; set; } = false; + + /// + /// Costo fisso risorsa per UM tipo ammortamento + /// + public double UnitCostFix { get; set; } = 0; + + /// + /// Unità di misura della risorsa tipo fisso/ammortamento + /// + public string UmFix { get; set; } = ""; + + /// + /// Costo unitario risorsa per UM tipo consumabili + /// + public double UnitCostProp { get; set; } = 0; + + /// + /// Unità di misura della risorsa + /// + public string UmProp { get; set; } = string.Empty; +#endif + + } +} diff --git a/EgwCoreLib.Lux.Data/DbModel/ItemGroupModel.cs b/EgwCoreLib.Lux.Data/DbModel/Items/ItemGroupModel.cs similarity index 90% rename from EgwCoreLib.Lux.Data/DbModel/ItemGroupModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Items/ItemGroupModel.cs index e4c88aca..732f0aa0 100644 --- a/EgwCoreLib.Lux.Data/DbModel/ItemGroupModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Items/ItemGroupModel.cs @@ -6,12 +6,12 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace EgwCoreLib.Lux.Data.DbModel +namespace EgwCoreLib.Lux.Data.DbModel.Items { // // This is here so CodeMaid doesn't reorganize this document // - [Table("RegItemGroup")] + [Table("item_group")] public class ItemGroupModel { diff --git a/EgwCoreLib.Lux.Data/DbModel/ItemModel.cs b/EgwCoreLib.Lux.Data/DbModel/Items/ItemModel.cs similarity index 94% rename from EgwCoreLib.Lux.Data/DbModel/ItemModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Items/ItemModel.cs index 8c7e3754..0a5f5aeb 100644 --- a/EgwCoreLib.Lux.Data/DbModel/ItemModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Items/ItemModel.cs @@ -2,13 +2,13 @@ using System.ComponentModel.DataAnnotations.Schema; using static EgwCoreLib.Lux.Core.Enums; -namespace EgwCoreLib.Lux.Data.DbModel +namespace EgwCoreLib.Lux.Data.DbModel.Items { // // This is here so CodeMaid doesn't reorganize this document // - [Table("RegItem")] + [Table("item_item")] public class ItemModel { /// @@ -85,7 +85,7 @@ namespace EgwCoreLib.Lux.Data.DbModel [NotMapped] public bool IsOkQty { - get => QtyMax > 0 && (QtyMax - QtyMin) > 0; + get => QtyMax > 0 && QtyMax - QtyMin > 0; } /// @@ -117,7 +117,7 @@ namespace EgwCoreLib.Lux.Data.DbModel [NotMapped] public bool IsProtected { - get => this.ItemType == EgwCoreLib.Lux.Core.Enums.ItemClassType.Bom; + get => ItemType == ItemClassType.Bom; } /// diff --git a/EgwCoreLib.Lux.Data/DbModel/SellingItemModel.cs b/EgwCoreLib.Lux.Data/DbModel/Items/SellingItemModel.cs similarity index 76% rename from EgwCoreLib.Lux.Data/DbModel/SellingItemModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Items/SellingItemModel.cs index 9f2d4101..921755d0 100644 --- a/EgwCoreLib.Lux.Data/DbModel/SellingItemModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Items/SellingItemModel.cs @@ -1,13 +1,14 @@ -using System.ComponentModel.DataAnnotations; +using EgwCoreLib.Lux.Data.DbModel.Task; +using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -namespace EgwCoreLib.Lux.Data.DbModel +namespace EgwCoreLib.Lux.Data.DbModel.Items { // // This is here so CodeMaid doesn't reorganize this document // - [Table("SellingItem")] + [Table("item_selling_item")] public class SellingItemModel { /// @@ -16,6 +17,11 @@ namespace EgwCoreLib.Lux.Data.DbModel [Key] public int SellingItemID { get; set; } + /// + /// Environment del selling item + /// + public EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS Envir { get; set; } = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW; + /// /// Definisce l'articolo come servizio vs concreto=materiale /// @@ -67,9 +73,10 @@ namespace EgwCoreLib.Lux.Data.DbModel public string SerStruct { get; set; } = ""; /// - /// Json contenente la serializzazione delle fasi previste per la stima dei tempi e costi in formato SerializedPhasePreview; potrebbe contenere anche altre info accessorie x definire dati logistico/gestionali + /// Elenco StepDTO (Fasi) per la stima tempi / costi + /// potrebbe contenere anche altre info accessorie x definire dati logistico/gestionali /// - public string ItemSPP { get; set; } = ""; + public string ItemSteps { get; set; } = ""; /// /// Navigazione Job/Cicli diff --git a/EgwCoreLib.Lux.Data/DbModel/SupplierModel.cs b/EgwCoreLib.Lux.Data/DbModel/Items/SupplierModel.cs similarity index 94% rename from EgwCoreLib.Lux.Data/DbModel/SupplierModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Items/SupplierModel.cs index a43db096..437256ff 100644 --- a/EgwCoreLib.Lux.Data/DbModel/SupplierModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Items/SupplierModel.cs @@ -6,13 +6,13 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace EgwCoreLib.Lux.Data.DbModel +namespace EgwCoreLib.Lux.Data.DbModel.Items { // // This is here so CodeMaid doesn't reorganize this document // - [Table("RegSupplier")] + [Table("item_supplier")] public class SupplierModel { /// diff --git a/EgwCoreLib.Lux.Data/DbModel/JobModel.cs b/EgwCoreLib.Lux.Data/DbModel/JobModel.cs deleted file mode 100644 index 8d7effef..00000000 --- a/EgwCoreLib.Lux.Data/DbModel/JobModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace EgwCoreLib.Lux.Data.DbModel -{ - - [Table("JobList")] - public class JobModel - { - /// - /// ID del record - /// - [Key] - public int JobID { get; set; } - - /// - /// Descrizione del ciclo - /// - public string Description { get; set; } = ""; - } -} diff --git a/EgwCoreLib.Lux.Data/DbModel/JobRowModel.cs b/EgwCoreLib.Lux.Data/DbModel/JobRowModel.cs deleted file mode 100644 index 7c885d68..00000000 --- a/EgwCoreLib.Lux.Data/DbModel/JobRowModel.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -// -// This is here so CodeMaid doesn't reorganize this document -// -namespace EgwCoreLib.Lux.Data.DbModel -{ - [Table("JobRowList")] - public class JobRowModel - { - /// - /// ID del record - /// - [Key] - public int JobRowID { get; set; } - - /// - /// Ciclo di appartenenza - /// - public int JobID { get; set; } - - /// - /// Indice della fase all'interno del Job - /// - public int Index { get; set; } = 0; - - /// - /// ID della fase realizzata - /// - public int PhaseID { get; set; } - - /// - /// ID dellaa risorsa impiegata - /// - public int ResourceID { get; set; } - - /// - /// Descrizione della fase del Job - /// - public string Description { get; set; } = ""; - - /// - /// Margine percentuale standard - /// - public double Qty { get; set; } = 1; - - /// - /// Navigazione Job/Cicli - /// - [ForeignKey("JobID")] - public virtual JobModel JobNav { get; set; } = null!; - - /// - /// Navigazione Job/Cicli - /// - [ForeignKey("PhaseID")] - public virtual PhaseModel PhaseNav { get; set; } = null!; - - /// - /// Navigazione Job/Cicli - /// - [ForeignKey("ResourceID")] - public virtual ResourceModel ResourceNav { get; set; } = null!; - } -} diff --git a/EgwCoreLib.Lux.Data/DbModel/OfferRowModel.cs b/EgwCoreLib.Lux.Data/DbModel/OfferRowModel.cs deleted file mode 100644 index 48295e22..00000000 --- a/EgwCoreLib.Lux.Data/DbModel/OfferRowModel.cs +++ /dev/null @@ -1,136 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace EgwCoreLib.Lux.Data.DbModel -{ - // - // This is here so CodeMaid doesn't reorganize this document - // - - [Table("OfferRowList")] - public class OfferRowModel - { - /// - /// ID del record - /// - [Key] - public int OfferRowID { get; set; } - - /// - /// Riferimento offerta - /// - public int OfferID { get; set; } - - /// - /// Riga Offerta (per ordinamento) - /// - public int RowNum { get; set; } = 0; - - /// - /// Campo salvato dell'Environment - /// - public string Environment { get; set; } = "WINDOW"; - - /// - /// Campo salvato dell'UID da codice DataMatrix calcolato - /// - public string OfferRowUID { get; set; } = "OFF00001230AZ"; - - /// - /// Codice calcolato offerta ANNO.ID_RIGA_OFFERTA (0...Z come Dtx) - /// - [NotMapped] - public string OfferRowDtx - { - get => $"OFF{Inserted.Year:yy}{OfferRowID:000000000}"; - } - - /// - /// ID dell'articolo di vendita offerto - /// - public int SellingItemID { get; set; } - - /// - /// Costo (standard / senza listini) - /// - public double Cost { get; set; } = 0; - - /// - /// Margine percentuale standard - /// - public double Qty { get; set; } = 1; - - [NotMapped] - public double TotalCost - { - get => Qty * Cost; - } - - /// - /// Valore serializzato della composizione articolo (in formato JWD x finestra) - /// - public string SerStruct { get; set; } = ""; - - /// - /// Json contenente la serializzazione delle fasi previste per la stima dei tempi e costi in formato SerializedPhasePreview; potrebbe contenere anche altre info accessorie x definire dati logistico/gestionali - /// - public string ItemSPP { get; set; } = ""; - - /// - /// BOM serializzata per la produzione dell'item - /// - public string ItemBOM { get; set; } = ""; - - /// - /// Validazione dati BOM (Inteso come gruppi tutti trovati/esistenti) - /// - public bool BomOk { get; set; } = false; - - /// - /// Validazione livello item per Costo e range dimensione - /// - public bool ItemOk { get; set; } = false; - - /// - /// Note libere - /// - public string Note { get; set; } = ""; - -#if false - /// - /// Stack degli ultimi item serializzati per Uno/Redo actions - /// - [NotMapped] - public List UndoRedoSerStruct { get; set; } = new List(); -#endif - - - /// - /// DataOra inserimento - /// - public DateTime Inserted { get; set; } = DateTime.Now; - - /// - /// DataOra ultima modifica - /// - public DateTime Modified { get; set; } = DateTime.Now; - - /// - /// Navigazione Offer - /// - [ForeignKey("OfferID")] - public virtual OfferModel OfferNav { get; set; } = null!; - - /// - /// Navigazione Item - /// - [ForeignKey("SellingItemID")] - public virtual SellingItemModel SellingItemNav { get; set; } = null!; - } -} diff --git a/EgwCoreLib.Lux.Data/DbModel/ProductionBatchModel.cs b/EgwCoreLib.Lux.Data/DbModel/Production/ProductionBatchModel.cs similarity index 92% rename from EgwCoreLib.Lux.Data/DbModel/ProductionBatchModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Production/ProductionBatchModel.cs index 8a333ea2..861240e1 100644 --- a/EgwCoreLib.Lux.Data/DbModel/ProductionBatchModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Production/ProductionBatchModel.cs @@ -1,13 +1,13 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -namespace EgwCoreLib.Lux.Data.DbModel +namespace EgwCoreLib.Lux.Data.DbModel.Production { // // This is here so CodeMaid doesn't reorganize this document // - [Table("ProductionBatch")] + [Table("production_batch")] public class ProductionBatchModel { /// diff --git a/EgwCoreLib.Lux.Data/DbModel/ProductionItemModel.cs b/EgwCoreLib.Lux.Data/DbModel/Production/ProductionItemModel.cs similarity index 92% rename from EgwCoreLib.Lux.Data/DbModel/ProductionItemModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Production/ProductionItemModel.cs index 802c0bb2..a3c30f23 100644 --- a/EgwCoreLib.Lux.Data/DbModel/ProductionItemModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Production/ProductionItemModel.cs @@ -1,13 +1,14 @@ -using System.ComponentModel.DataAnnotations; +using EgwCoreLib.Lux.Data.DbModel.Sales; +using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -namespace EgwCoreLib.Lux.Data.DbModel +namespace EgwCoreLib.Lux.Data.DbModel.Production { // // This is here so CodeMaid doesn't reorganize this document // - [Table("ProductionItem")] + [Table("production_item")] public class ProductionItemModel { /// diff --git a/EgwCoreLib.Lux.Data/DbModel/ProductionItemRowModel.cs b/EgwCoreLib.Lux.Data/DbModel/Production/ProductionItemStepModel.cs similarity index 86% rename from EgwCoreLib.Lux.Data/DbModel/ProductionItemRowModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Production/ProductionItemStepModel.cs index 0a423ef0..d980c01a 100644 --- a/EgwCoreLib.Lux.Data/DbModel/ProductionItemRowModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Production/ProductionItemStepModel.cs @@ -1,4 +1,6 @@ -using System; +using EgwCoreLib.Lux.Data.DbModel.Cost; +using EgwCoreLib.Lux.Data.DbModel.Task; +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; @@ -9,19 +11,19 @@ using System.Threading.Tasks; // // This is here so CodeMaid doesn't reorganize this document // -namespace EgwCoreLib.Lux.Data.DbModel +namespace EgwCoreLib.Lux.Data.DbModel.Production { /// - /// Tabella delel effettiva righe della fgasi di lavorazione x ogni item da produrre + /// Tabella delle fasi di lavorazione x ogni item da produrre /// - [Table("ProductionItemRowList")] - public class ProductionItemRowModel + [Table("production_item_step")] + public class ProductionItemStepModel { /// /// ID del record /// [Key] - public int ProdItemRowID { get; set; } + public int ProdItemStepID { get; set; } /// /// Item di appartenenza diff --git a/EgwCoreLib.Lux.Data/DbModel/ResourceModel.cs b/EgwCoreLib.Lux.Data/DbModel/ResourceModel.cs deleted file mode 100644 index 3b8d08e6..00000000 --- a/EgwCoreLib.Lux.Data/DbModel/ResourceModel.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -// -// This is here so CodeMaid doesn't reorganize this document -// -namespace EgwCoreLib.Lux.Data.DbModel -{ - [Table("RegResource")] - public class ResourceModel - { - /// - /// ID del record - /// - [Key] - public int ResourceID { get; set; } - - /// - /// Descrizione - /// - public string Description { get; set; } = ""; - - /// - /// Indica gli assec/cespiti - /// - public bool IsAsset { get; set; } = false; - - /// - /// Indica che è un operatore umano - /// - public bool IsHuman { get; set; } = false; - - /// - /// Costo fisso risorsa per UM tipo ammortamento - /// - public double UnitCostFix { get; set; } = 0; - - /// - /// Unità di misura della risorsa tipo fisso/ammortamento - /// - public string UmFix { get; set; } = ""; - - /// - /// Costo unitario risorsa per UM tipo consumabili - /// - public double UnitCostProp { get; set; } = 0; - - /// - /// Unità di misura della risorsa - /// - public string UmProp { get; set; } = ""; - - } -} diff --git a/EgwCoreLib.Lux.Data/DbModel/CustomerModel.cs b/EgwCoreLib.Lux.Data/DbModel/Sales/CustomerModel.cs similarity index 94% rename from EgwCoreLib.Lux.Data/DbModel/CustomerModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Sales/CustomerModel.cs index 0bb9b024..cb9e62db 100644 --- a/EgwCoreLib.Lux.Data/DbModel/CustomerModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Sales/CustomerModel.cs @@ -6,13 +6,13 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace EgwCoreLib.Lux.Data.DbModel +namespace EgwCoreLib.Lux.Data.DbModel.Sales { // // This is here so CodeMaid doesn't reorganize this document // - [Table("RegCustomer")] + [Table("sales_customer")] public class CustomerModel { /// diff --git a/EgwCoreLib.Lux.Data/DbModel/DealerModel.cs b/EgwCoreLib.Lux.Data/DbModel/Sales/DealerModel.cs similarity index 94% rename from EgwCoreLib.Lux.Data/DbModel/DealerModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Sales/DealerModel.cs index 45678c6c..b2e9cd5b 100644 --- a/EgwCoreLib.Lux.Data/DbModel/DealerModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Sales/DealerModel.cs @@ -6,13 +6,13 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace EgwCoreLib.Lux.Data.DbModel +namespace EgwCoreLib.Lux.Data.DbModel.Sales { // // This is here so CodeMaid doesn't reorganize this document // - [Table("RegDealer")] + [Table("sales_dealer")] public class DealerModel { /// diff --git a/EgwCoreLib.Lux.Data/DbModel/OfferModel.cs b/EgwCoreLib.Lux.Data/DbModel/Sales/OfferModel.cs similarity index 63% rename from EgwCoreLib.Lux.Data/DbModel/OfferModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Sales/OfferModel.cs index 36406cdb..51c45065 100644 --- a/EgwCoreLib.Lux.Data/DbModel/OfferModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Sales/OfferModel.cs @@ -1,20 +1,14 @@ -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using static EgwCoreLib.Lux.Core.Enums; -namespace EgwCoreLib.Lux.Data.DbModel +namespace EgwCoreLib.Lux.Data.DbModel.Sales { // // This is here so CodeMaid doesn't reorganize this document // - [Table("Offer")] + [Table("sales_offer")] public class OfferModel { /// @@ -23,6 +17,11 @@ namespace EgwCoreLib.Lux.Data.DbModel [Key] public int OfferID { get; set; } + /// + /// Environment della richiesta + /// + public EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS Envir { get; set; } = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW; + /// /// Anno rif offerta /// @@ -40,11 +39,12 @@ namespace EgwCoreLib.Lux.Data.DbModel /// /// Codice calcolato offerta ANNO.NUMERO.REV + /// inizia per SO = SalesOffer /// [NotMapped] public string OfferCode { - get => $"{RefYear:00}.{RefNum:00000}.{RefRev:00}"; + get => $"SO.{RefYear:00}.{RefNum:000000}.{RefRev:000}"; } /// @@ -62,6 +62,16 @@ namespace EgwCoreLib.Lux.Data.DbModel /// public int DealerID { get; set; } + /// + /// Dizionario serializzato delle preselezioni (opzionale) + /// + public string DictPresel { get; set; } = ""; + + /// + /// note di consegna (opzionali) + /// + public string ConsNote { get; set; } = ""; + /// /// Validità offerta /// @@ -77,30 +87,61 @@ namespace EgwCoreLib.Lux.Data.DbModel /// public DateTime Modified { get; set; } = DateTime.Now; - /// /// Enum stato offerta /// public OfferStates OffertState { get; set; } = OfferStates.Open; + /// + /// Sconto applicato (deve essere < del MAX) + /// + public double Discount { get; set; } = 0; + /// /// Numero Item compresi /// [NotMapped] - public int NumItems + public double NumItems + { + get => OfferRowNav?.Sum(x => x.Qty) ?? 0; + } + /// + /// Numero Item compresi + /// + [NotMapped] + public int NumRows { get => OfferRowNav?.Count ?? 0; } /// - /// Imposto totale offerta + /// Costo totale offerta (rock bottom) /// [NotMapped] public double TotalCost { - get => OfferRowNav?.Sum(x => x.Cost) ?? 0; + get => OfferRowNav?.Sum(x => x.TotalCost) ?? 0; } + /// + /// Prezzo totale offerta (compreso di amrginalità) + /// + [NotMapped] + public double TotalPrice + { + get => OfferRowNav?.Sum(x => x.TotalPrice) ?? 0; + } + + /// + /// Sconto massimo applicabile + /// + [NotMapped] + public double MaxDiscount + { + get => (TotalCost > 0 && TotalPrice > TotalCost) ? (TotalPrice - TotalCost) / TotalPrice : 0; + } + + #if false /// /// ID Ordine (nullo se non c'è ordine) @@ -126,6 +167,7 @@ namespace EgwCoreLib.Lux.Data.DbModel [ForeignKey("DealerID")] public virtual DealerModel DealerNav { get; set; } = null!; + /// /// Navigazione alle righe offerta /// diff --git a/EgwCoreLib.Lux.Data/DbModel/Sales/OfferRowModel.cs b/EgwCoreLib.Lux.Data/DbModel/Sales/OfferRowModel.cs new file mode 100644 index 00000000..2cf93528 --- /dev/null +++ b/EgwCoreLib.Lux.Data/DbModel/Sales/OfferRowModel.cs @@ -0,0 +1,214 @@ +using EgwCoreLib.Lux.Data.DbModel.Items; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace EgwCoreLib.Lux.Data.DbModel.Sales +{ + + [Table("sales_offer_row")] + public class OfferRowModel + { + /// + /// ID del record + /// + [Key] + public int OfferRowID { get; set; } + + /// + /// Riferimento offerta + /// + public int OfferID { get; set; } + + /// + /// Riga Offerta (per ordinamento) + /// + public int RowNum { get; set; } = 0; + + /// + /// Environment della richiesta + /// + public EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS Envir { get; set; } = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW; + + /// + /// Campo salvato dell'UID da codice DataMatrix calcolato + /// inizia per SOR = SalesOfferRow + /// + public string OfferRowUID { get; set; } = "SOR.25.0123ABCD"; + + /// + /// Codice calcolato offerta ANNO.ID_RIGA_OFFERTA in HEX (0xFFFFFFFF) + /// + [NotMapped] + public string OfferRowDtx + { + get => $"SOR.{Inserted:yy}.{OfferRowID:X8}"; + } + + /// + /// ID dell'articolo di vendita offerto + /// + public int SellingItemID { get; set; } + + /// + /// Quantità della risorsa + /// + public double Qty { get; set; } = 1; + + /// + /// Costo dei componeti BOM (RockBottom) + /// + public double BomCost { get; set; } = 0; + + /// + /// Prezzo dei componeti BOM (scontabile) + /// + public double BomPrice { get; set; } = 0; + + + /// + /// Costo produzione Fase/Step (RockBottom) + /// + public double StepCost { get; set; } = 0; + + /// + /// Prezzo produzione Fase/Step (scontabile) + /// + public double StepPrice { get; set; } = 0; + + /// + /// Costo Totale Risorsa (BOM + Fase) + /// + [NotMapped] + public double UnitCost + { + get => BomCost + StepCost; + } + + /// + /// Costo Totale Risorsa (BOM + Fase) + /// + [NotMapped] + public double UnitPrice + { + get => BomPrice + StepPrice; + } + + /// + /// Sconto massimo applicabile + /// + [NotMapped] + public double MaxDiscount + { + get => (UnitCost > 0 && UnitPrice > UnitCost) ? (UnitPrice - UnitCost) / UnitPrice : 0; + } + + /// + /// Costo Totale risorsa + /// + [NotMapped] + public double TotalCost + { + get => UnitCost * Qty; + } + + /// + /// Costo Totale risorsa + /// + [NotMapped] + public double TotalPrice + { + get => UnitPrice * Qty; + } + + /// + /// Valore serializzato della composizione articolo (in formato JWD x finestra) + /// + public string SerStruct { get; set; } = ""; + + /// + /// Nomi risorsa file associato alla riga offerta (es per BTL) + /// URI come risorsa dentro folder offerta/riga-offerta/guid + /// + public string FileResource { get; set; } = ""; + + /// + /// Nomi file originale associato alla riga offerta (es per BTL) + /// + public string FileName { get; set; } = ""; + + /// + /// Dimensione del file (per visualizzazione rapida) + /// + public long FileSize { get; set; } = 0; + + /// + /// Elenco StepDTO (Fasi) per la stima tempi / costi + /// potrebbe contenere anche altre info accessorie x definire dati logistico/gestionali + /// + public string ItemSteps { get; set; } = ""; + + /// + /// BOM serializzata per la produzione dell'item + /// + public string ItemBOM { get; set; } = ""; + + /// + /// Validazione dati BOM (Inteso come gruppi tutti trovati/esistenti) + /// + public bool BomOk { get; set; } = false; + + /// + /// Validazione livello item per Costo e range dimensione + /// + public bool ItemOk { get; set; } = false; + + /// + /// Note libere + /// + public string Note { get; set; } = ""; + +#if false + /// + /// Stack degli ultimi item serializzati per Uno/Redo actions + /// + [NotMapped] + public List UndoRedoSerStruct { get; set; } = new List(); +#endif + + + /// + /// DataOra inserimento + /// + public DateTime Inserted { get; set; } = DateTime.Now; + + /// + /// DataOra ultima modifica + /// + public DateTime Modified { get; set; } = DateTime.Now; + + /// + /// Indica che è in attesa aggiornamento BOM + /// + public bool AwaitBom { get; set; } = false; + + /// + /// Indica che è in attesa aggiornamento Price + /// + public bool AwaitPrice { get; set; } = false; + + /// + /// Navigazione Offer + /// + [ForeignKey("OfferID")] + public virtual OfferModel OfferNav { get; set; } = null!; + + /// + /// Navigazione Item + /// + [ForeignKey("SellingItemID")] + public virtual SellingItemModel SellingItemNav { get; set; } = null!; + } +} diff --git a/EgwCoreLib.Lux.Data/DbModel/OrderModel.cs b/EgwCoreLib.Lux.Data/DbModel/Sales/OrderModel.cs similarity index 88% rename from EgwCoreLib.Lux.Data/DbModel/OrderModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Sales/OrderModel.cs index cc544a59..bf3969e0 100644 --- a/EgwCoreLib.Lux.Data/DbModel/OrderModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Sales/OrderModel.cs @@ -8,7 +8,7 @@ using System.Text; using System.Threading.Tasks; using static EgwCoreLib.Lux.Core.Enums; -namespace EgwCoreLib.Lux.Data.DbModel +namespace EgwCoreLib.Lux.Data.DbModel.Sales { // // This is here so CodeMaid doesn't reorganize this document @@ -17,7 +17,7 @@ namespace EgwCoreLib.Lux.Data.DbModel /// /// Classe degli ordini commerciali /// - [Table("Order")] + [Table("sales_order")] public class OrderModel { /// @@ -70,6 +70,16 @@ namespace EgwCoreLib.Lux.Data.DbModel /// public int DealerID { get; set; } + /// + /// note di consegna (opzionali) + /// + public string ConsNote { get; set; } = ""; + + /// + /// Dizionario serializzato delle preselezioni (opzionale) + /// + public string DictPresel { get; set; } = ""; + /// /// Validità Ordine /// diff --git a/EgwCoreLib.Lux.Data/DbModel/OrderRowModel.cs b/EgwCoreLib.Lux.Data/DbModel/Sales/OrderRowModel.cs similarity index 55% rename from EgwCoreLib.Lux.Data/DbModel/OrderRowModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Sales/OrderRowModel.cs index 162720d4..68f12fda 100644 --- a/EgwCoreLib.Lux.Data/DbModel/OrderRowModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Sales/OrderRowModel.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +using EgwCoreLib.Lux.Data.DbModel.Items; +using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -7,13 +8,13 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace EgwCoreLib.Lux.Data.DbModel +namespace EgwCoreLib.Lux.Data.DbModel.Sales { // // This is here so CodeMaid doesn't reorganize this document // - [Table("OrderRowList")] + [Table("sales_order_row")] public class OrderRowModel { /// @@ -33,12 +34,13 @@ namespace EgwCoreLib.Lux.Data.DbModel public int RowNum { get; set; } = 0; /// - /// Codice calcolato Ordine ANNO.NUMERO.REV + /// Codice calcolato Ordine ANNO.NUMERO + /// inizia per PO = PurchaseOrder /// [NotMapped] public string OrderRowCode { - get => $"{OrderRowID:0000}.{RowNum:000}"; + get => $"PO{OrderRowID:000000}.{RowNum:000}"; } /// @@ -47,19 +49,74 @@ namespace EgwCoreLib.Lux.Data.DbModel public int SellingItemID { get; set; } /// - /// Costo (standard / senza listini) + /// Costo dei componeti BOM (RockBottom) /// - public double Cost { get; set; } = 0; + public double BomCost { get; set; } = 0; /// /// Margine percentuale standard /// public double Qty { get; set; } = 1; + /// + /// Prezzo dei componeti BOM (scontabile) + /// + public double BomPrice { get; set; } = 0; + + + /// + /// Costo produzione Fase/Step (RockBottom) + /// + public double StepCost { get; set; } = 0; + + /// + /// Prezzo produzione Fase/Step (scontabile) + /// + public double StepPrice { get; set; } = 0; + + /// + /// Costo Totale Risorsa (BOM + Fase) + /// + [NotMapped] + public double UnitCost + { + get => BomCost + StepCost; + } + + /// + /// Costo Totale Risorsa (BOM + Fase) + /// + [NotMapped] + public double UnitPrice + { + get => BomPrice + StepPrice; + } + + /// + /// Sconto massimo applicabile + /// + [NotMapped] + public double MaxDiscount + { + get => (UnitCost > 0 && UnitPrice > UnitCost) ? (UnitPrice - UnitCost) / UnitPrice : 0; + } + + /// + /// Costo Totale risorsa + /// [NotMapped] public double TotalCost { - get => Qty * Cost; + get => UnitCost * Qty; + } + + /// + /// Costo Totale risorsa + /// + [NotMapped] + public double TotalPrice + { + get => UnitPrice * Qty; } /// @@ -68,9 +125,10 @@ namespace EgwCoreLib.Lux.Data.DbModel public string SerStruct { get; set; } = ""; /// - /// Json contenente la serializzazione delle fasi previste per la stima dei tempi e costi in formato SerializedPhasePreview; potrebbe contenere anche altre info accessorie x definire dati logistico/gestionali + /// Elenco StepDTO (Fasi) per la stima tempi / costi + /// potrebbe contenere anche altre info accessorie x definire dati logistico/gestionali /// - public string ItemSPP { get; set; } = ""; + public string ItemSteps { get; set; } = ""; /// /// Note libere diff --git a/EgwCoreLib.Lux.Data/DbModel/StockMovModel.cs b/EgwCoreLib.Lux.Data/DbModel/Stock/StockMovModel.cs similarity index 92% rename from EgwCoreLib.Lux.Data/DbModel/StockMovModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Stock/StockMovModel.cs index 7e986260..f7db6947 100644 --- a/EgwCoreLib.Lux.Data/DbModel/StockMovModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Stock/StockMovModel.cs @@ -1,4 +1,5 @@ -using System; +using EgwCoreLib.Lux.Data.DbModel.Utils; +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; @@ -6,7 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace EgwCoreLib.Lux.Data.DbModel +namespace EgwCoreLib.Lux.Data.DbModel.Stock { // // This is here so CodeMaid doesn't reorganize this document @@ -14,7 +15,7 @@ namespace EgwCoreLib.Lux.Data.DbModel /// /// Tabella dei movimenti degli item in giacenza /// - [Table("StockMov")] + [Table("stock_mov")] public class StockMovModel { /// @@ -39,7 +40,7 @@ namespace EgwCoreLib.Lux.Data.DbModel public DateTime DtMod { get; set; } = DateTime.Now; /// - /// Qty movimento registrato (delta +/-) + /// ProductivityRate movimento registrato (delta +/-) /// public double QtyRec { get; set; } = 0; diff --git a/EgwCoreLib.Lux.Data/DbModel/StockStatusModel.cs b/EgwCoreLib.Lux.Data/DbModel/Stock/StockStatusModel.cs similarity index 91% rename from EgwCoreLib.Lux.Data/DbModel/StockStatusModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Stock/StockStatusModel.cs index 15b7d604..fad8b9fd 100644 --- a/EgwCoreLib.Lux.Data/DbModel/StockStatusModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Stock/StockStatusModel.cs @@ -1,4 +1,5 @@ -using System; +using EgwCoreLib.Lux.Data.DbModel.Items; +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; @@ -6,7 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace EgwCoreLib.Lux.Data.DbModel +namespace EgwCoreLib.Lux.Data.DbModel.Stock { // // This is here so CodeMaid doesn't reorganize this document @@ -15,7 +16,7 @@ namespace EgwCoreLib.Lux.Data.DbModel /// Tabelal delle giacenze di magazzino /// - [Table("StockStatus")] + [Table("stock_status")] public class StockStatusModel { /// @@ -30,7 +31,7 @@ namespace EgwCoreLib.Lux.Data.DbModel public int ItemID { get; set; } = 0; /// - /// Qty in giacenza + /// ProductivityRate in giacenza /// public double QtyAvail { get; set; } = 0; diff --git a/EgwCoreLib.Lux.Data/DbModel/Task/JobModel.cs b/EgwCoreLib.Lux.Data/DbModel/Task/JobModel.cs new file mode 100644 index 00000000..c26e9c5a --- /dev/null +++ b/EgwCoreLib.Lux.Data/DbModel/Task/JobModel.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace EgwCoreLib.Lux.Data.DbModel.Task +{ + /// + /// Definizione macro dei Cicli di Lavoro / Job + /// + [Table("task_job")] + public class JobModel + { + /// + /// ID del record + /// + [Key] + public int JobID { get; set; } + + /// + /// Descrizione del ciclo di lavoro + /// + public string Description { get; set; } = ""; + + /// + /// Navigation verso JobStep + /// + public virtual ICollection JobStepNav { get; set; } = new List(); + } +} diff --git a/EgwCoreLib.Lux.Data/DbModel/JobRowItemModel.cs b/EgwCoreLib.Lux.Data/DbModel/Task/JobStepItemModel.cs similarity index 74% rename from EgwCoreLib.Lux.Data/DbModel/JobRowItemModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Task/JobStepItemModel.cs index 015e2173..20229775 100644 --- a/EgwCoreLib.Lux.Data/DbModel/JobRowItemModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Task/JobStepItemModel.cs @@ -1,29 +1,25 @@ -using System; -using System.Collections.Generic; +using EgwCoreLib.Lux.Data.DbModel.Items; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using System.Linq; -using System.Text; -using System.Threading.Tasks; // // This is here so CodeMaid doesn't reorganize this document // -namespace EgwCoreLib.Lux.Data.DbModel +namespace EgwCoreLib.Lux.Data.DbModel.Task { - [Table("JobRowItemList")] - public class JobRowItemModel + [Table("task_job_step_item")] + public class JobStepItemModel { /// /// ID del record /// [Key] - public int JobRowItemID { get; set; } + public int JobStepItemID { get; set; } /// /// Fase del Ciclo di appartenenza /// - public int JobRowID { get; set; } + public int JobStepID { get; set; } /// /// Indice della fase all'interno del Job @@ -48,8 +44,8 @@ namespace EgwCoreLib.Lux.Data.DbModel /// /// Navigazione su fasi ciclo /// - [ForeignKey("JobRowID")] - public virtual JobRowModel JobRowNav { get; set; } = null!; + [ForeignKey("JobStepID")] + public virtual JobStepModel JobStepNav { get; set; } = null!; /// /// Navigazione su Items diff --git a/EgwCoreLib.Lux.Data/DbModel/Task/JobStepModel.cs b/EgwCoreLib.Lux.Data/DbModel/Task/JobStepModel.cs new file mode 100644 index 00000000..e0881858 --- /dev/null +++ b/EgwCoreLib.Lux.Data/DbModel/Task/JobStepModel.cs @@ -0,0 +1,116 @@ +using EgwCoreLib.Lux.Data.DbModel.Cost; +using EgwCoreLib.Lux.Data.DbModel.Task; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace EgwCoreLib.Lux.Data.DbModel.Task +{ + /// + /// Routing dei cicli di lavoro, con riferimento a risorse e fasi + /// + [Table("task_job_step")] + public class JobStepModel + { + /// + /// ID del record + /// + [Key] + public int JobStepID { get; set; } + + /// + /// Ciclo di appartenenza + /// + public int JobID { get; set; } + + /// + /// Indice della fase all'interno del Job + /// + public int Index { get; set; } = 0; + + /// + /// ID del driver di costo impiegato + /// + public int CostDriverID { get; set; } + + /// + /// ID della fase realizzata + /// + public int PhaseID { get; set; } + + /// + /// ID della risorsa impiegata + /// + public int ResourceID { get; set; } + + /// + /// Descrizione della fase del Job + /// + public string Description { get; set; } = ""; + + /// + /// Rapporto produttività tra CostDriver Step e CostDriver Risorsa (es: m/h) + /// + public decimal ProductivityRate { get; set; } = 1; + + /// + /// Costo RockBottom Fase (step) di produzione + /// sulla base del costo della risorsa, della produttività e della quantità impiegata + /// + /// Quantità risorsa impiegata + /// + public decimal RockBottomCost(decimal quantity) + { + decimal stepCost = 0; + var unitRequired = quantity / ProductivityRate; + if (ResourceNav != null) + { + stepCost = ResourceNav.BaseRockBottomCost * quantity; + } + return stepCost; + } + + /// + /// Prezzo calcolato per Fase (step) di produzione + /// sulla base del costo RockBottom + marginalità standard + /// + /// Quantità risorsa impiegata + /// + public decimal RockBottomPrice(decimal quantity) + { + decimal stepCost = 0; + var unitRequired = quantity / ProductivityRate; + if (ResourceNav != null) + { + stepCost = ResourceNav.BasePrice * quantity; + } + return stepCost; + } + + /// + /// Navigazione Job/Cicli + /// + [ForeignKey("JobID")] + public virtual JobModel JobNav { get; set; } = null!; + + /// + /// Navigazione Driver costo + /// + [ForeignKey("CostDriverID")] + public virtual CostDriverModel DriverNav { get; set; } = null!; + + /// + /// Navigazione Fasi + /// + [ForeignKey("PhaseID")] + public virtual PhaseModel PhaseNav { get; set; } = null!; + + /// + /// Navigazione Risorse + /// + [ForeignKey("ResourceID")] + public virtual ResourceModel ResourceNav { get; set; } = null!; + } +} diff --git a/EgwCoreLib.Lux.Data/DbModel/PhaseModel.cs b/EgwCoreLib.Lux.Data/DbModel/Task/PhaseModel.cs similarity index 80% rename from EgwCoreLib.Lux.Data/DbModel/PhaseModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Task/PhaseModel.cs index 4a963625..56d799e1 100644 --- a/EgwCoreLib.Lux.Data/DbModel/PhaseModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Task/PhaseModel.cs @@ -9,10 +9,12 @@ using System.Threading.Tasks; // // This is here so CodeMaid doesn't reorganize this document // -namespace EgwCoreLib.Lux.Data.DbModel +namespace EgwCoreLib.Lux.Data.DbModel.Task { - - [Table("RegPhase")] + /// + /// Fase di lavorazione / ProductionStage + /// + [Table("task_phase")] public class PhaseModel { /// @@ -25,7 +27,5 @@ namespace EgwCoreLib.Lux.Data.DbModel /// Descrizione /// public string Description { get; set; } = ""; - - } } diff --git a/EgwCoreLib.Lux.Data/DbModel/CountersModel.cs b/EgwCoreLib.Lux.Data/DbModel/Utils/CountersModel.cs similarity index 91% rename from EgwCoreLib.Lux.Data/DbModel/CountersModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Utils/CountersModel.cs index ef4de190..7103769b 100644 --- a/EgwCoreLib.Lux.Data/DbModel/CountersModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Utils/CountersModel.cs @@ -6,13 +6,13 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace EgwCoreLib.Lux.Data.DbModel +namespace EgwCoreLib.Lux.Data.DbModel.Utils { // // This is here so CodeMaid doesn't reorganize this document // - [Table("Counter")] + [Table("utils_counter")] public class CounterModel { /// diff --git a/EgwCoreLib.Lux.Data/DbModel/Utils/GenClassModel.cs b/EgwCoreLib.Lux.Data/DbModel/Utils/GenClassModel.cs new file mode 100644 index 00000000..7e7f0b90 --- /dev/null +++ b/EgwCoreLib.Lux.Data/DbModel/Utils/GenClassModel.cs @@ -0,0 +1,38 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace EgwCoreLib.Lux.Data.DbModel.Utils +{ + + [Table("utils_gen_class")] + public class GenClassModel + { + /// + /// Cod della classe + /// + [Key] + public string ClassCod { get; set; } = ""; + + /// + /// Descrizione + /// + public string Description { get; set; } = ""; + + /// + /// Numero Item compresi + /// + [NotMapped] + public int NumChild + { + get => GenValNav?.Count ?? 0; + } + + /// + /// Navigazione alle righe dei valori associati + /// + public virtual ICollection GenValNav { get; set; } = new List(); + } +} diff --git a/EgwCoreLib.Lux.Data/DbModel/Utils/GenValueModel.cs b/EgwCoreLib.Lux.Data/DbModel/Utils/GenValueModel.cs new file mode 100644 index 00000000..6c4bdf8f --- /dev/null +++ b/EgwCoreLib.Lux.Data/DbModel/Utils/GenValueModel.cs @@ -0,0 +1,40 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace EgwCoreLib.Lux.Data.DbModel.Utils +{ + + [Table("utils_gen_value")] + public class GenValueModel + { + /// + /// ID del record + /// + [Key] + public int GenValID { get; set; } + + /// + /// Riferimento Classe di appartenenza + /// + public string ClassCod { get; set; } = ""; + + /// + /// Valore ordinale (entro classe) + /// + public int Ordinal { get; set; } = 0; + + /// + /// Valore String + /// + public string ValString { get; set; } = ""; + + /// + /// Navigazione GenClass + /// + [ForeignKey("ClassCod")] + public virtual GenClassModel GenClassNav { get; set; } = null!; + } +} diff --git a/EgwCoreLib.Lux.Data/DbModel/MovTypeModel.cs b/EgwCoreLib.Lux.Data/DbModel/Utils/MovTypeModel.cs similarity index 89% rename from EgwCoreLib.Lux.Data/DbModel/MovTypeModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Utils/MovTypeModel.cs index b580edbc..037d1133 100644 --- a/EgwCoreLib.Lux.Data/DbModel/MovTypeModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Utils/MovTypeModel.cs @@ -6,12 +6,12 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace EgwCoreLib.Lux.Data.DbModel +namespace EgwCoreLib.Lux.Data.DbModel.Utils { // // This is here so CodeMaid doesn't reorganize this document // - [Table("RegMovType")] + [Table("utils_mov_type")] public class MovTypeModel { diff --git a/EgwCoreLib.Lux.Data/DbModel/TagsModel.cs b/EgwCoreLib.Lux.Data/DbModel/Utils/TagsModel.cs similarity index 90% rename from EgwCoreLib.Lux.Data/DbModel/TagsModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Utils/TagsModel.cs index 6e2fbd5d..1529bf12 100644 --- a/EgwCoreLib.Lux.Data/DbModel/TagsModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Utils/TagsModel.cs @@ -6,13 +6,13 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace EgwCoreLib.Lux.Data.DbModel +namespace EgwCoreLib.Lux.Data.DbModel.Utils { // // This is here so CodeMaid doesn't reorganize this document // - [Table("RegTags")] + [Table("utils_tags")] public class TagsModel { /// diff --git a/EgwCoreLib.Lux.Data/EgwCoreLib.Lux.Data.csproj b/EgwCoreLib.Lux.Data/EgwCoreLib.Lux.Data.csproj index c3d746d3..74a1610f 100644 --- a/EgwCoreLib.Lux.Data/EgwCoreLib.Lux.Data.csproj +++ b/EgwCoreLib.Lux.Data/EgwCoreLib.Lux.Data.csproj @@ -17,6 +17,7 @@ + @@ -26,6 +27,7 @@ + @@ -40,7 +42,7 @@ - + @@ -48,6 +50,7 @@ + diff --git a/EgwCoreLib.Lux.Data/Migrations/20250808143628_InitDb.Designer.cs b/EgwCoreLib.Lux.Data/Migrations/20250808143628_InitDb.Designer.cs deleted file mode 100644 index 4f00571f..00000000 --- a/EgwCoreLib.Lux.Data/Migrations/20250808143628_InitDb.Designer.cs +++ /dev/null @@ -1,1973 +0,0 @@ -// -using System; -using EgwCoreLib.Lux.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace EgwCoreLib.Lux.Data.Migrations -{ - [DbContext(typeof(DataLayerContext))] - [Migration("20250808143628_InitDb")] - partial class InitDb - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.17") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.CounterModel", b => - { - b.Property("RefYear") - .HasColumnType("int"); - - b.Property("CountName") - .HasColumnType("varchar(255)"); - - b.Property("Counter") - .HasColumnType("int"); - - b.HasKey("RefYear", "CountName"); - - b.ToTable("Counter"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.CustomerModel", b => - { - b.Property("CustomerID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CustomerID")); - - b.Property("CompanyName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FirstName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("VAT") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("CustomerID"); - - b.ToTable("RegCustomer"); - - b.HasData( - new - { - CustomerID = 1, - CompanyName = "", - FirstName = "Customer A", - LastName = "Egalware", - VAT = "1234567890123456" - }, - new - { - CustomerID = 2, - CompanyName = "", - FirstName = "Customer B", - LastName = "User", - VAT = "1234567890123456" - }, - new - { - CustomerID = 3, - CompanyName = "", - FirstName = "Customer C", - LastName = "User Test", - VAT = "1234567890123456" - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.DealerModel", b => - { - b.Property("DealerID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("DealerID")); - - b.Property("CompanyName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FirstName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("VAT") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("DealerID"); - - b.ToTable("RegDealer"); - - b.HasData( - new - { - DealerID = 1, - CompanyName = "Company First", - FirstName = "Dealer A", - LastName = "Egalware", - VAT = "9587362514671527" - }, - new - { - DealerID = 2, - CompanyName = "Company First", - FirstName = "Dealer B", - LastName = "User", - VAT = "9587362514671527" - }, - new - { - DealerID = 3, - CompanyName = "Company Second", - FirstName = "Dealer C", - LastName = "User Test", - VAT = "9587362514671527" - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ItemGroupModel", b => - { - b.Property("CodGroup") - .HasColumnType("varchar(255)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("CodGroup"); - - b.ToTable("RegItemGroup"); - - b.HasData( - new - { - CodGroup = "WindowTrunk", - Description = "Barre legno per lavorazione" - }, - new - { - CodGroup = "WindowGlass", - Description = "Vetri serramento" - }, - new - { - CodGroup = "WindowVarnish", - Description = "Vernici per legno" - }, - new - { - CodGroup = "WindowHardware", - Description = "Ferramenta serramento" - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ItemModel", b => - { - b.Property("ItemID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ItemID")); - - b.Property("CodGroup") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.Property("Cost") - .HasColumnType("double"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ExtItemCode") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsService") - .HasColumnType("tinyint(1)"); - - b.Property("ItemCode") - .HasColumnType("int"); - - b.Property("ItemType") - .HasColumnType("int"); - - b.Property("Margin") - .HasColumnType("double"); - - b.Property("QtyMax") - .HasColumnType("double"); - - b.Property("QtyMin") - .HasColumnType("double"); - - b.Property("SupplCode") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("UM") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("ItemID"); - - b.HasIndex("CodGroup"); - - b.ToTable("RegItem"); - - b.HasData( - new - { - ItemID = 1, - CodGroup = "WindowTrunk", - Cost = 20.0, - Description = "BARRA-60x80 generica", - ExtItemCode = "", - IsService = false, - ItemCode = 1001, - ItemType = 1, - Margin = 0.29999999999999999, - QtyMax = 0.0, - QtyMin = 0.0, - SupplCode = "BARR.001", - UM = "#" - }, - new - { - ItemID = 2, - CodGroup = "WindowTrunk", - Cost = 16.5, - Description = "Barra 60x80, lunghezza 12m", - ExtItemCode = "BARRA-60x80x12000", - IsService = false, - ItemCode = 1002, - ItemType = 1, - Margin = 0.20999999999999999, - QtyMax = 0.0, - QtyMin = 0.0, - SupplCode = "ABC.00123.12000", - UM = "#" - }, - new - { - ItemID = 3, - CodGroup = "WindowTrunk", - Cost = 17.5, - Description = "Barra 60x80, lunghezza 8m", - ExtItemCode = "BARRA-60x80x8000", - IsService = false, - ItemCode = 1003, - ItemType = 1, - Margin = 0.22, - QtyMax = 0.0, - QtyMin = 0.0, - SupplCode = "ABC.00123.8000", - UM = "#" - }, - new - { - ItemID = 4, - CodGroup = "WindowTrunk", - Cost = 15.5, - Description = "Barra 60x80, lunghezza 16m", - ExtItemCode = "BARRA-60x80x16000", - IsService = false, - ItemCode = 1004, - ItemType = 1, - Margin = 0.20000000000000001, - QtyMax = 0.0, - QtyMin = 0.0, - SupplCode = "ABC.00123.16000", - UM = "#" - }, - new - { - ItemID = 5, - CodGroup = "WindowGlass", - Cost = 300.0, - Description = "Vetro triplo, basso indice termico, 800x1000", - ExtItemCode = "VETRO-3L-THERMO-800x1000", - IsService = false, - ItemCode = 2001, - ItemType = 1, - Margin = 0.20000000000000001, - QtyMax = 0.0, - QtyMin = 0.0, - SupplCode = "V3T.800.1000", - UM = "m2" - }, - new - { - ItemID = 6, - CodGroup = "WindowGlass", - Cost = 200.0, - Description = "Vetro doppio, 800x1000", - ExtItemCode = "VETRO-2L-800x1000", - IsService = false, - ItemCode = 2002, - ItemType = 1, - Margin = 0.14999999999999999, - QtyMax = 0.0, - QtyMin = 0.0, - SupplCode = "V2.800.1000", - UM = "m2" - }, - new - { - ItemID = 7, - CodGroup = "WindowGlass", - Cost = 250.0, - Description = "Vetro triplo, 800x1000", - ExtItemCode = "VETRO-3L-800x1000", - IsService = false, - ItemCode = 2003, - ItemType = 1, - Margin = 0.17999999999999999, - QtyMax = 0.0, - QtyMin = 0.0, - SupplCode = "V3.800.1000", - UM = "m2" - }, - new - { - ItemID = 8, - CodGroup = "WindowVarnish", - Cost = 20.0, - Description = "Vernice trasparente", - ExtItemCode = "VERN-TRASP", - IsService = false, - ItemCode = 3001, - ItemType = 1, - Margin = 0.20000000000000001, - QtyMax = 0.0, - QtyMin = 0.0, - SupplCode = "VT.STD", - UM = "l" - }, - new - { - ItemID = 9, - CodGroup = "WindowHardware", - Cost = 65.0, - Description = "Kit standard completo AGB tipo 001", - ExtItemCode = "KIT-001", - IsService = false, - ItemCode = 5001, - ItemType = 1, - Margin = 0.20000000000000001, - QtyMax = 0.0, - QtyMin = 0.0, - SupplCode = "AGB-KIT-001", - UM = "#" - }, - new - { - ItemID = 10, - CodGroup = "WindowHardware", - Cost = 10.0, - Description = "Cerniera AGB tipo 001", - ExtItemCode = "CERN-001", - IsService = false, - ItemCode = 5002, - ItemType = 1, - Margin = 0.20000000000000001, - QtyMax = 0.0, - QtyMin = 0.0, - SupplCode = "AGB-CERN-001", - UM = "#" - }, - new - { - ItemID = 11, - CodGroup = "WindowHardware", - Cost = 15.0, - Description = "Serratura AGB tipo 001", - ExtItemCode = "SERR-001", - IsService = false, - ItemCode = 5003, - ItemType = 1, - Margin = 0.20000000000000001, - QtyMax = 0.0, - QtyMin = 0.0, - SupplCode = "AGB-SERR-001", - UM = "#" - }, - new - { - ItemID = 12, - CodGroup = "WindowHardware", - Cost = 25.0, - Description = "Maniglia AGB tipo 001", - ExtItemCode = "MAN-001", - IsService = false, - ItemCode = 5004, - ItemType = 1, - Margin = 0.20000000000000001, - QtyMax = 0.0, - QtyMin = 0.0, - SupplCode = "AGB-MAN-001", - UM = "#" - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.JobModel", b => - { - b.Property("JobID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobID")); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("JobID"); - - b.ToTable("JobList"); - - b.HasData( - new - { - JobID = 1, - Description = "Rivendita / servizi" - }, - new - { - JobID = 2, - Description = "Serramento Completo Legno su linea Saomad e installatore interno" - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.JobRowItemModel", b => - { - b.Property("JobRowItemID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobRowItemID")); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Index") - .HasColumnType("int"); - - b.Property("ItemID") - .HasColumnType("int"); - - b.Property("JobRowID") - .HasColumnType("int"); - - b.Property("Qty") - .HasColumnType("double"); - - b.HasKey("JobRowItemID"); - - b.HasIndex("ItemID"); - - b.HasIndex("JobRowID"); - - b.ToTable("JobRowItemList"); - - b.HasData( - new - { - JobRowItemID = 1, - Description = "Grezzo legno abete", - Index = 1, - ItemID = 1, - JobRowID = 1, - Qty = 1.0 - }, - new - { - JobRowItemID = 2, - Description = "Vernice trasparente standard 1L", - Index = 2, - ItemID = 8, - JobRowID = 3, - Qty = 0.10000000000000001 - }, - new - { - JobRowItemID = 3, - Description = "Ferramenta AGB - rif. AGFD.00000.00000", - Index = 3, - ItemID = 9, - JobRowID = 4, - Qty = 1.0 - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.JobRowModel", b => - { - b.Property("JobRowID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobRowID")); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Index") - .HasColumnType("int"); - - b.Property("JobID") - .HasColumnType("int"); - - b.Property("PhaseID") - .HasColumnType("int"); - - b.Property("Qty") - .HasColumnType("double"); - - b.Property("ResourceID") - .HasColumnType("int"); - - b.HasKey("JobRowID"); - - b.HasIndex("JobID"); - - b.HasIndex("PhaseID"); - - b.HasIndex("ResourceID"); - - b.ToTable("JobRowList"); - - b.HasData( - new - { - JobRowID = 1, - Description = "", - Index = 1, - JobID = 2, - PhaseID = 1, - Qty = 1.0, - ResourceID = 1 - }, - new - { - JobRowID = 2, - Description = "", - Index = 2, - JobID = 2, - PhaseID = 2, - Qty = 1.0, - ResourceID = 2 - }, - new - { - JobRowID = 3, - Description = "", - Index = 3, - JobID = 2, - PhaseID = 3, - Qty = 1.0, - ResourceID = 4 - }, - new - { - JobRowID = 4, - Description = "", - Index = 4, - JobID = 2, - PhaseID = 4, - Qty = 1.0, - ResourceID = 6 - }, - new - { - JobRowID = 5, - Description = "", - Index = 5, - JobID = 2, - PhaseID = 6, - Qty = 1.0, - ResourceID = 7 - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.MovTypeModel", b => - { - b.Property("MovCod") - .HasColumnType("varchar(255)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("MovCod"); - - b.ToTable("RegMovType"); - - b.HasData( - new - { - MovCod = "CAR", - Description = "Carico a magazzino" - }, - new - { - MovCod = "MOV", - Description = "Movimento interno (spostamento)" - }, - new - { - MovCod = "ND", - Description = "Non Definito" - }, - new - { - MovCod = "OFOR", - Description = "Ordine Fornitore" - }, - new - { - MovCod = "RETT", - Description = "Rettifica magazzino" - }, - new - { - MovCod = "SCAR", - Description = "Scarico da magazzino" - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OfferModel", b => - { - b.Property("OfferID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OfferID")); - - b.Property("CustomerID") - .HasColumnType("int"); - - b.Property("DealerID") - .HasColumnType("int"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Inserted") - .HasColumnType("datetime(6)"); - - b.Property("Modified") - .HasColumnType("datetime(6)"); - - b.Property("OffertState") - .HasColumnType("int"); - - b.Property("RefNum") - .HasColumnType("int"); - - b.Property("RefRev") - .HasColumnType("int"); - - b.Property("RefYear") - .HasColumnType("int"); - - b.Property("ValidUntil") - .HasColumnType("datetime(6)"); - - b.HasKey("OfferID"); - - b.HasIndex("CustomerID"); - - b.HasIndex("DealerID"); - - b.ToTable("Offer"); - - b.HasData( - new - { - OfferID = 1, - CustomerID = 2, - DealerID = 2, - Description = "Offerta per tre serramenti", - Inserted = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4215), - Modified = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4216), - OffertState = 0, - RefNum = 1, - RefRev = 1, - RefYear = 2024, - ValidUntil = new DateTime(2025, 9, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4212) - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OfferRowModel", b => - { - b.Property("OfferRowID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OfferRowID")); - - b.Property("BomOk") - .HasColumnType("tinyint(1)"); - - b.Property("Cost") - .HasColumnType("double"); - - b.Property("Environment") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Inserted") - .HasColumnType("datetime(6)"); - - b.Property("ItemBOM") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ItemOk") - .HasColumnType("tinyint(1)"); - - b.Property("ItemSPP") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Modified") - .HasColumnType("datetime(6)"); - - b.Property("Note") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("OfferID") - .HasColumnType("int"); - - b.Property("OfferRowUID") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Qty") - .HasColumnType("double"); - - b.Property("RowNum") - .HasColumnType("int"); - - b.Property("SellingItemID") - .HasColumnType("int"); - - b.Property("SerStruct") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("OfferRowID"); - - b.HasIndex("OfferID"); - - b.HasIndex("SellingItemID"); - - b.ToTable("OfferRowList"); - - b.HasData( - new - { - OfferRowID = 1, - BomOk = true, - Cost = 950.0, - Environment = "WINDOW", - Inserted = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4243), - ItemBOM = "", - ItemOk = true, - ItemSPP = "{}", - Modified = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4245), - Note = "Finestra anta singola 2025", - OfferID = 1, - OfferRowUID = "OFF0000000001", - Qty = 3.0, - RowNum = 1, - SellingItemID = 1, - SerStruct = "{}" - }, - new - { - OfferRowID = 2, - BomOk = true, - Cost = 160.0, - Environment = "WINDOW", - Inserted = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4252), - ItemBOM = "", - ItemOk = true, - ItemSPP = "{}", - Modified = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4253), - Note = "Persiana per Finestra anta singola 2025", - OfferID = 1, - OfferRowUID = "OFF0000000002", - Qty = 3.0, - RowNum = 2, - SellingItemID = 2, - SerStruct = "{}" - }, - new - { - OfferRowID = 3, - BomOk = true, - Cost = 200.0, - Environment = "WINDOW", - Inserted = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4259), - ItemBOM = "", - ItemOk = true, - ItemSPP = "{}", - Modified = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4261), - Note = "Installazione serramento", - OfferID = 1, - OfferRowUID = "OFF0000000003", - Qty = 3.0, - RowNum = 3, - SellingItemID = 3, - SerStruct = "{}" - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OrderModel", b => - { - b.Property("OrderID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OrderID")); - - b.Property("CustomerID") - .HasColumnType("int"); - - b.Property("DealerID") - .HasColumnType("int"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Inserted") - .HasColumnType("datetime(6)"); - - b.Property("Modified") - .HasColumnType("datetime(6)"); - - b.Property("OfferID") - .HasColumnType("int"); - - b.Property("OffertState") - .HasColumnType("int"); - - b.Property("RefNum") - .HasColumnType("int"); - - b.Property("RefRev") - .HasColumnType("int"); - - b.Property("RefYear") - .HasColumnType("int"); - - b.Property("ValidUntil") - .HasColumnType("datetime(6)"); - - b.HasKey("OrderID"); - - b.HasIndex("CustomerID"); - - b.HasIndex("DealerID"); - - b.HasIndex("OfferID"); - - b.ToTable("Order"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OrderRowModel", b => - { - b.Property("OrderRowID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OrderRowID")); - - b.Property("Cost") - .HasColumnType("double"); - - b.Property("Inserted") - .HasColumnType("datetime(6)"); - - b.Property("ItemSPP") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Modified") - .HasColumnType("datetime(6)"); - - b.Property("Note") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("OrderID") - .HasColumnType("int"); - - b.Property("Qty") - .HasColumnType("double"); - - b.Property("RowNum") - .HasColumnType("int"); - - b.Property("SellingItemID") - .HasColumnType("int"); - - b.Property("SerStruct") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("OrderRowID"); - - b.HasIndex("OrderID"); - - b.HasIndex("SellingItemID"); - - b.ToTable("OrderRowList"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.PhaseModel", b => - { - b.Property("PhaseID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PhaseID")); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("PhaseID"); - - b.ToTable("RegPhase"); - - b.HasData( - new - { - PhaseID = 1, - Description = "Taglio tronchetti" - }, - new - { - PhaseID = 2, - Description = "Lavorazione pezzi serramento" - }, - new - { - PhaseID = 3, - Description = "Verniciatura" - }, - new - { - PhaseID = 4, - Description = "Assemblaggio completo" - }, - new - { - PhaseID = 5, - Description = "Assemblaggio Ferramenta" - }, - new - { - PhaseID = 6, - Description = "Installazione e posa in opera" - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ProductionBatchModel", b => - { - b.Property("ProductionBatchID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProductionBatchID")); - - b.Property("DateEnd") - .HasColumnType("datetime(6)"); - - b.Property("DateStart") - .HasColumnType("datetime(6)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("DueDate") - .HasColumnType("datetime(6)"); - - b.HasKey("ProductionBatchID"); - - b.ToTable("ProductionBatch"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ProductionItemModel", b => - { - b.Property("ProdItemID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProdItemID")); - - b.Property("ExtItemCode") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ItemCode") - .HasColumnType("int"); - - b.Property("OrderRowID") - .HasColumnType("int"); - - b.Property("ProductionBatchID") - .HasColumnType("int"); - - b.HasKey("ProdItemID"); - - b.HasIndex("OrderRowID"); - - b.HasIndex("ProductionBatchID"); - - b.ToTable("ProductionItem"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ProductionItemRowModel", b => - { - b.Property("ProdItemRowID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProdItemRowID")); - - b.Property("DateEnd") - .HasColumnType("datetime(6)"); - - b.Property("DateStart") - .HasColumnType("datetime(6)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Index") - .HasColumnType("int"); - - b.Property("PhaseID") - .HasColumnType("int"); - - b.Property("ProdItemID") - .HasColumnType("int"); - - b.Property("Qty") - .HasColumnType("double"); - - b.Property("ResourceID") - .HasColumnType("int"); - - b.Property("WorkTime") - .HasColumnType("double"); - - b.HasKey("ProdItemRowID"); - - b.HasIndex("PhaseID"); - - b.HasIndex("ProdItemID"); - - b.HasIndex("ResourceID"); - - b.ToTable("ProductionItemRowList"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ResourceModel", b => - { - b.Property("ResourceID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ResourceID")); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsAsset") - .HasColumnType("tinyint(1)"); - - b.Property("IsHuman") - .HasColumnType("tinyint(1)"); - - b.Property("UmFix") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("UmProp") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("UnitCostFix") - .HasColumnType("double"); - - b.Property("UnitCostProp") - .HasColumnType("double"); - - b.HasKey("ResourceID"); - - b.ToTable("RegResource"); - - b.HasData( - new - { - ResourceID = 1, - Description = "Sezionatrice", - IsAsset = true, - IsHuman = false, - UmFix = "€/h", - UmProp = "", - UnitCostFix = 15.0, - UnitCostProp = 0.0 - }, - new - { - ResourceID = 2, - Description = "Linea SAOMAD WoodPecker Just 3500", - IsAsset = true, - IsHuman = false, - UmFix = "€/h", - UmProp = "€/m", - UnitCostFix = 240.0, - UnitCostProp = 1.8999999999999999 - }, - new - { - ResourceID = 3, - Description = "Linea Pantografo", - IsAsset = true, - IsHuman = false, - UmFix = "€/h", - UmProp = "€/m", - UnitCostFix = 90.0, - UnitCostProp = 5.9000000000000004 - }, - new - { - ResourceID = 4, - Description = "Stazione Verniciatura", - IsAsset = true, - IsHuman = false, - UmFix = "€/h", - UmProp = "€/m", - UnitCostFix = 40.0, - UnitCostProp = 1.8999999999999999 - }, - new - { - ResourceID = 5, - Description = "Verniciatura Manuale", - IsAsset = false, - IsHuman = true, - UmFix = "€/h", - UmProp = "€/m", - UnitCostFix = 10.0, - UnitCostProp = 1.8999999999999999 - }, - new - { - ResourceID = 6, - Description = "Montaggio Manuale", - IsAsset = false, - IsHuman = true, - UmFix = "", - UmProp = "€/h", - UnitCostFix = 0.0, - UnitCostProp = 40.0 - }, - new - { - ResourceID = 7, - Description = "Installatore", - IsAsset = false, - IsHuman = true, - UmFix = "", - UmProp = "€/h", - UnitCostFix = 0.0, - UnitCostProp = 40.0 - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.SellingItemModel", b => - { - b.Property("SellingItemID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SellingItemID")); - - b.Property("Cost") - .HasColumnType("double"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ExtItemCode") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsService") - .HasColumnType("tinyint(1)"); - - b.Property("ItemCode") - .HasColumnType("int"); - - b.Property("ItemSPP") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("JobID") - .HasColumnType("int"); - - b.Property("Margin") - .HasColumnType("double"); - - b.Property("SerStruct") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("SupplCode") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("UM") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("SellingItemID"); - - b.HasIndex("JobID"); - - b.ToTable("SellingItem"); - - b.HasData( - new - { - SellingItemID = 1, - Cost = 820.0, - Description = "Finestra anta Singola", - ExtItemCode = "", - IsService = false, - ItemCode = 0, - ItemSPP = "", - JobID = 2, - Margin = 0.20000000000000001, - SerStruct = "", - SupplCode = "", - UM = "#" - }, - new - { - SellingItemID = 2, - Cost = 150.0, - Description = "Persiana anta singola", - ExtItemCode = "", - IsService = false, - ItemCode = 0, - ItemSPP = "", - JobID = 1, - Margin = 0.10000000000000001, - SerStruct = "", - SupplCode = "", - UM = "#" - }, - new - { - SellingItemID = 3, - Cost = 200.0, - Description = "Installazione", - ExtItemCode = "", - IsService = true, - ItemCode = 0, - ItemSPP = "", - JobID = 1, - Margin = 0.29999999999999999, - SerStruct = "", - SupplCode = "", - UM = "#" - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.StockMovModel", b => - { - b.Property("StockMovID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("StockMovID")); - - b.Property("CodDoc") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("DtCreate") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp") - .HasDefaultValueSql("CURRENT_TIMESTAMP"); - - b.Property("DtMod") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("timestamp") - .HasDefaultValueSql("CURRENT_TIMESTAMP"); - - MySqlPropertyBuilderExtensions.UseMySqlComputedColumn(b.Property("DtMod")); - - b.Property("MovCod") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.Property("Note") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("QtyRec") - .HasColumnType("double"); - - b.Property("StockStatusId") - .HasColumnType("int"); - - b.Property("UnitVal") - .HasColumnType("double"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("StockMovID"); - - b.HasIndex("MovCod"); - - b.HasIndex("StockStatusId"); - - b.ToTable("StockMov"); - - b.HasData( - new - { - StockMovID = 1, - CodDoc = "", - DtCreate = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(3939), - DtMod = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(3987), - MovCod = "CAR", - Note = "DEMO", - QtyRec = 5.0, - StockStatusId = 1, - UnitVal = 0.0, - UserId = "samuele.locatelli@egalware.com" - }, - new - { - StockMovID = 2, - CodDoc = "", - DtCreate = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(3989), - DtMod = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(3991), - MovCod = "CAR", - Note = "DEMO", - QtyRec = 8.0, - StockStatusId = 2, - UnitVal = 0.0, - UserId = "samuele.locatelli@egalware.com" - }, - new - { - StockMovID = 3, - CodDoc = "", - DtCreate = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(3993), - DtMod = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(3995), - MovCod = "CAR", - Note = "DEMO", - QtyRec = 5.0, - StockStatusId = 3, - UnitVal = 0.0, - UserId = "samuele.locatelli@egalware.com" - }, - new - { - StockMovID = 4, - CodDoc = "", - DtCreate = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(3997), - DtMod = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(3998), - MovCod = "CAR", - Note = "DEMO", - QtyRec = 1.0, - StockStatusId = 4, - UnitVal = 0.0, - UserId = "samuele.locatelli@egalware.com" - }, - new - { - StockMovID = 5, - CodDoc = "", - DtCreate = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4000), - DtMod = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4002), - MovCod = "CAR", - Note = "DEMO", - QtyRec = 10.0, - StockStatusId = 5, - UnitVal = 0.0, - UserId = "samuele.locatelli@egalware.com" - }, - new - { - StockMovID = 6, - CodDoc = "", - DtCreate = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4004), - DtMod = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4006), - MovCod = "CAR", - Note = "DEMO", - QtyRec = 1.0, - StockStatusId = 6, - UnitVal = 0.0, - UserId = "samuele.locatelli@egalware.com" - }, - new - { - StockMovID = 7, - CodDoc = "", - DtCreate = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4008), - DtMod = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4009), - MovCod = "CAR", - Note = "DEMO", - QtyRec = 50.0, - StockStatusId = 7, - UnitVal = 0.0, - UserId = "samuele.locatelli@egalware.com" - }, - new - { - StockMovID = 8, - CodDoc = "", - DtCreate = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4011), - DtMod = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4013), - MovCod = "CAR", - Note = "DEMO", - QtyRec = 1.0, - StockStatusId = 8, - UnitVal = 0.0, - UserId = "samuele.locatelli@egalware.com" - }, - new - { - StockMovID = 9, - CodDoc = "", - DtCreate = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4015), - DtMod = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4017), - MovCod = "CAR", - Note = "DEMO", - QtyRec = 1.0, - StockStatusId = 9, - UnitVal = 0.0, - UserId = "samuele.locatelli@egalware.com" - }, - new - { - StockMovID = 10, - CodDoc = "", - DtCreate = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4019), - DtMod = new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4020), - MovCod = "CAR", - Note = "DEMO", - QtyRec = 1.0, - StockStatusId = 10, - UnitVal = 0.0, - UserId = "samuele.locatelli@egalware.com" - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.StockStatusModel", b => - { - b.Property("StockStatusId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("StockStatusId")); - - b.Property("IsDeleted") - .HasColumnType("tinyint(1)"); - - b.Property("IsRemn") - .HasColumnType("tinyint(1)"); - - b.Property("ItemID") - .HasColumnType("int"); - - b.Property("Location") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("QtyAvail") - .HasColumnType("double"); - - b.HasKey("StockStatusId"); - - b.HasIndex("ItemID"); - - b.ToTable("StockStatus"); - - b.HasData( - new - { - StockStatusId = 1, - IsDeleted = false, - IsRemn = false, - ItemID = 1, - Location = "B001-001-003", - QtyAvail = 5.0 - }, - new - { - StockStatusId = 2, - IsDeleted = false, - IsRemn = false, - ItemID = 2, - Location = "B001-001-002", - QtyAvail = 8.0 - }, - new - { - StockStatusId = 3, - IsDeleted = false, - IsRemn = false, - ItemID = 3, - Location = "B001-001-001", - QtyAvail = 5.0 - }, - new - { - StockStatusId = 4, - IsDeleted = false, - IsRemn = false, - ItemID = 4, - Location = "V002-001-001", - QtyAvail = 1.0 - }, - new - { - StockStatusId = 5, - IsDeleted = false, - IsRemn = false, - ItemID = 5, - Location = "V001-001-002", - QtyAvail = 10.0 - }, - new - { - StockStatusId = 6, - IsDeleted = false, - IsRemn = false, - ItemID = 6, - Location = "V001-001-003", - QtyAvail = 1.0 - }, - new - { - StockStatusId = 7, - IsDeleted = false, - IsRemn = false, - ItemID = 8, - Location = "V001-001-003", - QtyAvail = 50.0 - }, - new - { - StockStatusId = 8, - IsDeleted = false, - IsRemn = false, - ItemID = 11, - Location = "S001-002-001", - QtyAvail = 1.0 - }, - new - { - StockStatusId = 9, - IsDeleted = false, - IsRemn = false, - ItemID = 9, - Location = "S001-002-001", - QtyAvail = 1.0 - }, - new - { - StockStatusId = 10, - IsDeleted = false, - IsRemn = false, - ItemID = 10, - Location = "S001-001-001", - QtyAvail = 1.0 - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.SupplierModel", b => - { - b.Property("SupplierID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SupplierID")); - - b.Property("CompanyName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("FirstName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("VAT") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("SupplierID"); - - b.ToTable("RegSupplier"); - - b.HasData( - new - { - SupplierID = 1, - CompanyName = "Company One", - FirstName = "Supplier A", - LastName = "Egalware", - VAT = "7294857103879254" - }, - new - { - SupplierID = 2, - CompanyName = "Company Two", - FirstName = "Supplier B", - LastName = "User", - VAT = "7294857103879254" - }, - new - { - SupplierID = 3, - CompanyName = "Company Two", - FirstName = "Supplier C", - LastName = "User Test", - VAT = "7294857103879254" - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.TagsModel", b => - { - b.Property("TagID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("TagID")); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("TagID"); - - b.ToTable("RegTags"); - - b.HasData( - new - { - TagID = 1, - Description = "Tag 01" - }, - new - { - TagID = 2, - Description = "Tag 02" - }, - new - { - TagID = 3, - Description = "Tag 03" - }, - new - { - TagID = 4, - Description = "Tag 04" - }, - new - { - TagID = 5, - Description = "Tag 05" - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ItemModel", b => - { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.ItemGroupModel", "ItemGroupNav") - .WithMany() - .HasForeignKey("CodGroup") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("ItemGroupNav"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.JobRowItemModel", b => - { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.ItemModel", "ItemNav") - .WithMany() - .HasForeignKey("ItemID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.JobRowModel", "JobRowNav") - .WithMany() - .HasForeignKey("JobRowID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("ItemNav"); - - b.Navigation("JobRowNav"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.JobRowModel", b => - { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.JobModel", "JobNav") - .WithMany() - .HasForeignKey("JobID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.PhaseModel", "PhaseNav") - .WithMany() - .HasForeignKey("PhaseID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.ResourceModel", "ResourceNav") - .WithMany() - .HasForeignKey("ResourceID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("JobNav"); - - b.Navigation("PhaseNav"); - - b.Navigation("ResourceNav"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OfferModel", b => - { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.CustomerModel", "CustomerNav") - .WithMany() - .HasForeignKey("CustomerID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.DealerModel", "DealerNav") - .WithMany() - .HasForeignKey("DealerID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CustomerNav"); - - b.Navigation("DealerNav"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OfferRowModel", b => - { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.OfferModel", "OfferNav") - .WithMany("OfferRowNav") - .HasForeignKey("OfferID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.SellingItemModel", "SellingItemNav") - .WithMany() - .HasForeignKey("SellingItemID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("OfferNav"); - - b.Navigation("SellingItemNav"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OrderModel", b => - { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.CustomerModel", "CustomerNav") - .WithMany() - .HasForeignKey("CustomerID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.DealerModel", "DealerNav") - .WithMany() - .HasForeignKey("DealerID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.OfferModel", "OfferNav") - .WithMany() - .HasForeignKey("OfferID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CustomerNav"); - - b.Navigation("DealerNav"); - - b.Navigation("OfferNav"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OrderRowModel", b => - { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.OrderModel", "OrderNav") - .WithMany() - .HasForeignKey("OrderID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.SellingItemModel", "SellingItemNav") - .WithMany() - .HasForeignKey("SellingItemID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("OrderNav"); - - b.Navigation("SellingItemNav"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ProductionItemModel", b => - { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.OrderRowModel", "OrderRowNav") - .WithMany() - .HasForeignKey("OrderRowID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.ProductionBatchModel", "ProductionBatchNav") - .WithMany() - .HasForeignKey("ProductionBatchID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("OrderRowNav"); - - b.Navigation("ProductionBatchNav"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ProductionItemRowModel", b => - { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.PhaseModel", "PhaseNav") - .WithMany() - .HasForeignKey("PhaseID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.ProductionItemModel", "ProdItemNav") - .WithMany() - .HasForeignKey("ProdItemID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.ResourceModel", "ResourceNav") - .WithMany() - .HasForeignKey("ResourceID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("PhaseNav"); - - b.Navigation("ProdItemNav"); - - b.Navigation("ResourceNav"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.SellingItemModel", b => - { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.JobModel", "JobNav") - .WithMany() - .HasForeignKey("JobID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("JobNav"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.StockMovModel", b => - { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.MovTypeModel", "MovTypeNav") - .WithMany() - .HasForeignKey("MovCod") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.StockStatusModel", "StockStatusNav") - .WithMany() - .HasForeignKey("StockStatusId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("MovTypeNav"); - - b.Navigation("StockStatusNav"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.StockStatusModel", b => - { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.ItemModel", "ItemNav") - .WithMany() - .HasForeignKey("ItemID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("ItemNav"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OfferModel", b => - { - b.Navigation("OfferRowNav"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/EgwCoreLib.Lux.Data/Migrations/20250808143628_InitDb.cs b/EgwCoreLib.Lux.Data/Migrations/20250808143628_InitDb.cs deleted file mode 100644 index c5cb7536..00000000 --- a/EgwCoreLib.Lux.Data/Migrations/20250808143628_InitDb.cs +++ /dev/null @@ -1,1049 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional - -namespace EgwCoreLib.Lux.Data.Migrations -{ - /// - public partial class InitDb : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterDatabase() - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "Counter", - columns: table => new - { - RefYear = table.Column(type: "int", nullable: false), - CountName = table.Column(type: "varchar(255)", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - Counter = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Counter", x => new { x.RefYear, x.CountName }); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "JobList", - columns: table => new - { - JobID = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Description = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4") - }, - constraints: table => - { - table.PrimaryKey("PK_JobList", x => x.JobID); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "ProductionBatch", - columns: table => new - { - ProductionBatchID = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Description = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - DueDate = table.Column(type: "datetime(6)", nullable: false), - DateStart = table.Column(type: "datetime(6)", nullable: true), - DateEnd = table.Column(type: "datetime(6)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_ProductionBatch", x => x.ProductionBatchID); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "RegCustomer", - columns: table => new - { - CustomerID = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - CompanyName = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - FirstName = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - LastName = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - VAT = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4") - }, - constraints: table => - { - table.PrimaryKey("PK_RegCustomer", x => x.CustomerID); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "RegDealer", - columns: table => new - { - DealerID = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - CompanyName = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - FirstName = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - LastName = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - VAT = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4") - }, - constraints: table => - { - table.PrimaryKey("PK_RegDealer", x => x.DealerID); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "RegItemGroup", - columns: table => new - { - CodGroup = table.Column(type: "varchar(255)", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - Description = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4") - }, - constraints: table => - { - table.PrimaryKey("PK_RegItemGroup", x => x.CodGroup); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "RegMovType", - columns: table => new - { - MovCod = table.Column(type: "varchar(255)", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - Description = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4") - }, - constraints: table => - { - table.PrimaryKey("PK_RegMovType", x => x.MovCod); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "RegPhase", - columns: table => new - { - PhaseID = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Description = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4") - }, - constraints: table => - { - table.PrimaryKey("PK_RegPhase", x => x.PhaseID); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "RegResource", - columns: table => new - { - ResourceID = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Description = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - IsAsset = table.Column(type: "tinyint(1)", nullable: false), - IsHuman = table.Column(type: "tinyint(1)", nullable: false), - UnitCostFix = table.Column(type: "double", nullable: false), - UmFix = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - UnitCostProp = table.Column(type: "double", nullable: false), - UmProp = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4") - }, - constraints: table => - { - table.PrimaryKey("PK_RegResource", x => x.ResourceID); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "RegSupplier", - columns: table => new - { - SupplierID = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - CompanyName = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - FirstName = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - LastName = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - VAT = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4") - }, - constraints: table => - { - table.PrimaryKey("PK_RegSupplier", x => x.SupplierID); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "RegTags", - columns: table => new - { - TagID = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Description = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4") - }, - constraints: table => - { - table.PrimaryKey("PK_RegTags", x => x.TagID); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "SellingItem", - columns: table => new - { - SellingItemID = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - IsService = table.Column(type: "tinyint(1)", nullable: false), - JobID = table.Column(type: "int", nullable: false), - ItemCode = table.Column(type: "int", nullable: false), - ExtItemCode = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - SupplCode = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - Description = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - Cost = table.Column(type: "double", nullable: false), - Margin = table.Column(type: "double", nullable: false), - UM = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - SerStruct = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - ItemSPP = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4") - }, - constraints: table => - { - table.PrimaryKey("PK_SellingItem", x => x.SellingItemID); - table.ForeignKey( - name: "FK_SellingItem_JobList_JobID", - column: x => x.JobID, - principalTable: "JobList", - principalColumn: "JobID", - onDelete: ReferentialAction.Restrict); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "Offer", - columns: table => new - { - OfferID = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - RefYear = table.Column(type: "int", nullable: false), - RefNum = table.Column(type: "int", nullable: false), - RefRev = table.Column(type: "int", nullable: false), - Description = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - CustomerID = table.Column(type: "int", nullable: false), - DealerID = table.Column(type: "int", nullable: false), - ValidUntil = table.Column(type: "datetime(6)", nullable: false), - Inserted = table.Column(type: "datetime(6)", nullable: false), - Modified = table.Column(type: "datetime(6)", nullable: false), - OffertState = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Offer", x => x.OfferID); - table.ForeignKey( - name: "FK_Offer_RegCustomer_CustomerID", - column: x => x.CustomerID, - principalTable: "RegCustomer", - principalColumn: "CustomerID", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_Offer_RegDealer_DealerID", - column: x => x.DealerID, - principalTable: "RegDealer", - principalColumn: "DealerID", - onDelete: ReferentialAction.Restrict); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "RegItem", - columns: table => new - { - ItemID = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - CodGroup = table.Column(type: "varchar(255)", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - ItemType = table.Column(type: "int", nullable: false), - IsService = table.Column(type: "tinyint(1)", nullable: false), - ItemCode = table.Column(type: "int", nullable: false), - ExtItemCode = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - SupplCode = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - Description = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - Cost = table.Column(type: "double", nullable: false), - Margin = table.Column(type: "double", nullable: false), - QtyMin = table.Column(type: "double", nullable: false), - QtyMax = table.Column(type: "double", nullable: false), - UM = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4") - }, - constraints: table => - { - table.PrimaryKey("PK_RegItem", x => x.ItemID); - table.ForeignKey( - name: "FK_RegItem_RegItemGroup_CodGroup", - column: x => x.CodGroup, - principalTable: "RegItemGroup", - principalColumn: "CodGroup", - onDelete: ReferentialAction.Restrict); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "JobRowList", - columns: table => new - { - JobRowID = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - JobID = table.Column(type: "int", nullable: false), - Index = table.Column(type: "int", nullable: false), - PhaseID = table.Column(type: "int", nullable: false), - ResourceID = table.Column(type: "int", nullable: false), - Description = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - Qty = table.Column(type: "double", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_JobRowList", x => x.JobRowID); - table.ForeignKey( - name: "FK_JobRowList_JobList_JobID", - column: x => x.JobID, - principalTable: "JobList", - principalColumn: "JobID", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_JobRowList_RegPhase_PhaseID", - column: x => x.PhaseID, - principalTable: "RegPhase", - principalColumn: "PhaseID", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_JobRowList_RegResource_ResourceID", - column: x => x.ResourceID, - principalTable: "RegResource", - principalColumn: "ResourceID", - onDelete: ReferentialAction.Restrict); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "OfferRowList", - columns: table => new - { - OfferRowID = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - OfferID = table.Column(type: "int", nullable: false), - RowNum = table.Column(type: "int", nullable: false), - Environment = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - OfferRowUID = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - SellingItemID = table.Column(type: "int", nullable: false), - Cost = table.Column(type: "double", nullable: false), - Qty = table.Column(type: "double", nullable: false), - SerStruct = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - ItemSPP = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - ItemBOM = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - BomOk = table.Column(type: "tinyint(1)", nullable: false), - ItemOk = table.Column(type: "tinyint(1)", nullable: false), - Note = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - Inserted = table.Column(type: "datetime(6)", nullable: false), - Modified = table.Column(type: "datetime(6)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_OfferRowList", x => x.OfferRowID); - table.ForeignKey( - name: "FK_OfferRowList_Offer_OfferID", - column: x => x.OfferID, - principalTable: "Offer", - principalColumn: "OfferID", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_OfferRowList_SellingItem_SellingItemID", - column: x => x.SellingItemID, - principalTable: "SellingItem", - principalColumn: "SellingItemID", - onDelete: ReferentialAction.Restrict); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "Order", - columns: table => new - { - OrderID = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - OfferID = table.Column(type: "int", nullable: false), - RefYear = table.Column(type: "int", nullable: false), - RefNum = table.Column(type: "int", nullable: false), - RefRev = table.Column(type: "int", nullable: false), - Description = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - CustomerID = table.Column(type: "int", nullable: false), - DealerID = table.Column(type: "int", nullable: false), - ValidUntil = table.Column(type: "datetime(6)", nullable: false), - Inserted = table.Column(type: "datetime(6)", nullable: false), - Modified = table.Column(type: "datetime(6)", nullable: false), - OffertState = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Order", x => x.OrderID); - table.ForeignKey( - name: "FK_Order_Offer_OfferID", - column: x => x.OfferID, - principalTable: "Offer", - principalColumn: "OfferID", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_Order_RegCustomer_CustomerID", - column: x => x.CustomerID, - principalTable: "RegCustomer", - principalColumn: "CustomerID", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_Order_RegDealer_DealerID", - column: x => x.DealerID, - principalTable: "RegDealer", - principalColumn: "DealerID", - onDelete: ReferentialAction.Restrict); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "StockStatus", - columns: table => new - { - StockStatusId = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - ItemID = table.Column(type: "int", nullable: false), - QtyAvail = table.Column(type: "double", nullable: false), - IsDeleted = table.Column(type: "tinyint(1)", nullable: false), - IsRemn = table.Column(type: "tinyint(1)", nullable: false), - Location = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4") - }, - constraints: table => - { - table.PrimaryKey("PK_StockStatus", x => x.StockStatusId); - table.ForeignKey( - name: "FK_StockStatus_RegItem_ItemID", - column: x => x.ItemID, - principalTable: "RegItem", - principalColumn: "ItemID", - onDelete: ReferentialAction.Restrict); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "JobRowItemList", - columns: table => new - { - JobRowItemID = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - JobRowID = table.Column(type: "int", nullable: false), - Index = table.Column(type: "int", nullable: false), - ItemID = table.Column(type: "int", nullable: false), - Description = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - Qty = table.Column(type: "double", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_JobRowItemList", x => x.JobRowItemID); - table.ForeignKey( - name: "FK_JobRowItemList_JobRowList_JobRowID", - column: x => x.JobRowID, - principalTable: "JobRowList", - principalColumn: "JobRowID", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_JobRowItemList_RegItem_ItemID", - column: x => x.ItemID, - principalTable: "RegItem", - principalColumn: "ItemID", - onDelete: ReferentialAction.Restrict); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "OrderRowList", - columns: table => new - { - OrderRowID = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - OrderID = table.Column(type: "int", nullable: false), - RowNum = table.Column(type: "int", nullable: false), - SellingItemID = table.Column(type: "int", nullable: false), - Cost = table.Column(type: "double", nullable: false), - Qty = table.Column(type: "double", nullable: false), - SerStruct = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - ItemSPP = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - Note = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - Inserted = table.Column(type: "datetime(6)", nullable: false), - Modified = table.Column(type: "datetime(6)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_OrderRowList", x => x.OrderRowID); - table.ForeignKey( - name: "FK_OrderRowList_Order_OrderID", - column: x => x.OrderID, - principalTable: "Order", - principalColumn: "OrderID", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_OrderRowList_SellingItem_SellingItemID", - column: x => x.SellingItemID, - principalTable: "SellingItem", - principalColumn: "SellingItemID", - onDelete: ReferentialAction.Restrict); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "StockMov", - columns: table => new - { - StockMovID = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - StockStatusId = table.Column(type: "int", nullable: false), - DtCreate = table.Column(type: "timestamp", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), - DtMod = table.Column(type: "timestamp", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP") - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn), - QtyRec = table.Column(type: "double", nullable: false), - UnitVal = table.Column(type: "double", nullable: false), - UserId = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - MovCod = table.Column(type: "varchar(255)", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - CodDoc = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - Note = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4") - }, - constraints: table => - { - table.PrimaryKey("PK_StockMov", x => x.StockMovID); - table.ForeignKey( - name: "FK_StockMov_RegMovType_MovCod", - column: x => x.MovCod, - principalTable: "RegMovType", - principalColumn: "MovCod", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_StockMov_StockStatus_StockStatusId", - column: x => x.StockStatusId, - principalTable: "StockStatus", - principalColumn: "StockStatusId", - onDelete: ReferentialAction.Restrict); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "ProductionItem", - columns: table => new - { - ProdItemID = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - OrderRowID = table.Column(type: "int", nullable: false), - ItemCode = table.Column(type: "int", nullable: false), - ExtItemCode = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - ProductionBatchID = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ProductionItem", x => x.ProdItemID); - table.ForeignKey( - name: "FK_ProductionItem_OrderRowList_OrderRowID", - column: x => x.OrderRowID, - principalTable: "OrderRowList", - principalColumn: "OrderRowID", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_ProductionItem_ProductionBatch_ProductionBatchID", - column: x => x.ProductionBatchID, - principalTable: "ProductionBatch", - principalColumn: "ProductionBatchID", - onDelete: ReferentialAction.Restrict); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "ProductionItemRowList", - columns: table => new - { - ProdItemRowID = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - ProdItemID = table.Column(type: "int", nullable: false), - Index = table.Column(type: "int", nullable: false), - PhaseID = table.Column(type: "int", nullable: false), - ResourceID = table.Column(type: "int", nullable: false), - Description = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - Qty = table.Column(type: "double", nullable: false), - DateStart = table.Column(type: "datetime(6)", nullable: true), - DateEnd = table.Column(type: "datetime(6)", nullable: true), - WorkTime = table.Column(type: "double", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ProductionItemRowList", x => x.ProdItemRowID); - table.ForeignKey( - name: "FK_ProductionItemRowList_ProductionItem_ProdItemID", - column: x => x.ProdItemID, - principalTable: "ProductionItem", - principalColumn: "ProdItemID", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_ProductionItemRowList_RegPhase_PhaseID", - column: x => x.PhaseID, - principalTable: "RegPhase", - principalColumn: "PhaseID", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_ProductionItemRowList_RegResource_ResourceID", - column: x => x.ResourceID, - principalTable: "RegResource", - principalColumn: "ResourceID", - onDelete: ReferentialAction.Restrict); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.InsertData( - table: "JobList", - columns: new[] { "JobID", "Description" }, - values: new object[,] - { - { 1, "Rivendita / servizi" }, - { 2, "Serramento Completo Legno su linea Saomad e installatore interno" } - }); - - migrationBuilder.InsertData( - table: "RegCustomer", - columns: new[] { "CustomerID", "CompanyName", "FirstName", "LastName", "VAT" }, - values: new object[,] - { - { 1, "", "Customer A", "Egalware", "1234567890123456" }, - { 2, "", "Customer B", "User", "1234567890123456" }, - { 3, "", "Customer C", "User Test", "1234567890123456" } - }); - - migrationBuilder.InsertData( - table: "RegDealer", - columns: new[] { "DealerID", "CompanyName", "FirstName", "LastName", "VAT" }, - values: new object[,] - { - { 1, "Company First", "Dealer A", "Egalware", "9587362514671527" }, - { 2, "Company First", "Dealer B", "User", "9587362514671527" }, - { 3, "Company Second", "Dealer C", "User Test", "9587362514671527" } - }); - - migrationBuilder.InsertData( - table: "RegItemGroup", - columns: new[] { "CodGroup", "Description" }, - values: new object[,] - { - { "WindowGlass", "Vetri serramento" }, - { "WindowHardware", "Ferramenta serramento" }, - { "WindowTrunk", "Barre legno per lavorazione" }, - { "WindowVarnish", "Vernici per legno" } - }); - - migrationBuilder.InsertData( - table: "RegMovType", - columns: new[] { "MovCod", "Description" }, - values: new object[,] - { - { "CAR", "Carico a magazzino" }, - { "MOV", "Movimento interno (spostamento)" }, - { "ND", "Non Definito" }, - { "OFOR", "Ordine Fornitore" }, - { "RETT", "Rettifica magazzino" }, - { "SCAR", "Scarico da magazzino" } - }); - - migrationBuilder.InsertData( - table: "RegPhase", - columns: new[] { "PhaseID", "Description" }, - values: new object[,] - { - { 1, "Taglio tronchetti" }, - { 2, "Lavorazione pezzi serramento" }, - { 3, "Verniciatura" }, - { 4, "Assemblaggio completo" }, - { 5, "Assemblaggio Ferramenta" }, - { 6, "Installazione e posa in opera" } - }); - - migrationBuilder.InsertData( - table: "RegResource", - columns: new[] { "ResourceID", "Description", "IsAsset", "IsHuman", "UmFix", "UmProp", "UnitCostFix", "UnitCostProp" }, - values: new object[,] - { - { 1, "Sezionatrice", true, false, "€/h", "", 15.0, 0.0 }, - { 2, "Linea SAOMAD WoodPecker Just 3500", true, false, "€/h", "€/m", 240.0, 1.8999999999999999 }, - { 3, "Linea Pantografo", true, false, "€/h", "€/m", 90.0, 5.9000000000000004 }, - { 4, "Stazione Verniciatura", true, false, "€/h", "€/m", 40.0, 1.8999999999999999 }, - { 5, "Verniciatura Manuale", false, true, "€/h", "€/m", 10.0, 1.8999999999999999 }, - { 6, "Montaggio Manuale", false, true, "", "€/h", 0.0, 40.0 }, - { 7, "Installatore", false, true, "", "€/h", 0.0, 40.0 } - }); - - migrationBuilder.InsertData( - table: "RegSupplier", - columns: new[] { "SupplierID", "CompanyName", "FirstName", "LastName", "VAT" }, - values: new object[,] - { - { 1, "Company One", "Supplier A", "Egalware", "7294857103879254" }, - { 2, "Company Two", "Supplier B", "User", "7294857103879254" }, - { 3, "Company Two", "Supplier C", "User Test", "7294857103879254" } - }); - - migrationBuilder.InsertData( - table: "RegTags", - columns: new[] { "TagID", "Description" }, - values: new object[,] - { - { 1, "Tag 01" }, - { 2, "Tag 02" }, - { 3, "Tag 03" }, - { 4, "Tag 04" }, - { 5, "Tag 05" } - }); - - migrationBuilder.InsertData( - table: "JobRowList", - columns: new[] { "JobRowID", "Description", "Index", "JobID", "PhaseID", "Qty", "ResourceID" }, - values: new object[,] - { - { 1, "", 1, 2, 1, 1.0, 1 }, - { 2, "", 2, 2, 2, 1.0, 2 }, - { 3, "", 3, 2, 3, 1.0, 4 }, - { 4, "", 4, 2, 4, 1.0, 6 }, - { 5, "", 5, 2, 6, 1.0, 7 } - }); - - migrationBuilder.InsertData( - table: "Offer", - columns: new[] { "OfferID", "CustomerID", "DealerID", "Description", "Inserted", "Modified", "OffertState", "RefNum", "RefRev", "RefYear", "ValidUntil" }, - values: new object[] { 1, 2, 2, "Offerta per tre serramenti", new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4215), new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4216), 0, 1, 1, 2024, new DateTime(2025, 9, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4212) }); - - migrationBuilder.InsertData( - table: "RegItem", - columns: new[] { "ItemID", "CodGroup", "Cost", "Description", "ExtItemCode", "IsService", "ItemCode", "ItemType", "Margin", "QtyMax", "QtyMin", "SupplCode", "UM" }, - values: new object[,] - { - { 1, "WindowTrunk", 20.0, "BARRA-60x80 generica", "", false, 1001, 1, 0.29999999999999999, 0.0, 0.0, "BARR.001", "#" }, - { 2, "WindowTrunk", 16.5, "Barra 60x80, lunghezza 12m", "BARRA-60x80x12000", false, 1002, 1, 0.20999999999999999, 0.0, 0.0, "ABC.00123.12000", "#" }, - { 3, "WindowTrunk", 17.5, "Barra 60x80, lunghezza 8m", "BARRA-60x80x8000", false, 1003, 1, 0.22, 0.0, 0.0, "ABC.00123.8000", "#" }, - { 4, "WindowTrunk", 15.5, "Barra 60x80, lunghezza 16m", "BARRA-60x80x16000", false, 1004, 1, 0.20000000000000001, 0.0, 0.0, "ABC.00123.16000", "#" }, - { 5, "WindowGlass", 300.0, "Vetro triplo, basso indice termico, 800x1000", "VETRO-3L-THERMO-800x1000", false, 2001, 1, 0.20000000000000001, 0.0, 0.0, "V3T.800.1000", "m2" }, - { 6, "WindowGlass", 200.0, "Vetro doppio, 800x1000", "VETRO-2L-800x1000", false, 2002, 1, 0.14999999999999999, 0.0, 0.0, "V2.800.1000", "m2" }, - { 7, "WindowGlass", 250.0, "Vetro triplo, 800x1000", "VETRO-3L-800x1000", false, 2003, 1, 0.17999999999999999, 0.0, 0.0, "V3.800.1000", "m2" }, - { 8, "WindowVarnish", 20.0, "Vernice trasparente", "VERN-TRASP", false, 3001, 1, 0.20000000000000001, 0.0, 0.0, "VT.STD", "l" }, - { 9, "WindowHardware", 65.0, "Kit standard completo AGB tipo 001", "KIT-001", false, 5001, 1, 0.20000000000000001, 0.0, 0.0, "AGB-KIT-001", "#" }, - { 10, "WindowHardware", 10.0, "Cerniera AGB tipo 001", "CERN-001", false, 5002, 1, 0.20000000000000001, 0.0, 0.0, "AGB-CERN-001", "#" }, - { 11, "WindowHardware", 15.0, "Serratura AGB tipo 001", "SERR-001", false, 5003, 1, 0.20000000000000001, 0.0, 0.0, "AGB-SERR-001", "#" }, - { 12, "WindowHardware", 25.0, "Maniglia AGB tipo 001", "MAN-001", false, 5004, 1, 0.20000000000000001, 0.0, 0.0, "AGB-MAN-001", "#" } - }); - - migrationBuilder.InsertData( - table: "SellingItem", - columns: new[] { "SellingItemID", "Cost", "Description", "ExtItemCode", "IsService", "ItemCode", "ItemSPP", "JobID", "Margin", "SerStruct", "SupplCode", "UM" }, - values: new object[,] - { - { 1, 820.0, "Finestra anta Singola", "", false, 0, "", 2, 0.20000000000000001, "", "", "#" }, - { 2, 150.0, "Persiana anta singola", "", false, 0, "", 1, 0.10000000000000001, "", "", "#" }, - { 3, 200.0, "Installazione", "", true, 0, "", 1, 0.29999999999999999, "", "", "#" } - }); - - migrationBuilder.InsertData( - table: "JobRowItemList", - columns: new[] { "JobRowItemID", "Description", "Index", "ItemID", "JobRowID", "Qty" }, - values: new object[,] - { - { 1, "Grezzo legno abete", 1, 1, 1, 1.0 }, - { 2, "Vernice trasparente standard 1L", 2, 8, 3, 0.10000000000000001 }, - { 3, "Ferramenta AGB - rif. AGFD.00000.00000", 3, 9, 4, 1.0 } - }); - - migrationBuilder.InsertData( - table: "OfferRowList", - columns: new[] { "OfferRowID", "BomOk", "Cost", "Environment", "Inserted", "ItemBOM", "ItemOk", "ItemSPP", "Modified", "Note", "OfferID", "OfferRowUID", "Qty", "RowNum", "SellingItemID", "SerStruct" }, - values: new object[,] - { - { 1, true, 950.0, "WINDOW", new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4243), "", true, "{}", new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4245), "Finestra anta singola 2025", 1, "OFF0000000001", 3.0, 1, 1, "{}" }, - { 2, true, 160.0, "WINDOW", new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4252), "", true, "{}", new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4253), "Persiana per Finestra anta singola 2025", 1, "OFF0000000002", 3.0, 2, 2, "{}" }, - { 3, true, 200.0, "WINDOW", new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4259), "", true, "{}", new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4261), "Installazione serramento", 1, "OFF0000000003", 3.0, 3, 3, "{}" } - }); - - migrationBuilder.InsertData( - table: "StockStatus", - columns: new[] { "StockStatusId", "IsDeleted", "IsRemn", "ItemID", "Location", "QtyAvail" }, - values: new object[,] - { - { 1, false, false, 1, "B001-001-003", 5.0 }, - { 2, false, false, 2, "B001-001-002", 8.0 }, - { 3, false, false, 3, "B001-001-001", 5.0 }, - { 4, false, false, 4, "V002-001-001", 1.0 }, - { 5, false, false, 5, "V001-001-002", 10.0 }, - { 6, false, false, 6, "V001-001-003", 1.0 }, - { 7, false, false, 8, "V001-001-003", 50.0 }, - { 8, false, false, 11, "S001-002-001", 1.0 }, - { 9, false, false, 9, "S001-002-001", 1.0 }, - { 10, false, false, 10, "S001-001-001", 1.0 } - }); - - migrationBuilder.InsertData( - table: "StockMov", - columns: new[] { "StockMovID", "CodDoc", "DtCreate", "MovCod", "Note", "QtyRec", "StockStatusId", "UnitVal", "UserId" }, - values: new object[,] - { - { 1, "", new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(3939), "CAR", "DEMO", 5.0, 1, 0.0, "samuele.locatelli@egalware.com" }, - { 2, "", new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(3989), "CAR", "DEMO", 8.0, 2, 0.0, "samuele.locatelli@egalware.com" }, - { 3, "", new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(3993), "CAR", "DEMO", 5.0, 3, 0.0, "samuele.locatelli@egalware.com" }, - { 4, "", new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(3997), "CAR", "DEMO", 1.0, 4, 0.0, "samuele.locatelli@egalware.com" }, - { 5, "", new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4000), "CAR", "DEMO", 10.0, 5, 0.0, "samuele.locatelli@egalware.com" }, - { 6, "", new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4004), "CAR", "DEMO", 1.0, 6, 0.0, "samuele.locatelli@egalware.com" }, - { 7, "", new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4008), "CAR", "DEMO", 50.0, 7, 0.0, "samuele.locatelli@egalware.com" }, - { 8, "", new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4011), "CAR", "DEMO", 1.0, 8, 0.0, "samuele.locatelli@egalware.com" }, - { 9, "", new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4015), "CAR", "DEMO", 1.0, 9, 0.0, "samuele.locatelli@egalware.com" }, - { 10, "", new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4019), "CAR", "DEMO", 1.0, 10, 0.0, "samuele.locatelli@egalware.com" } - }); - - migrationBuilder.CreateIndex( - name: "IX_JobRowItemList_ItemID", - table: "JobRowItemList", - column: "ItemID"); - - migrationBuilder.CreateIndex( - name: "IX_JobRowItemList_JobRowID", - table: "JobRowItemList", - column: "JobRowID"); - - migrationBuilder.CreateIndex( - name: "IX_JobRowList_JobID", - table: "JobRowList", - column: "JobID"); - - migrationBuilder.CreateIndex( - name: "IX_JobRowList_PhaseID", - table: "JobRowList", - column: "PhaseID"); - - migrationBuilder.CreateIndex( - name: "IX_JobRowList_ResourceID", - table: "JobRowList", - column: "ResourceID"); - - migrationBuilder.CreateIndex( - name: "IX_Offer_CustomerID", - table: "Offer", - column: "CustomerID"); - - migrationBuilder.CreateIndex( - name: "IX_Offer_DealerID", - table: "Offer", - column: "DealerID"); - - migrationBuilder.CreateIndex( - name: "IX_OfferRowList_OfferID", - table: "OfferRowList", - column: "OfferID"); - - migrationBuilder.CreateIndex( - name: "IX_OfferRowList_SellingItemID", - table: "OfferRowList", - column: "SellingItemID"); - - migrationBuilder.CreateIndex( - name: "IX_Order_CustomerID", - table: "Order", - column: "CustomerID"); - - migrationBuilder.CreateIndex( - name: "IX_Order_DealerID", - table: "Order", - column: "DealerID"); - - migrationBuilder.CreateIndex( - name: "IX_Order_OfferID", - table: "Order", - column: "OfferID"); - - migrationBuilder.CreateIndex( - name: "IX_OrderRowList_OrderID", - table: "OrderRowList", - column: "OrderID"); - - migrationBuilder.CreateIndex( - name: "IX_OrderRowList_SellingItemID", - table: "OrderRowList", - column: "SellingItemID"); - - migrationBuilder.CreateIndex( - name: "IX_ProductionItem_OrderRowID", - table: "ProductionItem", - column: "OrderRowID"); - - migrationBuilder.CreateIndex( - name: "IX_ProductionItem_ProductionBatchID", - table: "ProductionItem", - column: "ProductionBatchID"); - - migrationBuilder.CreateIndex( - name: "IX_ProductionItemRowList_PhaseID", - table: "ProductionItemRowList", - column: "PhaseID"); - - migrationBuilder.CreateIndex( - name: "IX_ProductionItemRowList_ProdItemID", - table: "ProductionItemRowList", - column: "ProdItemID"); - - migrationBuilder.CreateIndex( - name: "IX_ProductionItemRowList_ResourceID", - table: "ProductionItemRowList", - column: "ResourceID"); - - migrationBuilder.CreateIndex( - name: "IX_RegItem_CodGroup", - table: "RegItem", - column: "CodGroup"); - - migrationBuilder.CreateIndex( - name: "IX_SellingItem_JobID", - table: "SellingItem", - column: "JobID"); - - migrationBuilder.CreateIndex( - name: "IX_StockMov_MovCod", - table: "StockMov", - column: "MovCod"); - - migrationBuilder.CreateIndex( - name: "IX_StockMov_StockStatusId", - table: "StockMov", - column: "StockStatusId"); - - migrationBuilder.CreateIndex( - name: "IX_StockStatus_ItemID", - table: "StockStatus", - column: "ItemID"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Counter"); - - migrationBuilder.DropTable( - name: "JobRowItemList"); - - migrationBuilder.DropTable( - name: "OfferRowList"); - - migrationBuilder.DropTable( - name: "ProductionItemRowList"); - - migrationBuilder.DropTable( - name: "RegSupplier"); - - migrationBuilder.DropTable( - name: "RegTags"); - - migrationBuilder.DropTable( - name: "StockMov"); - - migrationBuilder.DropTable( - name: "JobRowList"); - - migrationBuilder.DropTable( - name: "ProductionItem"); - - migrationBuilder.DropTable( - name: "RegMovType"); - - migrationBuilder.DropTable( - name: "StockStatus"); - - migrationBuilder.DropTable( - name: "RegPhase"); - - migrationBuilder.DropTable( - name: "RegResource"); - - migrationBuilder.DropTable( - name: "OrderRowList"); - - migrationBuilder.DropTable( - name: "ProductionBatch"); - - migrationBuilder.DropTable( - name: "RegItem"); - - migrationBuilder.DropTable( - name: "Order"); - - migrationBuilder.DropTable( - name: "SellingItem"); - - migrationBuilder.DropTable( - name: "RegItemGroup"); - - migrationBuilder.DropTable( - name: "Offer"); - - migrationBuilder.DropTable( - name: "JobList"); - - migrationBuilder.DropTable( - name: "RegCustomer"); - - migrationBuilder.DropTable( - name: "RegDealer"); - } - } -} diff --git a/EgwCoreLib.Lux.Data/Migrations/20250916152301_AddItemParentRel.cs b/EgwCoreLib.Lux.Data/Migrations/20250916152301_AddItemParentRel.cs deleted file mode 100644 index 6b5a3c3b..00000000 --- a/EgwCoreLib.Lux.Data/Migrations/20250916152301_AddItemParentRel.cs +++ /dev/null @@ -1,310 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace EgwCoreLib.Lux.Data.Migrations -{ - /// - public partial class AddItemParentRel : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "ItemIDParent", - table: "RegItem", - type: "int", - nullable: false, - defaultValue: 0); - - migrationBuilder.UpdateData( - table: "Offer", - keyColumn: "OfferID", - keyValue: 1, - columns: new[] { "Inserted", "Modified", "ValidUntil" }, - values: new object[] { new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9069), new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9071), new DateTime(2025, 10, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9064) }); - - migrationBuilder.UpdateData( - table: "OfferRowList", - keyColumn: "OfferRowID", - keyValue: 1, - columns: new[] { "Inserted", "Modified" }, - values: new object[] { new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9104), new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9106) }); - - migrationBuilder.UpdateData( - table: "OfferRowList", - keyColumn: "OfferRowID", - keyValue: 2, - columns: new[] { "Inserted", "Modified" }, - values: new object[] { new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9114), new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9116) }); - - migrationBuilder.UpdateData( - table: "OfferRowList", - keyColumn: "OfferRowID", - keyValue: 3, - columns: new[] { "Inserted", "Modified" }, - values: new object[] { new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9123), new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9125) }); - - migrationBuilder.UpdateData( - table: "RegItem", - keyColumn: "ItemID", - keyValue: 1, - column: "ItemIDParent", - value: 0); - - migrationBuilder.UpdateData( - table: "RegItem", - keyColumn: "ItemID", - keyValue: 2, - column: "ItemIDParent", - value: 0); - - migrationBuilder.UpdateData( - table: "RegItem", - keyColumn: "ItemID", - keyValue: 3, - column: "ItemIDParent", - value: 0); - - migrationBuilder.UpdateData( - table: "RegItem", - keyColumn: "ItemID", - keyValue: 4, - column: "ItemIDParent", - value: 0); - - migrationBuilder.UpdateData( - table: "RegItem", - keyColumn: "ItemID", - keyValue: 5, - column: "ItemIDParent", - value: 0); - - migrationBuilder.UpdateData( - table: "RegItem", - keyColumn: "ItemID", - keyValue: 6, - column: "ItemIDParent", - value: 0); - - migrationBuilder.UpdateData( - table: "RegItem", - keyColumn: "ItemID", - keyValue: 7, - column: "ItemIDParent", - value: 0); - - migrationBuilder.UpdateData( - table: "RegItem", - keyColumn: "ItemID", - keyValue: 8, - column: "ItemIDParent", - value: 0); - - migrationBuilder.UpdateData( - table: "RegItem", - keyColumn: "ItemID", - keyValue: 9, - column: "ItemIDParent", - value: 0); - - migrationBuilder.UpdateData( - table: "RegItem", - keyColumn: "ItemID", - keyValue: 10, - column: "ItemIDParent", - value: 0); - - migrationBuilder.UpdateData( - table: "RegItem", - keyColumn: "ItemID", - keyValue: 11, - column: "ItemIDParent", - value: 0); - - migrationBuilder.UpdateData( - table: "RegItem", - keyColumn: "ItemID", - keyValue: 12, - column: "ItemIDParent", - value: 0); - - migrationBuilder.UpdateData( - table: "StockMov", - keyColumn: "StockMovID", - keyValue: 1, - column: "DtCreate", - value: new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8693)); - - migrationBuilder.UpdateData( - table: "StockMov", - keyColumn: "StockMovID", - keyValue: 2, - column: "DtCreate", - value: new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8785)); - - migrationBuilder.UpdateData( - table: "StockMov", - keyColumn: "StockMovID", - keyValue: 3, - column: "DtCreate", - value: new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8790)); - - migrationBuilder.UpdateData( - table: "StockMov", - keyColumn: "StockMovID", - keyValue: 4, - column: "DtCreate", - value: new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8794)); - - migrationBuilder.UpdateData( - table: "StockMov", - keyColumn: "StockMovID", - keyValue: 5, - column: "DtCreate", - value: new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8799)); - - migrationBuilder.UpdateData( - table: "StockMov", - keyColumn: "StockMovID", - keyValue: 6, - column: "DtCreate", - value: new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8803)); - - migrationBuilder.UpdateData( - table: "StockMov", - keyColumn: "StockMovID", - keyValue: 7, - column: "DtCreate", - value: new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8808)); - - migrationBuilder.UpdateData( - table: "StockMov", - keyColumn: "StockMovID", - keyValue: 8, - column: "DtCreate", - value: new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8812)); - - migrationBuilder.UpdateData( - table: "StockMov", - keyColumn: "StockMovID", - keyValue: 9, - column: "DtCreate", - value: new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8817)); - - migrationBuilder.UpdateData( - table: "StockMov", - keyColumn: "StockMovID", - keyValue: 10, - column: "DtCreate", - value: new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8821)); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ItemIDParent", - table: "RegItem"); - - migrationBuilder.UpdateData( - table: "Offer", - keyColumn: "OfferID", - keyValue: 1, - columns: new[] { "Inserted", "Modified", "ValidUntil" }, - values: new object[] { new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4215), new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4216), new DateTime(2025, 9, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4212) }); - - migrationBuilder.UpdateData( - table: "OfferRowList", - keyColumn: "OfferRowID", - keyValue: 1, - columns: new[] { "Inserted", "Modified" }, - values: new object[] { new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4243), new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4245) }); - - migrationBuilder.UpdateData( - table: "OfferRowList", - keyColumn: "OfferRowID", - keyValue: 2, - columns: new[] { "Inserted", "Modified" }, - values: new object[] { new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4252), new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4253) }); - - migrationBuilder.UpdateData( - table: "OfferRowList", - keyColumn: "OfferRowID", - keyValue: 3, - columns: new[] { "Inserted", "Modified" }, - values: new object[] { new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4259), new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4261) }); - - migrationBuilder.UpdateData( - table: "StockMov", - keyColumn: "StockMovID", - keyValue: 1, - column: "DtCreate", - value: new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(3939)); - - migrationBuilder.UpdateData( - table: "StockMov", - keyColumn: "StockMovID", - keyValue: 2, - column: "DtCreate", - value: new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(3989)); - - migrationBuilder.UpdateData( - table: "StockMov", - keyColumn: "StockMovID", - keyValue: 3, - column: "DtCreate", - value: new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(3993)); - - migrationBuilder.UpdateData( - table: "StockMov", - keyColumn: "StockMovID", - keyValue: 4, - column: "DtCreate", - value: new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(3997)); - - migrationBuilder.UpdateData( - table: "StockMov", - keyColumn: "StockMovID", - keyValue: 5, - column: "DtCreate", - value: new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4000)); - - migrationBuilder.UpdateData( - table: "StockMov", - keyColumn: "StockMovID", - keyValue: 6, - column: "DtCreate", - value: new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4004)); - - migrationBuilder.UpdateData( - table: "StockMov", - keyColumn: "StockMovID", - keyValue: 7, - column: "DtCreate", - value: new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4008)); - - migrationBuilder.UpdateData( - table: "StockMov", - keyColumn: "StockMovID", - keyValue: 8, - column: "DtCreate", - value: new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4011)); - - migrationBuilder.UpdateData( - table: "StockMov", - keyColumn: "StockMovID", - keyValue: 9, - column: "DtCreate", - value: new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4015)); - - migrationBuilder.UpdateData( - table: "StockMov", - keyColumn: "StockMovID", - keyValue: 10, - column: "DtCreate", - value: new DateTime(2025, 8, 8, 16, 36, 28, 420, DateTimeKind.Local).AddTicks(4019)); - } - } -} diff --git a/EgwCoreLib.Lux.Data/Migrations/20250916152301_AddItemParentRel.Designer.cs b/EgwCoreLib.Lux.Data/Migrations/20251020100619_InitDb.Designer.cs similarity index 53% rename from EgwCoreLib.Lux.Data/Migrations/20250916152301_AddItemParentRel.Designer.cs rename to EgwCoreLib.Lux.Data/Migrations/20251020100619_InitDb.Designer.cs index 955a8470..067afa2c 100644 --- a/EgwCoreLib.Lux.Data/Migrations/20250916152301_AddItemParentRel.Designer.cs +++ b/EgwCoreLib.Lux.Data/Migrations/20251020100619_InitDb.Designer.cs @@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace EgwCoreLib.Lux.Data.Migrations { [DbContext(typeof(DataLayerContext))] - [Migration("20250916152301_AddItemParentRel")] - partial class AddItemParentRel + [Migration("20251020100619_InitDb")] + partial class InitDb { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -25,133 +25,414 @@ namespace EgwCoreLib.Lux.Data.Migrations MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.CounterModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Config.EnvirParamModel", b => { - b.Property("RefYear") + b.Property("EnvirID") .HasColumnType("int"); - b.Property("CountName") - .HasColumnType("varchar(255)"); - - b.Property("Counter") - .HasColumnType("int"); - - b.HasKey("RefYear", "CountName"); - - b.ToTable("Counter"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.CustomerModel", b => - { - b.Property("CustomerID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CustomerID")); - - b.Property("CompanyName") + b.Property("SerStrucKey") .IsRequired() .HasColumnType("longtext"); - b.Property("FirstName") - .IsRequired() - .HasColumnType("longtext"); + b.HasKey("EnvirID"); - b.Property("LastName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("VAT") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("CustomerID"); - - b.ToTable("RegCustomer"); + b.ToTable("conf_envir"); b.HasData( new { - CustomerID = 1, - CompanyName = "", - FirstName = "Customer A", - LastName = "Egalware", - VAT = "1234567890123456" + EnvirID = 1, + SerStrucKey = "Jwd" }, new { - CustomerID = 2, - CompanyName = "", - FirstName = "Customer B", - LastName = "User", - VAT = "1234567890123456" + EnvirID = 2, + SerStrucKey = "Btl" }, new { - CustomerID = 3, - CompanyName = "", - FirstName = "Customer C", - LastName = "User Test", - VAT = "1234567890123456" + EnvirID = 4, + SerStrucKey = "Btl" + }, + new + { + EnvirID = 3, + SerStrucKey = "Btl" }); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.DealerModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Config.GlassModel", b => { - b.Property("DealerID") + b.Property("GlassID") .ValueGeneratedOnAdd() .HasColumnType("int"); - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("DealerID")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("GlassID")); - b.Property("CompanyName") - .IsRequired() + b.Property("Code") .HasColumnType("longtext"); - b.Property("FirstName") - .IsRequired() + b.Property("Description") .HasColumnType("longtext"); - b.Property("LastName") - .IsRequired() - .HasColumnType("longtext"); + b.Property("Thickness") + .HasColumnType("double"); - b.Property("VAT") - .IsRequired() - .HasColumnType("longtext"); + b.HasKey("GlassID"); - b.HasKey("DealerID"); - - b.ToTable("RegDealer"); + b.ToTable("conf_glass"); b.HasData( new { - DealerID = 1, - CompanyName = "Company First", - FirstName = "Dealer A", - LastName = "Egalware", - VAT = "9587362514671527" + GlassID = 1, + Code = "0001", + Description = "Vetro BE 2S 4/12/4", + Thickness = 20.0 }, new { - DealerID = 2, - CompanyName = "Company First", - FirstName = "Dealer B", - LastName = "User", - VAT = "9587362514671527" + GlassID = 2, + Code = "0002", + Description = "Vetro BE 2S 4/16/4", + Thickness = 24.0 }, new { - DealerID = 3, - CompanyName = "Company Second", - FirstName = "Dealer C", - LastName = "User Test", - VAT = "9587362514671527" + GlassID = 3, + Code = "0003", + Description = "Vetro BE 3S 4/12/4/12/4", + Thickness = 36.0 + }, + new + { + GlassID = 4, + Code = "0004", + Description = "Vetro BE 3S 4/16/4/16/4", + Thickness = 44.0 + }, + new + { + GlassID = 5, + Code = "0005", + Description = "Vetro BE 2S 4T/12/4T", + Thickness = 20.0 + }, + new + { + GlassID = 6, + Code = "0006", + Description = "Vetro BE 2S 4T/16/4T", + Thickness = 24.0 + }, + new + { + GlassID = 7, + Code = "0007", + Description = "Vetro BE 3S 4T/12/4T/12/4T", + Thickness = 36.0 + }, + new + { + GlassID = 8, + Code = "0008", + Description = "Vetro BE 3S 4T/16/4T/16/4T", + Thickness = 44.0 }); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ItemGroupModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Config.ProfileModel", b => + { + b.Property("ProfileID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProfileID")); + + b.Property("Code") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Thickness") + .HasColumnType("double"); + + b.HasKey("ProfileID"); + + b.ToTable("conf_profile"); + + b.HasData( + new + { + ProfileID = 1, + Code = "0001", + Description = "Profilo60", + Thickness = 60.0 + }, + new + { + ProfileID = 2, + Code = "0002", + Description = "Profilo78", + Thickness = 78.0 + }, + new + { + ProfileID = 3, + Code = "0003", + Description = "Profilo90", + Thickness = 90.0 + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Config.WoodModel", b => + { + b.Property("WoodID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("WoodID")); + + b.Property("Code") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("WoodID"); + + b.ToTable("conf_wood"); + + b.HasData( + new + { + WoodID = 1, + Code = "0001", + Description = "Abete", + Type = 1 + }, + new + { + WoodID = 2, + Code = "0002", + Description = "Acero", + Type = 1 + }, + new + { + WoodID = 3, + Code = "0003", + Description = "Pino", + Type = 2 + }, + new + { + WoodID = 4, + Code = "0004", + Description = "Tek", + Type = 3 + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Cost.CostDriverModel", b => + { + b.Property("CostDriverID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CostDriverID")); + + b.Property("Descript") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Unit") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("CostDriverID"); + + b.ToTable("cost_driver"); + + b.HasData( + new + { + CostDriverID = 1, + Descript = "Ore lavorate per step/fase", + Name = "WorkHour", + Unit = "h" + }, + new + { + CostDriverID = 2, + Descript = "Metri prodotti per step/fase", + Name = "Meter", + Unit = "m" + }, + new + { + CostDriverID = 3, + Descript = "Numero unità prodotte (lavorate) per step/fase", + Name = "Unit", + Unit = "#" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Cost.ResourceModel", b => + { + b.Property("ResourceID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ResourceID")); + + b.Property("CostDriverBudget") + .HasColumnType("decimal(65,30)"); + + b.Property("CostDriverID") + .HasColumnType("int"); + + b.Property("EBTPerc") + .HasColumnType("decimal(65,30)"); + + b.Property("FixedCost") + .HasColumnType("decimal(65,30)"); + + b.Property("LaborCost") + .HasColumnType("decimal(65,30)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OverHeadCost") + .HasColumnType("decimal(65,30)"); + + b.Property("OverHeadPerc") + .HasColumnType("decimal(65,30)"); + + b.Property("PriceMargin") + .HasColumnType("decimal(65,30)"); + + b.Property("VariableCost") + .HasColumnType("decimal(65,30)"); + + b.HasKey("ResourceID"); + + b.HasIndex("CostDriverID"); + + b.ToTable("cost_resource"); + + b.HasData( + new + { + ResourceID = 1, + CostDriverBudget = 880m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 12000m, + LaborCost = 30m, + Name = "Sezionatrice", + OverHeadCost = 5000m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 6000m + }, + new + { + ResourceID = 2, + CostDriverBudget = 1760m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 100000m, + LaborCost = 40m, + Name = "Linea SAOMAD WoodPecker Just 3500", + OverHeadCost = 15000m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 30000m + }, + new + { + ResourceID = 3, + CostDriverBudget = 1760m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 24000m, + LaborCost = 35m, + Name = "Linea Pantografo", + OverHeadCost = 5000m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 6000m + }, + new + { + ResourceID = 4, + CostDriverBudget = 880m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 24000m, + LaborCost = 30m, + Name = "Stazione Verniciatura", + OverHeadCost = 3000m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 6000m + }, + new + { + ResourceID = 5, + CostDriverBudget = 220m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 6000m, + LaborCost = 30m, + Name = "Verniciatura Manuale", + OverHeadCost = 3000m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 2000m + }, + new + { + ResourceID = 6, + CostDriverBudget = 3520m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 500m, + LaborCost = 30m, + Name = "Montaggio Manuale", + OverHeadCost = 500m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 500m + }, + new + { + ResourceID = 7, + CostDriverBudget = 3520m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 0m, + LaborCost = 40m, + Name = "Installatore", + OverHeadCost = 0m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 3000m + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.ItemGroupModel", b => { b.Property("CodGroup") .HasColumnType("varchar(255)"); @@ -162,7 +443,7 @@ namespace EgwCoreLib.Lux.Data.Migrations b.HasKey("CodGroup"); - b.ToTable("RegItemGroup"); + b.ToTable("item_group"); b.HasData( new @@ -187,7 +468,7 @@ namespace EgwCoreLib.Lux.Data.Migrations }); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ItemModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.ItemModel", b => { b.Property("ItemID") .ValueGeneratedOnAdd() @@ -243,7 +524,7 @@ namespace EgwCoreLib.Lux.Data.Migrations b.HasIndex("CodGroup"); - b.ToTable("RegItem"); + b.ToTable("item_item"); b.HasData( new @@ -452,104 +733,301 @@ namespace EgwCoreLib.Lux.Data.Migrations }); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.JobModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.SellingItemModel", b => { - b.Property("JobID") + b.Property("SellingItemID") .ValueGeneratedOnAdd() .HasColumnType("int"); - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobID")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SellingItemID")); - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("JobID"); - - b.ToTable("JobList"); - - b.HasData( - new - { - JobID = 1, - Description = "Rivendita / servizi" - }, - new - { - JobID = 2, - Description = "Serramento Completo Legno su linea Saomad e installatore interno" - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.JobRowItemModel", b => - { - b.Property("JobRowItemID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobRowItemID")); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Index") - .HasColumnType("int"); - - b.Property("ItemID") - .HasColumnType("int"); - - b.Property("JobRowID") - .HasColumnType("int"); - - b.Property("Qty") + b.Property("Cost") .HasColumnType("double"); - b.HasKey("JobRowItemID"); + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); - b.HasIndex("ItemID"); + b.Property("Envir") + .HasColumnType("int"); - b.HasIndex("JobRowID"); + b.Property("ExtItemCode") + .IsRequired() + .HasColumnType("longtext"); - b.ToTable("JobRowItemList"); + b.Property("IsService") + .HasColumnType("tinyint(1)"); + + b.Property("ItemCode") + .HasColumnType("int"); + + b.Property("ItemSteps") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("JobID") + .HasColumnType("int"); + + b.Property("Margin") + .HasColumnType("double"); + + b.Property("SerStruct") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("SupplCode") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UM") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("SellingItemID"); + + b.HasIndex("JobID"); + + b.ToTable("item_selling_item"); b.HasData( new { - JobRowItemID = 1, - Description = "Grezzo legno abete", - Index = 1, - ItemID = 1, - JobRowID = 1, - Qty = 1.0 + SellingItemID = 1, + Cost = 500.0, + Description = "Finestra Anta Singola", + Envir = 1, + ExtItemCode = "", + IsService = false, + ItemCode = 0, + ItemSteps = "", + JobID = 2, + Margin = 0.20000000000000001, + SerStruct = "{\"ProfilePath\":\"Profilo78\",\"Material\":\"Abete\",\"ColorMaterial\":\"White\",\"Glass\":\"Vetro BE 2S 4/12/4\",\"AreaList\":[{\"Shape\":\"RECTANGLE\",\"DimensionList\":[{\"nIndex\":1,\"sName\":\"Width\",\"dValue\":800.0},{\"nIndex\":2,\"sName\":\"Height\",\"dValue\":1200.0}],\"JointList\":[{\"nIndex\":1,\"JointType\":\"FULL_H\"},{\"nIndex\":2,\"JointType\":\"FULL_H\"},{\"nIndex\":3,\"JointType\":\"FULL_H\"},{\"nIndex\":4,\"JointType\":\"FULL_H\"}],\"BottomRail\":false,\"BottomRailQty\":0,\"IdGroup\":1,\"AreaList\":[{\"bIsSashVertical\":true,\"SashList\":[{\"nSashId\":1,\"OpeningType\":\"TILTTURN_LEFT\",\"bHasHandle\":true,\"dDimension\":100.0}],\"SashType\":\"NULL\",\"JointList\":[{\"nIndex\":1,\"JointType\":\"FULL_H\"},{\"nIndex\":2,\"JointType\":\"FULL_H\"},{\"nIndex\":3,\"JointType\":\"FULL_H\"},{\"nIndex\":4,\"JointType\":\"FULL_H\"}],\"BottomRail\":false,\"BottomRailQty\":0,\"Hardware\":\"000558\",\"IdGroup\":2,\"AreaList\":[{\"FillType\":\"GLASS\",\"IdGroup\":3,\"AreaList\":[],\"AreaType\":\"FILL\"}],\"AreaType\":\"SASH\"}],\"AreaType\":\"FRAME\"}]}", + SupplCode = "", + UM = "#" }, new { - JobRowItemID = 2, - Description = "Vernice trasparente standard 1L", - Index = 2, - ItemID = 8, - JobRowID = 3, - Qty = 0.10000000000000001 + SellingItemID = 2, + Cost = 300.0, + Description = "Finestra Vetro Fisso ", + Envir = 1, + ExtItemCode = "", + IsService = false, + ItemCode = 0, + ItemSteps = "", + JobID = 2, + Margin = 0.20000000000000001, + SerStruct = "{\"ProfilePath\":\"Profilo78\",\"Material\":\"Abete\",\"ColorMaterial\":\"White\",\"Glass\":\"Vetro BE 2S 4/12/4\",\"AreaList\":[{\"Shape\":\"RECTANGLE\",\"DimensionList\":[{\"nIndex\":1,\"sName\":\"Width\",\"dValue\":800.0},{\"nIndex\":2,\"sName\":\"Height\",\"dValue\":1200.0}],\"JointList\":[{\"nIndex\":1,\"JointType\":\"FULL_H\"},{\"nIndex\":2,\"JointType\":\"FULL_H\"},{\"nIndex\":3,\"JointType\":\"FULL_H\"},{\"nIndex\":4,\"JointType\":\"FULL_H\"}],\"BottomRail\":false,\"BottomRailQty\":0,\"IdGroup\":1,\"AreaList\":[{\"FillType\":\"GLASS\",\"IdGroup\":4,\"AreaList\":[],\"AreaType\":\"FILL\"}],\"AreaType\":\"FRAME\"}]}", + SupplCode = "", + UM = "#" }, new { - JobRowItemID = 3, - Description = "Ferramenta AGB - rif. AGFD.00000.00000", - Index = 3, - ItemID = 9, - JobRowID = 4, - Qty = 1.0 + SellingItemID = 3, + Cost = 150.0, + Description = "Persiana anta singola", + Envir = 1, + ExtItemCode = "", + IsService = false, + ItemCode = 0, + ItemSteps = "", + JobID = 1, + Margin = 0.10000000000000001, + SerStruct = "", + SupplCode = "", + UM = "#" + }, + new + { + SellingItemID = 4, + Cost = 200.0, + Description = "Installazione", + Envir = 1, + ExtItemCode = "", + IsService = true, + ItemCode = 0, + ItemSteps = "", + JobID = 1, + Margin = 0.29999999999999999, + SerStruct = "", + SupplCode = "", + UM = "#" + }, + new + { + SellingItemID = 5, + Cost = 1000.0, + Description = "Trave lamellare", + Envir = 2, + ExtItemCode = "", + IsService = false, + ItemCode = 0, + ItemSteps = "", + JobID = 3, + Margin = 0.29999999999999999, + SerStruct = "", + SupplCode = "", + UM = "#" + }, + new + { + SellingItemID = 6, + Cost = 500.0, + Description = "Cabinet", + Envir = 4, + ExtItemCode = "", + IsService = false, + ItemCode = 0, + ItemSteps = "", + JobID = 4, + Margin = 0.29999999999999999, + SerStruct = "", + SupplCode = "", + UM = "#" + }, + new + { + SellingItemID = 7, + Cost = 2000.0, + Description = "Parete", + Envir = 3, + ExtItemCode = "", + IsService = false, + ItemCode = 0, + ItemSteps = "", + JobID = 5, + Margin = 0.29999999999999999, + SerStruct = "", + SupplCode = "", + UM = "#" }); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.JobRowModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.SupplierModel", b => { - b.Property("JobRowID") + b.Property("SupplierID") .ValueGeneratedOnAdd() .HasColumnType("int"); - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobRowID")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SupplierID")); + + b.Property("CompanyName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("VAT") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("SupplierID"); + + b.ToTable("item_supplier"); + + b.HasData( + new + { + SupplierID = 1, + CompanyName = "Company One", + FirstName = "Supplier A", + LastName = "Egalware", + VAT = "7294857103879254" + }, + new + { + SupplierID = 2, + CompanyName = "Company Two", + FirstName = "Supplier B", + LastName = "User", + VAT = "7294857103879254" + }, + new + { + SupplierID = 3, + CompanyName = "Company Two", + FirstName = "Supplier C", + LastName = "User Test", + VAT = "7294857103879254" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Production.ProductionBatchModel", b => + { + b.Property("ProductionBatchID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProductionBatchID")); + + b.Property("DateEnd") + .HasColumnType("datetime(6)"); + + b.Property("DateStart") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DueDate") + .HasColumnType("datetime(6)"); + + b.HasKey("ProductionBatchID"); + + b.ToTable("production_batch"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Production.ProductionItemModel", b => + { + b.Property("ProdItemID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProdItemID")); + + b.Property("ExtItemCode") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ItemCode") + .HasColumnType("int"); + + b.Property("OrderRowID") + .HasColumnType("int"); + + b.Property("ProductionBatchID") + .HasColumnType("int"); + + b.HasKey("ProdItemID"); + + b.HasIndex("OrderRowID"); + + b.HasIndex("ProductionBatchID"); + + b.ToTable("production_item"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Production.ProductionItemStepModel", b => + { + b.Property("ProdItemStepID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProdItemStepID")); + + b.Property("DateEnd") + .HasColumnType("datetime(6)"); + + b.Property("DateStart") + .HasColumnType("datetime(6)"); b.Property("Description") .IsRequired() @@ -558,128 +1036,143 @@ namespace EgwCoreLib.Lux.Data.Migrations b.Property("Index") .HasColumnType("int"); - b.Property("JobID") - .HasColumnType("int"); - b.Property("PhaseID") .HasColumnType("int"); + b.Property("ProdItemID") + .HasColumnType("int"); + b.Property("Qty") .HasColumnType("double"); b.Property("ResourceID") .HasColumnType("int"); - b.HasKey("JobRowID"); + b.Property("WorkTime") + .HasColumnType("double"); - b.HasIndex("JobID"); + b.HasKey("ProdItemStepID"); b.HasIndex("PhaseID"); + b.HasIndex("ProdItemID"); + b.HasIndex("ResourceID"); - b.ToTable("JobRowList"); - - b.HasData( - new - { - JobRowID = 1, - Description = "", - Index = 1, - JobID = 2, - PhaseID = 1, - Qty = 1.0, - ResourceID = 1 - }, - new - { - JobRowID = 2, - Description = "", - Index = 2, - JobID = 2, - PhaseID = 2, - Qty = 1.0, - ResourceID = 2 - }, - new - { - JobRowID = 3, - Description = "", - Index = 3, - JobID = 2, - PhaseID = 3, - Qty = 1.0, - ResourceID = 4 - }, - new - { - JobRowID = 4, - Description = "", - Index = 4, - JobID = 2, - PhaseID = 4, - Qty = 1.0, - ResourceID = 6 - }, - new - { - JobRowID = 5, - Description = "", - Index = 5, - JobID = 2, - PhaseID = 6, - Qty = 1.0, - ResourceID = 7 - }); + b.ToTable("production_item_step"); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.MovTypeModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.CustomerModel", b => { - b.Property("MovCod") - .HasColumnType("varchar(255)"); + b.Property("CustomerID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("Description") + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CustomerID")); + + b.Property("CompanyName") .IsRequired() .HasColumnType("longtext"); - b.HasKey("MovCod"); + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); - b.ToTable("RegMovType"); + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("VAT") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("CustomerID"); + + b.ToTable("sales_customer"); b.HasData( new { - MovCod = "CAR", - Description = "Carico a magazzino" + CustomerID = 1, + CompanyName = "", + FirstName = "Customer A", + LastName = "Egalware", + VAT = "1234567890123456" }, new { - MovCod = "MOV", - Description = "Movimento interno (spostamento)" + CustomerID = 2, + CompanyName = "", + FirstName = "Customer B", + LastName = "User", + VAT = "1234567890123456" }, new { - MovCod = "ND", - Description = "Non Definito" - }, - new - { - MovCod = "OFOR", - Description = "Ordine Fornitore" - }, - new - { - MovCod = "RETT", - Description = "Rettifica magazzino" - }, - new - { - MovCod = "SCAR", - Description = "Scarico da magazzino" + CustomerID = 3, + CompanyName = "", + FirstName = "Customer C", + LastName = "User Test", + VAT = "1234567890123456" }); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OfferModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.DealerModel", b => + { + b.Property("DealerID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("DealerID")); + + b.Property("CompanyName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("VAT") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("DealerID"); + + b.ToTable("sales_dealer"); + + b.HasData( + new + { + DealerID = 1, + CompanyName = "Company First", + FirstName = "Dealer A", + LastName = "Egalware", + VAT = "9587362514671527" + }, + new + { + DealerID = 2, + CompanyName = "Company First", + FirstName = "Dealer B", + LastName = "User", + VAT = "9587362514671527" + }, + new + { + DealerID = 3, + CompanyName = "Company Second", + FirstName = "Dealer C", + LastName = "User Test", + VAT = "9587362514671527" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OfferModel", b => { b.Property("OfferID") .ValueGeneratedOnAdd() @@ -687,6 +1180,10 @@ namespace EgwCoreLib.Lux.Data.Migrations MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OfferID")); + b.Property("ConsNote") + .IsRequired() + .HasColumnType("longtext"); + b.Property("CustomerID") .HasColumnType("int"); @@ -697,6 +1194,16 @@ namespace EgwCoreLib.Lux.Data.Migrations .IsRequired() .HasColumnType("longtext"); + b.Property("DictPresel") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Discount") + .HasColumnType("double"); + + b.Property("Envir") + .HasColumnType("int"); + b.Property("Inserted") .HasColumnType("datetime(6)"); @@ -724,26 +1231,84 @@ namespace EgwCoreLib.Lux.Data.Migrations b.HasIndex("DealerID"); - b.ToTable("Offer"); + b.ToTable("sales_offer"); b.HasData( new { OfferID = 1, + ConsNote = "", CustomerID = 2, DealerID = 2, Description = "Offerta per tre serramenti", - Inserted = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9069), - Modified = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9071), + DictPresel = "", + Discount = 0.0, + Envir = 1, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4161), + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4162), OffertState = 0, RefNum = 1, RefRev = 1, RefYear = 2024, - ValidUntil = new DateTime(2025, 10, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9064) + ValidUntil = new DateTime(2025, 11, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4158) + }, + new + { + OfferID = 2, + ConsNote = "", + CustomerID = 2, + DealerID = 2, + Description = "Offerta BEAM", + DictPresel = "", + Discount = 0.0, + Envir = 2, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4169), + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4170), + OffertState = 0, + RefNum = 2, + RefRev = 1, + RefYear = 2024, + ValidUntil = new DateTime(2025, 11, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4167) + }, + new + { + OfferID = 3, + ConsNote = "", + CustomerID = 2, + DealerID = 2, + Description = "Offerta Cabinet", + DictPresel = "", + Discount = 0.0, + Envir = 4, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4175), + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4177), + OffertState = 0, + RefNum = 3, + RefRev = 1, + RefYear = 2024, + ValidUntil = new DateTime(2025, 11, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4174) + }, + new + { + OfferID = 4, + ConsNote = "", + CustomerID = 2, + DealerID = 2, + Description = "Offerta Wall", + DictPresel = "", + Discount = 0.0, + Envir = 3, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4182), + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4183), + OffertState = 0, + RefNum = 4, + RefRev = 1, + RefYear = 2024, + ValidUntil = new DateTime(2025, 11, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4181) }); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OfferRowModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OfferRowModel", b => { b.Property("OfferRowID") .ValueGeneratedOnAdd() @@ -751,16 +1316,35 @@ namespace EgwCoreLib.Lux.Data.Migrations MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OfferRowID")); + b.Property("AwaitBom") + .HasColumnType("tinyint(1)"); + + b.Property("AwaitPrice") + .HasColumnType("tinyint(1)"); + + b.Property("BomCost") + .HasColumnType("double"); + b.Property("BomOk") .HasColumnType("tinyint(1)"); - b.Property("Cost") + b.Property("BomPrice") .HasColumnType("double"); - b.Property("Environment") + b.Property("Envir") + .HasColumnType("int"); + + b.Property("FileName") .IsRequired() .HasColumnType("longtext"); + b.Property("FileResource") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + b.Property("Inserted") .HasColumnType("datetime(6)"); @@ -771,7 +1355,7 @@ namespace EgwCoreLib.Lux.Data.Migrations b.Property("ItemOk") .HasColumnType("tinyint(1)"); - b.Property("ItemSPP") + b.Property("ItemSteps") .IsRequired() .HasColumnType("longtext"); @@ -802,75 +1386,294 @@ namespace EgwCoreLib.Lux.Data.Migrations .IsRequired() .HasColumnType("longtext"); + b.Property("StepCost") + .HasColumnType("double"); + + b.Property("StepPrice") + .HasColumnType("double"); + b.HasKey("OfferRowID"); b.HasIndex("OfferID"); b.HasIndex("SellingItemID"); - b.ToTable("OfferRowList"); + b.ToTable("sales_offer_row"); b.HasData( new { OfferRowID = 1, + AwaitBom = false, + AwaitPrice = false, + BomCost = 900.0, BomOk = true, - Cost = 950.0, - Environment = "WINDOW", - Inserted = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9104), + BomPrice = 950.0, + Envir = 1, + FileName = "", + FileResource = "", + FileSize = 0L, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4304), ItemBOM = "", ItemOk = true, - ItemSPP = "{}", - Modified = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9106), - Note = "Finestra anta singola 2025", + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4306), + Note = "Finestra Vetro Fisso 2025", OfferID = 1, - OfferRowUID = "OFF0000000001", + OfferRowUID = "SOR.25.00000001", Qty = 3.0, RowNum = 1, - SellingItemID = 1, - SerStruct = "{}" + SellingItemID = 2, + SerStruct = "{\"ProfilePath\":\"Profilo78\",\"Material\":\"Abete\",\"ColorMaterial\":\"White\",\"Glass\":\"Vetro BE 2S 4/12/4\",\"AreaList\":[{\"Shape\":\"RECTANGLE\",\"DimensionList\":[{\"nIndex\":1,\"sName\":\"Width\",\"dValue\":800.0},{\"nIndex\":2,\"sName\":\"Height\",\"dValue\":1200.0}],\"JointList\":[{\"nIndex\":1,\"JointType\":\"FULL_H\"},{\"nIndex\":2,\"JointType\":\"FULL_H\"},{\"nIndex\":3,\"JointType\":\"FULL_H\"},{\"nIndex\":4,\"JointType\":\"FULL_H\"}],\"BottomRail\":false,\"BottomRailQty\":0,\"IdGroup\":1,\"AreaList\":[{\"FillType\":\"GLASS\",\"IdGroup\":4,\"AreaList\":[],\"AreaType\":\"FILL\"}],\"AreaType\":\"FRAME\"}]}", + StepCost = 0.0, + StepPrice = 0.0 }, new { OfferRowID = 2, + AwaitBom = false, + AwaitPrice = false, + BomCost = 900.0, BomOk = true, - Cost = 160.0, - Environment = "WINDOW", - Inserted = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9114), + BomPrice = 950.0, + Envir = 1, + FileName = "", + FileResource = "", + FileSize = 0L, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4320), ItemBOM = "", ItemOk = true, - ItemSPP = "{}", - Modified = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9116), - Note = "Persiana per Finestra anta singola 2025", + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4321), + Note = "Finestra Anta Singola 2025", OfferID = 1, - OfferRowUID = "OFF0000000002", + OfferRowUID = "SOR.25.00000002", Qty = 3.0, - RowNum = 2, - SellingItemID = 2, - SerStruct = "{}" + RowNum = 1, + SellingItemID = 1, + SerStruct = "{\"ProfilePath\":\"Profilo78\",\"Material\":\"Abete\",\"ColorMaterial\":\"White\",\"Glass\":\"Vetro BE 2S 4/12/4\",\"AreaList\":[{\"Shape\":\"RECTANGLE\",\"DimensionList\":[{\"nIndex\":1,\"sName\":\"Width\",\"dValue\":800.0},{\"nIndex\":2,\"sName\":\"Height\",\"dValue\":1200.0}],\"JointList\":[{\"nIndex\":1,\"JointType\":\"FULL_H\"},{\"nIndex\":2,\"JointType\":\"FULL_H\"},{\"nIndex\":3,\"JointType\":\"FULL_H\"},{\"nIndex\":4,\"JointType\":\"FULL_H\"}],\"BottomRail\":false,\"BottomRailQty\":0,\"IdGroup\":1,\"AreaList\":[{\"bIsSashVertical\":true,\"SashList\":[{\"nSashId\":1,\"OpeningType\":\"TILTTURN_LEFT\",\"bHasHandle\":true,\"dDimension\":100.0}],\"SashType\":\"NULL\",\"JointList\":[{\"nIndex\":1,\"JointType\":\"FULL_H\"},{\"nIndex\":2,\"JointType\":\"FULL_H\"},{\"nIndex\":3,\"JointType\":\"FULL_H\"},{\"nIndex\":4,\"JointType\":\"FULL_H\"}],\"BottomRail\":false,\"BottomRailQty\":0,\"Hardware\":\"000558\",\"IdGroup\":2,\"AreaList\":[{\"FillType\":\"GLASS\",\"IdGroup\":3,\"AreaList\":[],\"AreaType\":\"FILL\"}],\"AreaType\":\"SASH\"}],\"AreaType\":\"FRAME\"}]}", + StepCost = 0.0, + StepPrice = 0.0 }, new { OfferRowID = 3, + AwaitBom = false, + AwaitPrice = false, + BomCost = 160.0, BomOk = true, - Cost = 200.0, - Environment = "WINDOW", - Inserted = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9123), + BomPrice = 200.0, + Envir = 1, + FileName = "", + FileResource = "", + FileSize = 0L, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4332), ItemBOM = "", ItemOk = true, - ItemSPP = "{}", - Modified = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9125), + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4334), + Note = "Persiana per Finestra anta singola 2025", + OfferID = 1, + OfferRowUID = "SOR.25.00000003", + Qty = 3.0, + RowNum = 2, + SellingItemID = 2, + SerStruct = "{}", + StepCost = 0.0, + StepPrice = 0.0 + }, + new + { + OfferRowID = 4, + AwaitBom = false, + AwaitPrice = false, + BomCost = 200.0, + BomOk = true, + BomPrice = 250.0, + Envir = 1, + FileName = "", + FileResource = "", + FileSize = 0L, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4344), + ItemBOM = "", + ItemOk = true, + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4346), Note = "Installazione serramento", OfferID = 1, - OfferRowUID = "OFF0000000003", + OfferRowUID = "SOR.25.00000004", Qty = 3.0, RowNum = 3, SellingItemID = 3, - SerStruct = "{}" + SerStruct = "{}", + StepCost = 0.0, + StepPrice = 0.0 + }, + new + { + OfferRowID = 5, + AwaitBom = false, + AwaitPrice = false, + BomCost = 800.0, + BomOk = true, + BomPrice = 1150.0, + Envir = 2, + FileName = "", + FileResource = "", + FileSize = 0L, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4376), + ItemBOM = "", + ItemOk = true, + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4378), + Note = "Demo file 01", + OfferID = 2, + OfferRowUID = "SOR.25.00000005", + Qty = 10.0, + RowNum = 1, + SellingItemID = 4, + SerStruct = "", + StepCost = 0.0, + StepPrice = 0.0 + }, + new + { + OfferRowID = 6, + AwaitBom = false, + AwaitPrice = false, + BomCost = 600.0, + BomOk = true, + BomPrice = 950.0, + Envir = 2, + FileName = "", + FileResource = "", + FileSize = 0L, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4389), + ItemBOM = "", + ItemOk = true, + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4390), + Note = "Demo file 02", + OfferID = 2, + OfferRowUID = "SOR.25.00000006", + Qty = 4.0, + RowNum = 1, + SellingItemID = 4, + SerStruct = "", + StepCost = 0.0, + StepPrice = 0.0 + }, + new + { + OfferRowID = 7, + AwaitBom = false, + AwaitPrice = false, + BomCost = 200.0, + BomOk = true, + BomPrice = 250.0, + Envir = 3, + FileName = "", + FileResource = "", + FileSize = 0L, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4419), + ItemBOM = "", + ItemOk = true, + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4421), + Note = "Demo file 01", + OfferID = 3, + OfferRowUID = "SOR.25.00000007", + Qty = 4.0, + RowNum = 1, + SellingItemID = 5, + SerStruct = "", + StepCost = 0.0, + StepPrice = 0.0 + }, + new + { + OfferRowID = 8, + AwaitBom = false, + AwaitPrice = false, + BomCost = 50.0, + BomOk = true, + BomPrice = 80.0, + Envir = 3, + FileName = "", + FileResource = "", + FileSize = 0L, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4432), + ItemBOM = "", + ItemOk = true, + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4433), + Note = "Demo file 02", + OfferID = 3, + OfferRowUID = "SOR.25.00000008", + Qty = 12.0, + RowNum = 1, + SellingItemID = 5, + SerStruct = "", + StepCost = 0.0, + StepPrice = 0.0 + }, + new + { + OfferRowID = 9, + AwaitBom = false, + AwaitPrice = false, + BomCost = 800.0, + BomOk = true, + BomPrice = 1150.0, + Envir = 4, + FileName = "", + FileResource = "", + FileSize = 0L, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4462), + ItemBOM = "", + ItemOk = true, + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4464), + Note = "Demo file 01", + OfferID = 4, + OfferRowUID = "SOR.25.00000009", + Qty = 6.0, + RowNum = 1, + SellingItemID = 6, + SerStruct = "", + StepCost = 0.0, + StepPrice = 0.0 + }, + new + { + OfferRowID = 10, + AwaitBom = false, + AwaitPrice = false, + BomCost = 600.0, + BomOk = true, + BomPrice = 950.0, + Envir = 4, + FileName = "", + FileResource = "", + FileSize = 0L, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4475), + ItemBOM = "", + ItemOk = true, + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4477), + Note = "Demo file 02", + OfferID = 4, + OfferRowUID = "SOR.25.0000000A", + Qty = 4.0, + RowNum = 1, + SellingItemID = 6, + SerStruct = "", + StepCost = 0.0, + StepPrice = 0.0 }); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OrderModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OrderModel", b => { b.Property("OrderID") .ValueGeneratedOnAdd() @@ -878,6 +1681,10 @@ namespace EgwCoreLib.Lux.Data.Migrations MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OrderID")); + b.Property("ConsNote") + .IsRequired() + .HasColumnType("longtext"); + b.Property("CustomerID") .HasColumnType("int"); @@ -888,6 +1695,10 @@ namespace EgwCoreLib.Lux.Data.Migrations .IsRequired() .HasColumnType("longtext"); + b.Property("DictPresel") + .IsRequired() + .HasColumnType("longtext"); + b.Property("Inserted") .HasColumnType("datetime(6)"); @@ -920,10 +1731,10 @@ namespace EgwCoreLib.Lux.Data.Migrations b.HasIndex("OfferID"); - b.ToTable("Order"); + b.ToTable("sales_order"); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OrderRowModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OrderRowModel", b => { b.Property("OrderRowID") .ValueGeneratedOnAdd() @@ -931,13 +1742,16 @@ namespace EgwCoreLib.Lux.Data.Migrations MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OrderRowID")); - b.Property("Cost") + b.Property("BomCost") + .HasColumnType("double"); + + b.Property("BomPrice") .HasColumnType("double"); b.Property("Inserted") .HasColumnType("datetime(6)"); - b.Property("ItemSPP") + b.Property("ItemSteps") .IsRequired() .HasColumnType("longtext"); @@ -964,385 +1778,22 @@ namespace EgwCoreLib.Lux.Data.Migrations .IsRequired() .HasColumnType("longtext"); + b.Property("StepCost") + .HasColumnType("double"); + + b.Property("StepPrice") + .HasColumnType("double"); + b.HasKey("OrderRowID"); b.HasIndex("OrderID"); b.HasIndex("SellingItemID"); - b.ToTable("OrderRowList"); + b.ToTable("sales_order_row"); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.PhaseModel", b => - { - b.Property("PhaseID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PhaseID")); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("PhaseID"); - - b.ToTable("RegPhase"); - - b.HasData( - new - { - PhaseID = 1, - Description = "Taglio tronchetti" - }, - new - { - PhaseID = 2, - Description = "Lavorazione pezzi serramento" - }, - new - { - PhaseID = 3, - Description = "Verniciatura" - }, - new - { - PhaseID = 4, - Description = "Assemblaggio completo" - }, - new - { - PhaseID = 5, - Description = "Assemblaggio Ferramenta" - }, - new - { - PhaseID = 6, - Description = "Installazione e posa in opera" - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ProductionBatchModel", b => - { - b.Property("ProductionBatchID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProductionBatchID")); - - b.Property("DateEnd") - .HasColumnType("datetime(6)"); - - b.Property("DateStart") - .HasColumnType("datetime(6)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("DueDate") - .HasColumnType("datetime(6)"); - - b.HasKey("ProductionBatchID"); - - b.ToTable("ProductionBatch"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ProductionItemModel", b => - { - b.Property("ProdItemID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProdItemID")); - - b.Property("ExtItemCode") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ItemCode") - .HasColumnType("int"); - - b.Property("OrderRowID") - .HasColumnType("int"); - - b.Property("ProductionBatchID") - .HasColumnType("int"); - - b.HasKey("ProdItemID"); - - b.HasIndex("OrderRowID"); - - b.HasIndex("ProductionBatchID"); - - b.ToTable("ProductionItem"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ProductionItemRowModel", b => - { - b.Property("ProdItemRowID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProdItemRowID")); - - b.Property("DateEnd") - .HasColumnType("datetime(6)"); - - b.Property("DateStart") - .HasColumnType("datetime(6)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Index") - .HasColumnType("int"); - - b.Property("PhaseID") - .HasColumnType("int"); - - b.Property("ProdItemID") - .HasColumnType("int"); - - b.Property("Qty") - .HasColumnType("double"); - - b.Property("ResourceID") - .HasColumnType("int"); - - b.Property("WorkTime") - .HasColumnType("double"); - - b.HasKey("ProdItemRowID"); - - b.HasIndex("PhaseID"); - - b.HasIndex("ProdItemID"); - - b.HasIndex("ResourceID"); - - b.ToTable("ProductionItemRowList"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ResourceModel", b => - { - b.Property("ResourceID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ResourceID")); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsAsset") - .HasColumnType("tinyint(1)"); - - b.Property("IsHuman") - .HasColumnType("tinyint(1)"); - - b.Property("UmFix") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("UmProp") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("UnitCostFix") - .HasColumnType("double"); - - b.Property("UnitCostProp") - .HasColumnType("double"); - - b.HasKey("ResourceID"); - - b.ToTable("RegResource"); - - b.HasData( - new - { - ResourceID = 1, - Description = "Sezionatrice", - IsAsset = true, - IsHuman = false, - UmFix = "€/h", - UmProp = "", - UnitCostFix = 15.0, - UnitCostProp = 0.0 - }, - new - { - ResourceID = 2, - Description = "Linea SAOMAD WoodPecker Just 3500", - IsAsset = true, - IsHuman = false, - UmFix = "€/h", - UmProp = "€/m", - UnitCostFix = 240.0, - UnitCostProp = 1.8999999999999999 - }, - new - { - ResourceID = 3, - Description = "Linea Pantografo", - IsAsset = true, - IsHuman = false, - UmFix = "€/h", - UmProp = "€/m", - UnitCostFix = 90.0, - UnitCostProp = 5.9000000000000004 - }, - new - { - ResourceID = 4, - Description = "Stazione Verniciatura", - IsAsset = true, - IsHuman = false, - UmFix = "€/h", - UmProp = "€/m", - UnitCostFix = 40.0, - UnitCostProp = 1.8999999999999999 - }, - new - { - ResourceID = 5, - Description = "Verniciatura Manuale", - IsAsset = false, - IsHuman = true, - UmFix = "€/h", - UmProp = "€/m", - UnitCostFix = 10.0, - UnitCostProp = 1.8999999999999999 - }, - new - { - ResourceID = 6, - Description = "Montaggio Manuale", - IsAsset = false, - IsHuman = true, - UmFix = "", - UmProp = "€/h", - UnitCostFix = 0.0, - UnitCostProp = 40.0 - }, - new - { - ResourceID = 7, - Description = "Installatore", - IsAsset = false, - IsHuman = true, - UmFix = "", - UmProp = "€/h", - UnitCostFix = 0.0, - UnitCostProp = 40.0 - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.SellingItemModel", b => - { - b.Property("SellingItemID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SellingItemID")); - - b.Property("Cost") - .HasColumnType("double"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ExtItemCode") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsService") - .HasColumnType("tinyint(1)"); - - b.Property("ItemCode") - .HasColumnType("int"); - - b.Property("ItemSPP") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("JobID") - .HasColumnType("int"); - - b.Property("Margin") - .HasColumnType("double"); - - b.Property("SerStruct") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("SupplCode") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("UM") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("SellingItemID"); - - b.HasIndex("JobID"); - - b.ToTable("SellingItem"); - - b.HasData( - new - { - SellingItemID = 1, - Cost = 820.0, - Description = "Finestra anta Singola", - ExtItemCode = "", - IsService = false, - ItemCode = 0, - ItemSPP = "", - JobID = 2, - Margin = 0.20000000000000001, - SerStruct = "", - SupplCode = "", - UM = "#" - }, - new - { - SellingItemID = 2, - Cost = 150.0, - Description = "Persiana anta singola", - ExtItemCode = "", - IsService = false, - ItemCode = 0, - ItemSPP = "", - JobID = 1, - Margin = 0.10000000000000001, - SerStruct = "", - SupplCode = "", - UM = "#" - }, - new - { - SellingItemID = 3, - Cost = 200.0, - Description = "Installazione", - ExtItemCode = "", - IsService = true, - ItemCode = 0, - ItemSPP = "", - JobID = 1, - Margin = 0.29999999999999999, - SerStruct = "", - SupplCode = "", - UM = "#" - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.StockMovModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Stock.StockMovModel", b => { b.Property("StockMovID") .ValueGeneratedOnAdd() @@ -1393,15 +1844,15 @@ namespace EgwCoreLib.Lux.Data.Migrations b.HasIndex("StockStatusId"); - b.ToTable("StockMov"); + b.ToTable("stock_mov"); b.HasData( new { StockMovID = 1, CodDoc = "", - DtCreate = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8693), - DtMod = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8782), + DtCreate = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3856), + DtMod = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3906), MovCod = "CAR", Note = "DEMO", QtyRec = 5.0, @@ -1413,8 +1864,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 2, CodDoc = "", - DtCreate = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8785), - DtMod = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8787), + DtCreate = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3909), + DtMod = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3910), MovCod = "CAR", Note = "DEMO", QtyRec = 8.0, @@ -1426,8 +1877,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 3, CodDoc = "", - DtCreate = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8790), - DtMod = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8792), + DtCreate = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3912), + DtMod = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3913), MovCod = "CAR", Note = "DEMO", QtyRec = 5.0, @@ -1439,8 +1890,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 4, CodDoc = "", - DtCreate = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8794), - DtMod = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8796), + DtCreate = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3916), + DtMod = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3917), MovCod = "CAR", Note = "DEMO", QtyRec = 1.0, @@ -1452,8 +1903,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 5, CodDoc = "", - DtCreate = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8799), - DtMod = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8801), + DtCreate = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3919), + DtMod = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3921), MovCod = "CAR", Note = "DEMO", QtyRec = 10.0, @@ -1465,8 +1916,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 6, CodDoc = "", - DtCreate = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8803), - DtMod = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8805), + DtCreate = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3923), + DtMod = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3924), MovCod = "CAR", Note = "DEMO", QtyRec = 1.0, @@ -1478,8 +1929,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 7, CodDoc = "", - DtCreate = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8808), - DtMod = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8809), + DtCreate = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3926), + DtMod = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3928), MovCod = "CAR", Note = "DEMO", QtyRec = 50.0, @@ -1491,8 +1942,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 8, CodDoc = "", - DtCreate = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8812), - DtMod = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8814), + DtCreate = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3930), + DtMod = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3931), MovCod = "CAR", Note = "DEMO", QtyRec = 1.0, @@ -1504,8 +1955,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 9, CodDoc = "", - DtCreate = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8817), - DtMod = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8818), + DtCreate = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3934), + DtMod = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3935), MovCod = "CAR", Note = "DEMO", QtyRec = 1.0, @@ -1517,8 +1968,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 10, CodDoc = "", - DtCreate = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8821), - DtMod = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8823), + DtCreate = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3937), + DtMod = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3939), MovCod = "CAR", Note = "DEMO", QtyRec = 1.0, @@ -1528,7 +1979,7 @@ namespace EgwCoreLib.Lux.Data.Migrations }); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.StockStatusModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Stock.StockStatusModel", b => { b.Property("StockStatusId") .ValueGeneratedOnAdd() @@ -1556,7 +2007,7 @@ namespace EgwCoreLib.Lux.Data.Migrations b.HasIndex("ItemID"); - b.ToTable("StockStatus"); + b.ToTable("stock_status"); b.HasData( new @@ -1651,62 +2102,462 @@ namespace EgwCoreLib.Lux.Data.Migrations }); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.SupplierModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.JobModel", b => { - b.Property("SupplierID") + b.Property("JobID") .ValueGeneratedOnAdd() .HasColumnType("int"); - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SupplierID")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobID")); - b.Property("CompanyName") + b.Property("Description") .IsRequired() .HasColumnType("longtext"); - b.Property("FirstName") - .IsRequired() - .HasColumnType("longtext"); + b.HasKey("JobID"); - b.Property("LastName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("VAT") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("SupplierID"); - - b.ToTable("RegSupplier"); + b.ToTable("task_job"); b.HasData( new { - SupplierID = 1, - CompanyName = "Company One", - FirstName = "Supplier A", - LastName = "Egalware", - VAT = "7294857103879254" + JobID = 1, + Description = "Rivendita / servizi" }, new { - SupplierID = 2, - CompanyName = "Company Two", - FirstName = "Supplier B", - LastName = "User", - VAT = "7294857103879254" + JobID = 2, + Description = "Serramento Completo Legno su linea Saomad e installatore interno" }, new { - SupplierID = 3, - CompanyName = "Company Two", - FirstName = "Supplier C", - LastName = "User Test", - VAT = "7294857103879254" + JobID = 3, + Description = "Realizzazione Trave" + }, + new + { + JobID = 4, + Description = "Realizzazione Cabinet" + }, + new + { + JobID = 5, + Description = "Realizzazione Parete" }); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.TagsModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.JobStepItemModel", b => + { + b.Property("JobStepItemID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobStepItemID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("ItemID") + .HasColumnType("int"); + + b.Property("JobStepID") + .HasColumnType("int"); + + b.Property("Qty") + .HasColumnType("double"); + + b.HasKey("JobStepItemID"); + + b.HasIndex("ItemID"); + + b.HasIndex("JobStepID"); + + b.ToTable("task_job_step_item"); + + b.HasData( + new + { + JobStepItemID = 1, + Description = "Grezzo legno abete", + Index = 1, + ItemID = 1, + JobStepID = 1, + Qty = 1.0 + }, + new + { + JobStepItemID = 2, + Description = "Vernice trasparente standard 1L", + Index = 2, + ItemID = 8, + JobStepID = 3, + Qty = 0.10000000000000001 + }, + new + { + JobStepItemID = 3, + Description = "Ferramenta AGB - rif. AGFD.00000.00000", + Index = 3, + ItemID = 9, + JobStepID = 4, + Qty = 1.0 + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.JobStepModel", b => + { + b.Property("JobStepID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobStepID")); + + b.Property("CostDriverID") + .HasColumnType("int"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("JobID") + .HasColumnType("int"); + + b.Property("PhaseID") + .HasColumnType("int"); + + b.Property("ProductivityRate") + .HasColumnType("decimal(65,30)"); + + b.Property("ResourceID") + .HasColumnType("int"); + + b.HasKey("JobStepID"); + + b.HasIndex("CostDriverID"); + + b.HasIndex("JobID"); + + b.HasIndex("PhaseID"); + + b.HasIndex("ResourceID"); + + b.ToTable("task_job_step"); + + b.HasData( + new + { + JobStepID = 1, + CostDriverID = 3, + Description = "", + Index = 1, + JobID = 2, + PhaseID = 1, + ProductivityRate = 1m, + ResourceID = 1 + }, + new + { + JobStepID = 2, + CostDriverID = 2, + Description = "", + Index = 2, + JobID = 2, + PhaseID = 2, + ProductivityRate = 1m, + ResourceID = 2 + }, + new + { + JobStepID = 3, + CostDriverID = 3, + Description = "", + Index = 3, + JobID = 2, + PhaseID = 3, + ProductivityRate = 1m, + ResourceID = 4 + }, + new + { + JobStepID = 4, + CostDriverID = 3, + Description = "", + Index = 4, + JobID = 2, + PhaseID = 4, + ProductivityRate = 1m, + ResourceID = 6 + }, + new + { + JobStepID = 5, + CostDriverID = 3, + Description = "", + Index = 5, + JobID = 2, + PhaseID = 6, + ProductivityRate = 1m, + ResourceID = 7 + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.PhaseModel", b => + { + b.Property("PhaseID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PhaseID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("PhaseID"); + + b.ToTable("task_phase"); + + b.HasData( + new + { + PhaseID = 1, + Description = "Taglio tronchetti" + }, + new + { + PhaseID = 2, + Description = "Lavorazione pezzi serramento" + }, + new + { + PhaseID = 3, + Description = "Verniciatura" + }, + new + { + PhaseID = 4, + Description = "Assemblaggio completo" + }, + new + { + PhaseID = 5, + Description = "Assemblaggio Ferramenta" + }, + new + { + PhaseID = 6, + Description = "Installazione e posa in opera" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.CounterModel", b => + { + b.Property("RefYear") + .HasColumnType("int"); + + b.Property("CountName") + .HasColumnType("varchar(255)"); + + b.Property("Counter") + .HasColumnType("int"); + + b.HasKey("RefYear", "CountName"); + + b.ToTable("utils_counter"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.GenClassModel", b => + { + b.Property("ClassCod") + .HasColumnType("varchar(255)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("ClassCod"); + + b.ToTable("utils_gen_class"); + + b.HasData( + new + { + ClassCod = "ShapeList", + Description = "Elenco Shape Gestite" + }, + new + { + ClassCod = "WoodCol", + Description = "Elenco Colori Legno" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.GenValueModel", b => + { + b.Property("GenValID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("GenValID")); + + b.Property("ClassCod") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("Ordinal") + .HasColumnType("int"); + + b.Property("ValString") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("GenValID"); + + b.HasIndex("ClassCod"); + + b.ToTable("utils_gen_value"); + + b.HasData( + new + { + GenValID = 1, + ClassCod = "WoodCol", + Ordinal = 1, + ValString = "Blue" + }, + new + { + GenValID = 2, + ClassCod = "WoodCol", + Ordinal = 2, + ValString = "White" + }, + new + { + GenValID = 3, + ClassCod = "WoodCol", + Ordinal = 3, + ValString = "Red" + }, + new + { + GenValID = 4, + ClassCod = "WoodCol", + Ordinal = 4, + ValString = "Black" + }, + new + { + GenValID = 5, + ClassCod = "ShapeList", + Ordinal = 1, + ValString = "Rectangular" + }, + new + { + GenValID = 6, + ClassCod = "ShapeList", + Ordinal = 2, + ValString = "Trapezoidal" + }, + new + { + GenValID = 7, + ClassCod = "ShapeList", + Ordinal = 3, + ValString = "Triangular" + }, + new + { + GenValID = 8, + ClassCod = "ShapeList", + Ordinal = 4, + ValString = "Arc" + }, + new + { + GenValID = 9, + ClassCod = "ShapeList", + Ordinal = 5, + ValString = "FullArc" + }, + new + { + GenValID = 10, + ClassCod = "ShapeList", + Ordinal = 6, + ValString = "SemiFullArc" + }, + new + { + GenValID = 11, + ClassCod = "ShapeList", + Ordinal = 7, + ValString = "SemiArc" + }, + new + { + GenValID = 12, + ClassCod = "ShapeList", + Ordinal = 8, + ValString = "Circular" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.MovTypeModel", b => + { + b.Property("MovCod") + .HasColumnType("varchar(255)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("MovCod"); + + b.ToTable("utils_mov_type"); + + b.HasData( + new + { + MovCod = "CAR", + Description = "Carico a magazzino" + }, + new + { + MovCod = "MOV", + Description = "Movimento interno (spostamento)" + }, + new + { + MovCod = "ND", + Description = "Non Definito" + }, + new + { + MovCod = "OFOR", + Description = "Ordine Fornitore" + }, + new + { + MovCod = "RETT", + Description = "Rettifica magazzino" + }, + new + { + MovCod = "SCAR", + Description = "Scarico da magazzino" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.TagsModel", b => { b.Property("TagID") .ValueGeneratedOnAdd() @@ -1720,7 +2571,7 @@ namespace EgwCoreLib.Lux.Data.Migrations b.HasKey("TagID"); - b.ToTable("RegTags"); + b.ToTable("utils_tags"); b.HasData( new @@ -1750,9 +2601,20 @@ namespace EgwCoreLib.Lux.Data.Migrations }); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ItemModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Cost.ResourceModel", b => { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.ItemGroupModel", "ItemGroupNav") + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Cost.CostDriverModel", "DriverNav") + .WithMany() + .HasForeignKey("CostDriverID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("DriverNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.ItemModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Items.ItemGroupModel", "ItemGroupNav") .WithMany() .HasForeignKey("CodGroup") .OnDelete(DeleteBehavior.Restrict) @@ -1761,145 +2623,26 @@ namespace EgwCoreLib.Lux.Data.Migrations b.Navigation("ItemGroupNav"); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.JobRowItemModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.SellingItemModel", b => { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.ItemModel", "ItemNav") - .WithMany() - .HasForeignKey("ItemID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.JobRowModel", "JobRowNav") - .WithMany() - .HasForeignKey("JobRowID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("ItemNav"); - - b.Navigation("JobRowNav"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.JobRowModel", b => - { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.JobModel", "JobNav") + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Task.JobModel", "JobNav") .WithMany() .HasForeignKey("JobID") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); - b.HasOne("EgwCoreLib.Lux.Data.DbModel.PhaseModel", "PhaseNav") - .WithMany() - .HasForeignKey("PhaseID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.ResourceModel", "ResourceNav") - .WithMany() - .HasForeignKey("ResourceID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - b.Navigation("JobNav"); - - b.Navigation("PhaseNav"); - - b.Navigation("ResourceNav"); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OfferModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Production.ProductionItemModel", b => { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.CustomerModel", "CustomerNav") - .WithMany() - .HasForeignKey("CustomerID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.DealerModel", "DealerNav") - .WithMany() - .HasForeignKey("DealerID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CustomerNav"); - - b.Navigation("DealerNav"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OfferRowModel", b => - { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.OfferModel", "OfferNav") - .WithMany("OfferRowNav") - .HasForeignKey("OfferID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.SellingItemModel", "SellingItemNav") - .WithMany() - .HasForeignKey("SellingItemID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("OfferNav"); - - b.Navigation("SellingItemNav"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OrderModel", b => - { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.CustomerModel", "CustomerNav") - .WithMany() - .HasForeignKey("CustomerID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.DealerModel", "DealerNav") - .WithMany() - .HasForeignKey("DealerID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.OfferModel", "OfferNav") - .WithMany() - .HasForeignKey("OfferID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CustomerNav"); - - b.Navigation("DealerNav"); - - b.Navigation("OfferNav"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OrderRowModel", b => - { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.OrderModel", "OrderNav") - .WithMany() - .HasForeignKey("OrderID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.SellingItemModel", "SellingItemNav") - .WithMany() - .HasForeignKey("SellingItemID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("OrderNav"); - - b.Navigation("SellingItemNav"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ProductionItemModel", b => - { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.OrderRowModel", "OrderRowNav") + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.OrderRowModel", "OrderRowNav") .WithMany() .HasForeignKey("OrderRowID") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); - b.HasOne("EgwCoreLib.Lux.Data.DbModel.ProductionBatchModel", "ProductionBatchNav") + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Production.ProductionBatchModel", "ProductionBatchNav") .WithMany() .HasForeignKey("ProductionBatchID") .OnDelete(DeleteBehavior.Restrict) @@ -1910,21 +2653,21 @@ namespace EgwCoreLib.Lux.Data.Migrations b.Navigation("ProductionBatchNav"); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ProductionItemRowModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Production.ProductionItemStepModel", b => { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.PhaseModel", "PhaseNav") + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Task.PhaseModel", "PhaseNav") .WithMany() .HasForeignKey("PhaseID") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); - b.HasOne("EgwCoreLib.Lux.Data.DbModel.ProductionItemModel", "ProdItemNav") + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Production.ProductionItemModel", "ProdItemNav") .WithMany() .HasForeignKey("ProdItemID") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); - b.HasOne("EgwCoreLib.Lux.Data.DbModel.ResourceModel", "ResourceNav") + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Cost.ResourceModel", "ResourceNav") .WithMany() .HasForeignKey("ResourceID") .OnDelete(DeleteBehavior.Restrict) @@ -1937,26 +2680,99 @@ namespace EgwCoreLib.Lux.Data.Migrations b.Navigation("ResourceNav"); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.SellingItemModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OfferModel", b => { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.JobModel", "JobNav") + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.CustomerModel", "CustomerNav") .WithMany() - .HasForeignKey("JobID") + .HasForeignKey("CustomerID") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); - b.Navigation("JobNav"); + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.DealerModel", "DealerNav") + .WithMany() + .HasForeignKey("DealerID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CustomerNav"); + + b.Navigation("DealerNav"); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.StockMovModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OfferRowModel", b => { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.MovTypeModel", "MovTypeNav") + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.OfferModel", "OfferNav") + .WithMany("OfferRowNav") + .HasForeignKey("OfferID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Items.SellingItemModel", "SellingItemNav") + .WithMany() + .HasForeignKey("SellingItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("OfferNav"); + + b.Navigation("SellingItemNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OrderModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.CustomerModel", "CustomerNav") + .WithMany() + .HasForeignKey("CustomerID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.DealerModel", "DealerNav") + .WithMany() + .HasForeignKey("DealerID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.OfferModel", "OfferNav") + .WithMany() + .HasForeignKey("OfferID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CustomerNav"); + + b.Navigation("DealerNav"); + + b.Navigation("OfferNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OrderRowModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.OrderModel", "OrderNav") + .WithMany() + .HasForeignKey("OrderID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Items.SellingItemModel", "SellingItemNav") + .WithMany() + .HasForeignKey("SellingItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("OrderNav"); + + b.Navigation("SellingItemNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Stock.StockMovModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Utils.MovTypeModel", "MovTypeNav") .WithMany() .HasForeignKey("MovCod") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); - b.HasOne("EgwCoreLib.Lux.Data.DbModel.StockStatusModel", "StockStatusNav") + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Stock.StockStatusModel", "StockStatusNav") .WithMany() .HasForeignKey("StockStatusId") .OnDelete(DeleteBehavior.Restrict) @@ -1967,9 +2783,9 @@ namespace EgwCoreLib.Lux.Data.Migrations b.Navigation("StockStatusNav"); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.StockStatusModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Stock.StockStatusModel", b => { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.ItemModel", "ItemNav") + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Items.ItemModel", "ItemNav") .WithMany() .HasForeignKey("ItemID") .OnDelete(DeleteBehavior.Restrict) @@ -1978,10 +2794,85 @@ namespace EgwCoreLib.Lux.Data.Migrations b.Navigation("ItemNav"); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OfferModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.JobStepItemModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Items.ItemModel", "ItemNav") + .WithMany() + .HasForeignKey("ItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Task.JobStepModel", "JobStepNav") + .WithMany() + .HasForeignKey("JobStepID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ItemNav"); + + b.Navigation("JobStepNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.JobStepModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Cost.CostDriverModel", "DriverNav") + .WithMany() + .HasForeignKey("CostDriverID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Task.JobModel", "JobNav") + .WithMany("JobStepNav") + .HasForeignKey("JobID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Task.PhaseModel", "PhaseNav") + .WithMany() + .HasForeignKey("PhaseID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Cost.ResourceModel", "ResourceNav") + .WithMany() + .HasForeignKey("ResourceID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("DriverNav"); + + b.Navigation("JobNav"); + + b.Navigation("PhaseNav"); + + b.Navigation("ResourceNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.GenValueModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Utils.GenClassModel", "GenClassNav") + .WithMany("GenValNav") + .HasForeignKey("ClassCod") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("GenClassNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OfferModel", b => { b.Navigation("OfferRowNav"); }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.JobModel", b => + { + b.Navigation("JobStepNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.GenClassModel", b => + { + b.Navigation("GenValNav"); + }); #pragma warning restore 612, 618 } } diff --git a/EgwCoreLib.Lux.Data/Migrations/20251020100619_InitDb.cs b/EgwCoreLib.Lux.Data/Migrations/20251020100619_InitDb.cs new file mode 100644 index 00000000..7d2a02fc --- /dev/null +++ b/EgwCoreLib.Lux.Data/Migrations/20251020100619_InitDb.cs @@ -0,0 +1,1354 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional + +namespace EgwCoreLib.Lux.Data.Migrations +{ + /// + public partial class InitDb : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterDatabase() + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "conf_envir", + columns: table => new + { + EnvirID = table.Column(type: "int", nullable: false), + SerStrucKey = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_conf_envir", x => x.EnvirID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "conf_glass", + columns: table => new + { + GlassID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Code = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Description = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Thickness = table.Column(type: "double", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_conf_glass", x => x.GlassID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "conf_profile", + columns: table => new + { + ProfileID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Code = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Description = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Thickness = table.Column(type: "double", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_conf_profile", x => x.ProfileID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "conf_wood", + columns: table => new + { + WoodID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Code = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Description = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Type = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_conf_wood", x => x.WoodID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "cost_driver", + columns: table => new + { + CostDriverID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Unit = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Descript = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_cost_driver", x => x.CostDriverID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "item_group", + columns: table => new + { + CodGroup = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_item_group", x => x.CodGroup); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "item_supplier", + columns: table => new + { + SupplierID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + CompanyName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + FirstName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + LastName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + VAT = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_item_supplier", x => x.SupplierID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "production_batch", + columns: table => new + { + ProductionBatchID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + DueDate = table.Column(type: "datetime(6)", nullable: false), + DateStart = table.Column(type: "datetime(6)", nullable: true), + DateEnd = table.Column(type: "datetime(6)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_production_batch", x => x.ProductionBatchID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "sales_customer", + columns: table => new + { + CustomerID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + CompanyName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + FirstName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + LastName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + VAT = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_sales_customer", x => x.CustomerID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "sales_dealer", + columns: table => new + { + DealerID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + CompanyName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + FirstName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + LastName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + VAT = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_sales_dealer", x => x.DealerID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "task_job", + columns: table => new + { + JobID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_task_job", x => x.JobID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "task_phase", + columns: table => new + { + PhaseID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_task_phase", x => x.PhaseID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "utils_counter", + columns: table => new + { + RefYear = table.Column(type: "int", nullable: false), + CountName = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Counter = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_utils_counter", x => new { x.RefYear, x.CountName }); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "utils_gen_class", + columns: table => new + { + ClassCod = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_utils_gen_class", x => x.ClassCod); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "utils_mov_type", + columns: table => new + { + MovCod = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_utils_mov_type", x => x.MovCod); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "utils_tags", + columns: table => new + { + TagID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_utils_tags", x => x.TagID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "cost_resource", + columns: table => new + { + ResourceID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + CostDriverID = table.Column(type: "int", nullable: false), + CostDriverBudget = table.Column(type: "decimal(65,30)", nullable: false), + FixedCost = table.Column(type: "decimal(65,30)", nullable: false), + VariableCost = table.Column(type: "decimal(65,30)", nullable: false), + LaborCost = table.Column(type: "decimal(65,30)", nullable: false), + OverHeadCost = table.Column(type: "decimal(65,30)", nullable: false), + OverHeadPerc = table.Column(type: "decimal(65,30)", nullable: false), + EBTPerc = table.Column(type: "decimal(65,30)", nullable: false), + PriceMargin = table.Column(type: "decimal(65,30)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_cost_resource", x => x.ResourceID); + table.ForeignKey( + name: "FK_cost_resource_cost_driver_CostDriverID", + column: x => x.CostDriverID, + principalTable: "cost_driver", + principalColumn: "CostDriverID", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "item_item", + columns: table => new + { + ItemID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + CodGroup = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ItemType = table.Column(type: "int", nullable: false), + IsService = table.Column(type: "tinyint(1)", nullable: false), + ItemCode = table.Column(type: "int", nullable: false), + ExtItemCode = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + SupplCode = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Cost = table.Column(type: "double", nullable: false), + Margin = table.Column(type: "double", nullable: false), + QtyMin = table.Column(type: "double", nullable: false), + QtyMax = table.Column(type: "double", nullable: false), + UM = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ItemIDParent = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_item_item", x => x.ItemID); + table.ForeignKey( + name: "FK_item_item_item_group_CodGroup", + column: x => x.CodGroup, + principalTable: "item_group", + principalColumn: "CodGroup", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "sales_offer", + columns: table => new + { + OfferID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Envir = table.Column(type: "int", nullable: false), + RefYear = table.Column(type: "int", nullable: false), + RefNum = table.Column(type: "int", nullable: false), + RefRev = table.Column(type: "int", nullable: false), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + CustomerID = table.Column(type: "int", nullable: false), + DealerID = table.Column(type: "int", nullable: false), + DictPresel = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ConsNote = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ValidUntil = table.Column(type: "datetime(6)", nullable: false), + Inserted = table.Column(type: "datetime(6)", nullable: false), + Modified = table.Column(type: "datetime(6)", nullable: false), + OffertState = table.Column(type: "int", nullable: false), + Discount = table.Column(type: "double", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_sales_offer", x => x.OfferID); + table.ForeignKey( + name: "FK_sales_offer_sales_customer_CustomerID", + column: x => x.CustomerID, + principalTable: "sales_customer", + principalColumn: "CustomerID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_sales_offer_sales_dealer_DealerID", + column: x => x.DealerID, + principalTable: "sales_dealer", + principalColumn: "DealerID", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "item_selling_item", + columns: table => new + { + SellingItemID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Envir = table.Column(type: "int", nullable: false), + IsService = table.Column(type: "tinyint(1)", nullable: false), + JobID = table.Column(type: "int", nullable: false), + ItemCode = table.Column(type: "int", nullable: false), + ExtItemCode = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + SupplCode = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Cost = table.Column(type: "double", nullable: false), + Margin = table.Column(type: "double", nullable: false), + UM = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + SerStruct = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ItemSteps = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_item_selling_item", x => x.SellingItemID); + table.ForeignKey( + name: "FK_item_selling_item_task_job_JobID", + column: x => x.JobID, + principalTable: "task_job", + principalColumn: "JobID", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "utils_gen_value", + columns: table => new + { + GenValID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ClassCod = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Ordinal = table.Column(type: "int", nullable: false), + ValString = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_utils_gen_value", x => x.GenValID); + table.ForeignKey( + name: "FK_utils_gen_value_utils_gen_class_ClassCod", + column: x => x.ClassCod, + principalTable: "utils_gen_class", + principalColumn: "ClassCod", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "task_job_step", + columns: table => new + { + JobStepID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + JobID = table.Column(type: "int", nullable: false), + Index = table.Column(type: "int", nullable: false), + CostDriverID = table.Column(type: "int", nullable: false), + PhaseID = table.Column(type: "int", nullable: false), + ResourceID = table.Column(type: "int", nullable: false), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ProductivityRate = table.Column(type: "decimal(65,30)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_task_job_step", x => x.JobStepID); + table.ForeignKey( + name: "FK_task_job_step_cost_driver_CostDriverID", + column: x => x.CostDriverID, + principalTable: "cost_driver", + principalColumn: "CostDriverID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_task_job_step_cost_resource_ResourceID", + column: x => x.ResourceID, + principalTable: "cost_resource", + principalColumn: "ResourceID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_task_job_step_task_job_JobID", + column: x => x.JobID, + principalTable: "task_job", + principalColumn: "JobID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_task_job_step_task_phase_PhaseID", + column: x => x.PhaseID, + principalTable: "task_phase", + principalColumn: "PhaseID", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "stock_status", + columns: table => new + { + StockStatusId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ItemID = table.Column(type: "int", nullable: false), + QtyAvail = table.Column(type: "double", nullable: false), + IsDeleted = table.Column(type: "tinyint(1)", nullable: false), + IsRemn = table.Column(type: "tinyint(1)", nullable: false), + Location = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_stock_status", x => x.StockStatusId); + table.ForeignKey( + name: "FK_stock_status_item_item_ItemID", + column: x => x.ItemID, + principalTable: "item_item", + principalColumn: "ItemID", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "sales_order", + columns: table => new + { + OrderID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + OfferID = table.Column(type: "int", nullable: false), + RefYear = table.Column(type: "int", nullable: false), + RefNum = table.Column(type: "int", nullable: false), + RefRev = table.Column(type: "int", nullable: false), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + CustomerID = table.Column(type: "int", nullable: false), + DealerID = table.Column(type: "int", nullable: false), + ConsNote = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + DictPresel = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ValidUntil = table.Column(type: "datetime(6)", nullable: false), + Inserted = table.Column(type: "datetime(6)", nullable: false), + Modified = table.Column(type: "datetime(6)", nullable: false), + OffertState = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_sales_order", x => x.OrderID); + table.ForeignKey( + name: "FK_sales_order_sales_customer_CustomerID", + column: x => x.CustomerID, + principalTable: "sales_customer", + principalColumn: "CustomerID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_sales_order_sales_dealer_DealerID", + column: x => x.DealerID, + principalTable: "sales_dealer", + principalColumn: "DealerID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_sales_order_sales_offer_OfferID", + column: x => x.OfferID, + principalTable: "sales_offer", + principalColumn: "OfferID", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "sales_offer_row", + columns: table => new + { + OfferRowID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + OfferID = table.Column(type: "int", nullable: false), + RowNum = table.Column(type: "int", nullable: false), + Envir = table.Column(type: "int", nullable: false), + OfferRowUID = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + SellingItemID = table.Column(type: "int", nullable: false), + Qty = table.Column(type: "double", nullable: false), + BomCost = table.Column(type: "double", nullable: false), + BomPrice = table.Column(type: "double", nullable: false), + StepCost = table.Column(type: "double", nullable: false), + StepPrice = table.Column(type: "double", nullable: false), + SerStruct = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + FileResource = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + FileName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + FileSize = table.Column(type: "bigint", nullable: false), + ItemSteps = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ItemBOM = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + BomOk = table.Column(type: "tinyint(1)", nullable: false), + ItemOk = table.Column(type: "tinyint(1)", nullable: false), + Note = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Inserted = table.Column(type: "datetime(6)", nullable: false), + Modified = table.Column(type: "datetime(6)", nullable: false), + AwaitBom = table.Column(type: "tinyint(1)", nullable: false), + AwaitPrice = table.Column(type: "tinyint(1)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_sales_offer_row", x => x.OfferRowID); + table.ForeignKey( + name: "FK_sales_offer_row_item_selling_item_SellingItemID", + column: x => x.SellingItemID, + principalTable: "item_selling_item", + principalColumn: "SellingItemID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_sales_offer_row_sales_offer_OfferID", + column: x => x.OfferID, + principalTable: "sales_offer", + principalColumn: "OfferID", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "task_job_step_item", + columns: table => new + { + JobStepItemID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + JobStepID = table.Column(type: "int", nullable: false), + Index = table.Column(type: "int", nullable: false), + ItemID = table.Column(type: "int", nullable: false), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Qty = table.Column(type: "double", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_task_job_step_item", x => x.JobStepItemID); + table.ForeignKey( + name: "FK_task_job_step_item_item_item_ItemID", + column: x => x.ItemID, + principalTable: "item_item", + principalColumn: "ItemID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_task_job_step_item_task_job_step_JobStepID", + column: x => x.JobStepID, + principalTable: "task_job_step", + principalColumn: "JobStepID", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "stock_mov", + columns: table => new + { + StockMovID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + StockStatusId = table.Column(type: "int", nullable: false), + DtCreate = table.Column(type: "timestamp", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), + DtMod = table.Column(type: "timestamp", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn), + QtyRec = table.Column(type: "double", nullable: false), + UnitVal = table.Column(type: "double", nullable: false), + UserId = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + MovCod = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + CodDoc = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Note = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_stock_mov", x => x.StockMovID); + table.ForeignKey( + name: "FK_stock_mov_stock_status_StockStatusId", + column: x => x.StockStatusId, + principalTable: "stock_status", + principalColumn: "StockStatusId", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_stock_mov_utils_mov_type_MovCod", + column: x => x.MovCod, + principalTable: "utils_mov_type", + principalColumn: "MovCod", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "sales_order_row", + columns: table => new + { + OrderRowID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + OrderID = table.Column(type: "int", nullable: false), + RowNum = table.Column(type: "int", nullable: false), + SellingItemID = table.Column(type: "int", nullable: false), + BomCost = table.Column(type: "double", nullable: false), + Qty = table.Column(type: "double", nullable: false), + BomPrice = table.Column(type: "double", nullable: false), + StepCost = table.Column(type: "double", nullable: false), + StepPrice = table.Column(type: "double", nullable: false), + SerStruct = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ItemSteps = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Note = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Inserted = table.Column(type: "datetime(6)", nullable: false), + Modified = table.Column(type: "datetime(6)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_sales_order_row", x => x.OrderRowID); + table.ForeignKey( + name: "FK_sales_order_row_item_selling_item_SellingItemID", + column: x => x.SellingItemID, + principalTable: "item_selling_item", + principalColumn: "SellingItemID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_sales_order_row_sales_order_OrderID", + column: x => x.OrderID, + principalTable: "sales_order", + principalColumn: "OrderID", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "production_item", + columns: table => new + { + ProdItemID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + OrderRowID = table.Column(type: "int", nullable: false), + ItemCode = table.Column(type: "int", nullable: false), + ExtItemCode = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ProductionBatchID = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_production_item", x => x.ProdItemID); + table.ForeignKey( + name: "FK_production_item_production_batch_ProductionBatchID", + column: x => x.ProductionBatchID, + principalTable: "production_batch", + principalColumn: "ProductionBatchID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_production_item_sales_order_row_OrderRowID", + column: x => x.OrderRowID, + principalTable: "sales_order_row", + principalColumn: "OrderRowID", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "production_item_step", + columns: table => new + { + ProdItemStepID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ProdItemID = table.Column(type: "int", nullable: false), + Index = table.Column(type: "int", nullable: false), + PhaseID = table.Column(type: "int", nullable: false), + ResourceID = table.Column(type: "int", nullable: false), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Qty = table.Column(type: "double", nullable: false), + DateStart = table.Column(type: "datetime(6)", nullable: true), + DateEnd = table.Column(type: "datetime(6)", nullable: true), + WorkTime = table.Column(type: "double", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_production_item_step", x => x.ProdItemStepID); + table.ForeignKey( + name: "FK_production_item_step_cost_resource_ResourceID", + column: x => x.ResourceID, + principalTable: "cost_resource", + principalColumn: "ResourceID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_production_item_step_production_item_ProdItemID", + column: x => x.ProdItemID, + principalTable: "production_item", + principalColumn: "ProdItemID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_production_item_step_task_phase_PhaseID", + column: x => x.PhaseID, + principalTable: "task_phase", + principalColumn: "PhaseID", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.InsertData( + table: "conf_envir", + columns: new[] { "EnvirID", "SerStrucKey" }, + values: new object[,] + { + { 1, "Jwd" }, + { 2, "Btl" }, + { 3, "Btl" }, + { 4, "Btl" } + }); + + migrationBuilder.InsertData( + table: "conf_glass", + columns: new[] { "GlassID", "Code", "Description", "Thickness" }, + values: new object[,] + { + { 1, "0001", "Vetro BE 2S 4/12/4", 20.0 }, + { 2, "0002", "Vetro BE 2S 4/16/4", 24.0 }, + { 3, "0003", "Vetro BE 3S 4/12/4/12/4", 36.0 }, + { 4, "0004", "Vetro BE 3S 4/16/4/16/4", 44.0 }, + { 5, "0005", "Vetro BE 2S 4T/12/4T", 20.0 }, + { 6, "0006", "Vetro BE 2S 4T/16/4T", 24.0 }, + { 7, "0007", "Vetro BE 3S 4T/12/4T/12/4T", 36.0 }, + { 8, "0008", "Vetro BE 3S 4T/16/4T/16/4T", 44.0 } + }); + + migrationBuilder.InsertData( + table: "conf_profile", + columns: new[] { "ProfileID", "Code", "Description", "Thickness" }, + values: new object[,] + { + { 1, "0001", "Profilo60", 60.0 }, + { 2, "0002", "Profilo78", 78.0 }, + { 3, "0003", "Profilo90", 90.0 } + }); + + migrationBuilder.InsertData( + table: "conf_wood", + columns: new[] { "WoodID", "Code", "Description", "Type" }, + values: new object[,] + { + { 1, "0001", "Abete", 1 }, + { 2, "0002", "Acero", 1 }, + { 3, "0003", "Pino", 2 }, + { 4, "0004", "Tek", 3 } + }); + + migrationBuilder.InsertData( + table: "cost_driver", + columns: new[] { "CostDriverID", "Descript", "Name", "Unit" }, + values: new object[,] + { + { 1, "Ore lavorate per step/fase", "WorkHour", "h" }, + { 2, "Metri prodotti per step/fase", "Meter", "m" }, + { 3, "Numero unità prodotte (lavorate) per step/fase", "Unit", "#" } + }); + + migrationBuilder.InsertData( + table: "item_group", + columns: new[] { "CodGroup", "Description" }, + values: new object[,] + { + { "WindowGlass", "Vetri serramento" }, + { "WindowHardware", "Ferramenta serramento" }, + { "WindowTrunk", "Barre legno per lavorazione" }, + { "WindowVarnish", "Vernici per legno" } + }); + + migrationBuilder.InsertData( + table: "item_supplier", + columns: new[] { "SupplierID", "CompanyName", "FirstName", "LastName", "VAT" }, + values: new object[,] + { + { 1, "Company One", "Supplier A", "Egalware", "7294857103879254" }, + { 2, "Company Two", "Supplier B", "User", "7294857103879254" }, + { 3, "Company Two", "Supplier C", "User Test", "7294857103879254" } + }); + + migrationBuilder.InsertData( + table: "sales_customer", + columns: new[] { "CustomerID", "CompanyName", "FirstName", "LastName", "VAT" }, + values: new object[,] + { + { 1, "", "Customer A", "Egalware", "1234567890123456" }, + { 2, "", "Customer B", "User", "1234567890123456" }, + { 3, "", "Customer C", "User Test", "1234567890123456" } + }); + + migrationBuilder.InsertData( + table: "sales_dealer", + columns: new[] { "DealerID", "CompanyName", "FirstName", "LastName", "VAT" }, + values: new object[,] + { + { 1, "Company First", "Dealer A", "Egalware", "9587362514671527" }, + { 2, "Company First", "Dealer B", "User", "9587362514671527" }, + { 3, "Company Second", "Dealer C", "User Test", "9587362514671527" } + }); + + migrationBuilder.InsertData( + table: "task_job", + columns: new[] { "JobID", "Description" }, + values: new object[,] + { + { 1, "Rivendita / servizi" }, + { 2, "Serramento Completo Legno su linea Saomad e installatore interno" }, + { 3, "Realizzazione Trave" }, + { 4, "Realizzazione Cabinet" }, + { 5, "Realizzazione Parete" } + }); + + migrationBuilder.InsertData( + table: "task_phase", + columns: new[] { "PhaseID", "Description" }, + values: new object[,] + { + { 1, "Taglio tronchetti" }, + { 2, "Lavorazione pezzi serramento" }, + { 3, "Verniciatura" }, + { 4, "Assemblaggio completo" }, + { 5, "Assemblaggio Ferramenta" }, + { 6, "Installazione e posa in opera" } + }); + + migrationBuilder.InsertData( + table: "utils_gen_class", + columns: new[] { "ClassCod", "Description" }, + values: new object[,] + { + { "ShapeList", "Elenco Shape Gestite" }, + { "WoodCol", "Elenco Colori Legno" } + }); + + migrationBuilder.InsertData( + table: "utils_mov_type", + columns: new[] { "MovCod", "Description" }, + values: new object[,] + { + { "CAR", "Carico a magazzino" }, + { "MOV", "Movimento interno (spostamento)" }, + { "ND", "Non Definito" }, + { "OFOR", "Ordine Fornitore" }, + { "RETT", "Rettifica magazzino" }, + { "SCAR", "Scarico da magazzino" } + }); + + migrationBuilder.InsertData( + table: "utils_tags", + columns: new[] { "TagID", "Description" }, + values: new object[,] + { + { 1, "Tag 01" }, + { 2, "Tag 02" }, + { 3, "Tag 03" }, + { 4, "Tag 04" }, + { 5, "Tag 05" } + }); + + migrationBuilder.InsertData( + table: "cost_resource", + columns: new[] { "ResourceID", "CostDriverBudget", "CostDriverID", "EBTPerc", "FixedCost", "LaborCost", "Name", "OverHeadCost", "OverHeadPerc", "PriceMargin", "VariableCost" }, + values: new object[,] + { + { 1, 880m, 1, 0.15m, 12000m, 30m, "Sezionatrice", 5000m, 0.15m, 0.2m, 6000m }, + { 2, 1760m, 1, 0.15m, 100000m, 40m, "Linea SAOMAD WoodPecker Just 3500", 15000m, 0.15m, 0.2m, 30000m }, + { 3, 1760m, 1, 0.15m, 24000m, 35m, "Linea Pantografo", 5000m, 0.15m, 0.2m, 6000m }, + { 4, 880m, 1, 0.15m, 24000m, 30m, "Stazione Verniciatura", 3000m, 0.15m, 0.2m, 6000m }, + { 5, 220m, 1, 0.15m, 6000m, 30m, "Verniciatura Manuale", 3000m, 0.15m, 0.2m, 2000m }, + { 6, 3520m, 1, 0.15m, 500m, 30m, "Montaggio Manuale", 500m, 0.15m, 0.2m, 500m }, + { 7, 3520m, 1, 0.15m, 0m, 40m, "Installatore", 0m, 0.15m, 0.2m, 3000m } + }); + + migrationBuilder.InsertData( + table: "item_item", + columns: new[] { "ItemID", "CodGroup", "Cost", "Description", "ExtItemCode", "IsService", "ItemCode", "ItemIDParent", "ItemType", "Margin", "QtyMax", "QtyMin", "SupplCode", "UM" }, + values: new object[,] + { + { 1, "WindowTrunk", 20.0, "BARRA-60x80 generica", "", false, 1001, 0, 1, 0.29999999999999999, 0.0, 0.0, "BARR.001", "#" }, + { 2, "WindowTrunk", 16.5, "Barra 60x80, lunghezza 12m", "BARRA-60x80x12000", false, 1002, 0, 1, 0.20999999999999999, 0.0, 0.0, "ABC.00123.12000", "#" }, + { 3, "WindowTrunk", 17.5, "Barra 60x80, lunghezza 8m", "BARRA-60x80x8000", false, 1003, 0, 1, 0.22, 0.0, 0.0, "ABC.00123.8000", "#" }, + { 4, "WindowTrunk", 15.5, "Barra 60x80, lunghezza 16m", "BARRA-60x80x16000", false, 1004, 0, 1, 0.20000000000000001, 0.0, 0.0, "ABC.00123.16000", "#" }, + { 5, "WindowGlass", 300.0, "Vetro triplo, basso indice termico, 800x1000", "VETRO-3L-THERMO-800x1000", false, 2001, 0, 1, 0.20000000000000001, 0.0, 0.0, "V3T.800.1000", "m2" }, + { 6, "WindowGlass", 200.0, "Vetro doppio, 800x1000", "VETRO-2L-800x1000", false, 2002, 0, 1, 0.14999999999999999, 0.0, 0.0, "V2.800.1000", "m2" }, + { 7, "WindowGlass", 250.0, "Vetro triplo, 800x1000", "VETRO-3L-800x1000", false, 2003, 0, 1, 0.17999999999999999, 0.0, 0.0, "V3.800.1000", "m2" }, + { 8, "WindowVarnish", 20.0, "Vernice trasparente", "VERN-TRASP", false, 3001, 0, 1, 0.20000000000000001, 0.0, 0.0, "VT.STD", "l" }, + { 9, "WindowHardware", 65.0, "Kit standard completo AGB tipo 001", "KIT-001", false, 5001, 0, 1, 0.20000000000000001, 0.0, 0.0, "AGB-KIT-001", "#" }, + { 10, "WindowHardware", 10.0, "Cerniera AGB tipo 001", "CERN-001", false, 5002, 0, 1, 0.20000000000000001, 0.0, 0.0, "AGB-CERN-001", "#" }, + { 11, "WindowHardware", 15.0, "Serratura AGB tipo 001", "SERR-001", false, 5003, 0, 1, 0.20000000000000001, 0.0, 0.0, "AGB-SERR-001", "#" }, + { 12, "WindowHardware", 25.0, "Maniglia AGB tipo 001", "MAN-001", false, 5004, 0, 1, 0.20000000000000001, 0.0, 0.0, "AGB-MAN-001", "#" } + }); + + migrationBuilder.InsertData( + table: "item_selling_item", + columns: new[] { "SellingItemID", "Cost", "Description", "Envir", "ExtItemCode", "IsService", "ItemCode", "ItemSteps", "JobID", "Margin", "SerStruct", "SupplCode", "UM" }, + values: new object[,] + { + { 1, 500.0, "Finestra Anta Singola", 1, "", false, 0, "", 2, 0.20000000000000001, "{\"ProfilePath\":\"Profilo78\",\"Material\":\"Abete\",\"ColorMaterial\":\"White\",\"Glass\":\"Vetro BE 2S 4/12/4\",\"AreaList\":[{\"Shape\":\"RECTANGLE\",\"DimensionList\":[{\"nIndex\":1,\"sName\":\"Width\",\"dValue\":800.0},{\"nIndex\":2,\"sName\":\"Height\",\"dValue\":1200.0}],\"JointList\":[{\"nIndex\":1,\"JointType\":\"FULL_H\"},{\"nIndex\":2,\"JointType\":\"FULL_H\"},{\"nIndex\":3,\"JointType\":\"FULL_H\"},{\"nIndex\":4,\"JointType\":\"FULL_H\"}],\"BottomRail\":false,\"BottomRailQty\":0,\"IdGroup\":1,\"AreaList\":[{\"bIsSashVertical\":true,\"SashList\":[{\"nSashId\":1,\"OpeningType\":\"TILTTURN_LEFT\",\"bHasHandle\":true,\"dDimension\":100.0}],\"SashType\":\"NULL\",\"JointList\":[{\"nIndex\":1,\"JointType\":\"FULL_H\"},{\"nIndex\":2,\"JointType\":\"FULL_H\"},{\"nIndex\":3,\"JointType\":\"FULL_H\"},{\"nIndex\":4,\"JointType\":\"FULL_H\"}],\"BottomRail\":false,\"BottomRailQty\":0,\"Hardware\":\"000558\",\"IdGroup\":2,\"AreaList\":[{\"FillType\":\"GLASS\",\"IdGroup\":3,\"AreaList\":[],\"AreaType\":\"FILL\"}],\"AreaType\":\"SASH\"}],\"AreaType\":\"FRAME\"}]}", "", "#" }, + { 2, 300.0, "Finestra Vetro Fisso ", 1, "", false, 0, "", 2, 0.20000000000000001, "{\"ProfilePath\":\"Profilo78\",\"Material\":\"Abete\",\"ColorMaterial\":\"White\",\"Glass\":\"Vetro BE 2S 4/12/4\",\"AreaList\":[{\"Shape\":\"RECTANGLE\",\"DimensionList\":[{\"nIndex\":1,\"sName\":\"Width\",\"dValue\":800.0},{\"nIndex\":2,\"sName\":\"Height\",\"dValue\":1200.0}],\"JointList\":[{\"nIndex\":1,\"JointType\":\"FULL_H\"},{\"nIndex\":2,\"JointType\":\"FULL_H\"},{\"nIndex\":3,\"JointType\":\"FULL_H\"},{\"nIndex\":4,\"JointType\":\"FULL_H\"}],\"BottomRail\":false,\"BottomRailQty\":0,\"IdGroup\":1,\"AreaList\":[{\"FillType\":\"GLASS\",\"IdGroup\":4,\"AreaList\":[],\"AreaType\":\"FILL\"}],\"AreaType\":\"FRAME\"}]}", "", "#" }, + { 3, 150.0, "Persiana anta singola", 1, "", false, 0, "", 1, 0.10000000000000001, "", "", "#" }, + { 4, 200.0, "Installazione", 1, "", true, 0, "", 1, 0.29999999999999999, "", "", "#" }, + { 5, 1000.0, "Trave lamellare", 2, "", false, 0, "", 3, 0.29999999999999999, "", "", "#" }, + { 6, 500.0, "Cabinet", 4, "", false, 0, "", 4, 0.29999999999999999, "", "", "#" }, + { 7, 2000.0, "Parete", 3, "", false, 0, "", 5, 0.29999999999999999, "", "", "#" } + }); + + migrationBuilder.InsertData( + table: "sales_offer", + columns: new[] { "OfferID", "ConsNote", "CustomerID", "DealerID", "Description", "DictPresel", "Discount", "Envir", "Inserted", "Modified", "OffertState", "RefNum", "RefRev", "RefYear", "ValidUntil" }, + values: new object[,] + { + { 1, "", 2, 2, "Offerta per tre serramenti", "", 0.0, 1, new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4161), new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4162), 0, 1, 1, 2024, new DateTime(2025, 11, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4158) }, + { 2, "", 2, 2, "Offerta BEAM", "", 0.0, 2, new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4169), new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4170), 0, 2, 1, 2024, new DateTime(2025, 11, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4167) }, + { 3, "", 2, 2, "Offerta Cabinet", "", 0.0, 4, new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4175), new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4177), 0, 3, 1, 2024, new DateTime(2025, 11, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4174) }, + { 4, "", 2, 2, "Offerta Wall", "", 0.0, 3, new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4182), new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4183), 0, 4, 1, 2024, new DateTime(2025, 11, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4181) } + }); + + migrationBuilder.InsertData( + table: "utils_gen_value", + columns: new[] { "GenValID", "ClassCod", "Ordinal", "ValString" }, + values: new object[,] + { + { 1, "WoodCol", 1, "Blue" }, + { 2, "WoodCol", 2, "White" }, + { 3, "WoodCol", 3, "Red" }, + { 4, "WoodCol", 4, "Black" }, + { 5, "ShapeList", 1, "Rectangular" }, + { 6, "ShapeList", 2, "Trapezoidal" }, + { 7, "ShapeList", 3, "Triangular" }, + { 8, "ShapeList", 4, "Arc" }, + { 9, "ShapeList", 5, "FullArc" }, + { 10, "ShapeList", 6, "SemiFullArc" }, + { 11, "ShapeList", 7, "SemiArc" }, + { 12, "ShapeList", 8, "Circular" } + }); + + migrationBuilder.InsertData( + table: "sales_offer_row", + columns: new[] { "OfferRowID", "AwaitBom", "AwaitPrice", "BomCost", "BomOk", "BomPrice", "Envir", "FileName", "FileResource", "FileSize", "Inserted", "ItemBOM", "ItemOk", "ItemSteps", "Modified", "Note", "OfferID", "OfferRowUID", "Qty", "RowNum", "SellingItemID", "SerStruct", "StepCost", "StepPrice" }, + values: new object[,] + { + { 1, false, false, 900.0, true, 950.0, 1, "", "", 0L, new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4304), "", true, "{}", new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4306), "Finestra Vetro Fisso 2025", 1, "SOR.25.00000001", 3.0, 1, 2, "{\"ProfilePath\":\"Profilo78\",\"Material\":\"Abete\",\"ColorMaterial\":\"White\",\"Glass\":\"Vetro BE 2S 4/12/4\",\"AreaList\":[{\"Shape\":\"RECTANGLE\",\"DimensionList\":[{\"nIndex\":1,\"sName\":\"Width\",\"dValue\":800.0},{\"nIndex\":2,\"sName\":\"Height\",\"dValue\":1200.0}],\"JointList\":[{\"nIndex\":1,\"JointType\":\"FULL_H\"},{\"nIndex\":2,\"JointType\":\"FULL_H\"},{\"nIndex\":3,\"JointType\":\"FULL_H\"},{\"nIndex\":4,\"JointType\":\"FULL_H\"}],\"BottomRail\":false,\"BottomRailQty\":0,\"IdGroup\":1,\"AreaList\":[{\"FillType\":\"GLASS\",\"IdGroup\":4,\"AreaList\":[],\"AreaType\":\"FILL\"}],\"AreaType\":\"FRAME\"}]}", 0.0, 0.0 }, + { 2, false, false, 900.0, true, 950.0, 1, "", "", 0L, new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4320), "", true, "{}", new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4321), "Finestra Anta Singola 2025", 1, "SOR.25.00000002", 3.0, 1, 1, "{\"ProfilePath\":\"Profilo78\",\"Material\":\"Abete\",\"ColorMaterial\":\"White\",\"Glass\":\"Vetro BE 2S 4/12/4\",\"AreaList\":[{\"Shape\":\"RECTANGLE\",\"DimensionList\":[{\"nIndex\":1,\"sName\":\"Width\",\"dValue\":800.0},{\"nIndex\":2,\"sName\":\"Height\",\"dValue\":1200.0}],\"JointList\":[{\"nIndex\":1,\"JointType\":\"FULL_H\"},{\"nIndex\":2,\"JointType\":\"FULL_H\"},{\"nIndex\":3,\"JointType\":\"FULL_H\"},{\"nIndex\":4,\"JointType\":\"FULL_H\"}],\"BottomRail\":false,\"BottomRailQty\":0,\"IdGroup\":1,\"AreaList\":[{\"bIsSashVertical\":true,\"SashList\":[{\"nSashId\":1,\"OpeningType\":\"TILTTURN_LEFT\",\"bHasHandle\":true,\"dDimension\":100.0}],\"SashType\":\"NULL\",\"JointList\":[{\"nIndex\":1,\"JointType\":\"FULL_H\"},{\"nIndex\":2,\"JointType\":\"FULL_H\"},{\"nIndex\":3,\"JointType\":\"FULL_H\"},{\"nIndex\":4,\"JointType\":\"FULL_H\"}],\"BottomRail\":false,\"BottomRailQty\":0,\"Hardware\":\"000558\",\"IdGroup\":2,\"AreaList\":[{\"FillType\":\"GLASS\",\"IdGroup\":3,\"AreaList\":[],\"AreaType\":\"FILL\"}],\"AreaType\":\"SASH\"}],\"AreaType\":\"FRAME\"}]}", 0.0, 0.0 }, + { 3, false, false, 160.0, true, 200.0, 1, "", "", 0L, new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4332), "", true, "{}", new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4334), "Persiana per Finestra anta singola 2025", 1, "SOR.25.00000003", 3.0, 2, 2, "{}", 0.0, 0.0 }, + { 4, false, false, 200.0, true, 250.0, 1, "", "", 0L, new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4344), "", true, "{}", new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4346), "Installazione serramento", 1, "SOR.25.00000004", 3.0, 3, 3, "{}", 0.0, 0.0 }, + { 5, false, false, 800.0, true, 1150.0, 2, "", "", 0L, new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4376), "", true, "{}", new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4378), "Demo file 01", 2, "SOR.25.00000005", 10.0, 1, 4, "", 0.0, 0.0 }, + { 6, false, false, 600.0, true, 950.0, 2, "", "", 0L, new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4389), "", true, "{}", new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4390), "Demo file 02", 2, "SOR.25.00000006", 4.0, 1, 4, "", 0.0, 0.0 }, + { 7, false, false, 200.0, true, 250.0, 3, "", "", 0L, new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4419), "", true, "{}", new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4421), "Demo file 01", 3, "SOR.25.00000007", 4.0, 1, 5, "", 0.0, 0.0 }, + { 8, false, false, 50.0, true, 80.0, 3, "", "", 0L, new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4432), "", true, "{}", new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4433), "Demo file 02", 3, "SOR.25.00000008", 12.0, 1, 5, "", 0.0, 0.0 }, + { 9, false, false, 800.0, true, 1150.0, 4, "", "", 0L, new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4462), "", true, "{}", new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4464), "Demo file 01", 4, "SOR.25.00000009", 6.0, 1, 6, "", 0.0, 0.0 }, + { 10, false, false, 600.0, true, 950.0, 4, "", "", 0L, new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4475), "", true, "{}", new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4477), "Demo file 02", 4, "SOR.25.0000000A", 4.0, 1, 6, "", 0.0, 0.0 } + }); + + migrationBuilder.InsertData( + table: "stock_status", + columns: new[] { "StockStatusId", "IsDeleted", "IsRemn", "ItemID", "Location", "QtyAvail" }, + values: new object[,] + { + { 1, false, false, 1, "B001-001-003", 5.0 }, + { 2, false, false, 2, "B001-001-002", 8.0 }, + { 3, false, false, 3, "B001-001-001", 5.0 }, + { 4, false, false, 4, "V002-001-001", 1.0 }, + { 5, false, false, 5, "V001-001-002", 10.0 }, + { 6, false, false, 6, "V001-001-003", 1.0 }, + { 7, false, false, 8, "V001-001-003", 50.0 }, + { 8, false, false, 11, "S001-002-001", 1.0 }, + { 9, false, false, 9, "S001-002-001", 1.0 }, + { 10, false, false, 10, "S001-001-001", 1.0 } + }); + + migrationBuilder.InsertData( + table: "task_job_step", + columns: new[] { "JobStepID", "CostDriverID", "Description", "Index", "JobID", "PhaseID", "ProductivityRate", "ResourceID" }, + values: new object[,] + { + { 1, 3, "", 1, 2, 1, 1m, 1 }, + { 2, 2, "", 2, 2, 2, 1m, 2 }, + { 3, 3, "", 3, 2, 3, 1m, 4 }, + { 4, 3, "", 4, 2, 4, 1m, 6 }, + { 5, 3, "", 5, 2, 6, 1m, 7 } + }); + + migrationBuilder.InsertData( + table: "stock_mov", + columns: new[] { "StockMovID", "CodDoc", "DtCreate", "MovCod", "Note", "QtyRec", "StockStatusId", "UnitVal", "UserId" }, + values: new object[,] + { + { 1, "", new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3856), "CAR", "DEMO", 5.0, 1, 0.0, "samuele.locatelli@egalware.com" }, + { 2, "", new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3909), "CAR", "DEMO", 8.0, 2, 0.0, "samuele.locatelli@egalware.com" }, + { 3, "", new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3912), "CAR", "DEMO", 5.0, 3, 0.0, "samuele.locatelli@egalware.com" }, + { 4, "", new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3916), "CAR", "DEMO", 1.0, 4, 0.0, "samuele.locatelli@egalware.com" }, + { 5, "", new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3919), "CAR", "DEMO", 10.0, 5, 0.0, "samuele.locatelli@egalware.com" }, + { 6, "", new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3923), "CAR", "DEMO", 1.0, 6, 0.0, "samuele.locatelli@egalware.com" }, + { 7, "", new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3926), "CAR", "DEMO", 50.0, 7, 0.0, "samuele.locatelli@egalware.com" }, + { 8, "", new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3930), "CAR", "DEMO", 1.0, 8, 0.0, "samuele.locatelli@egalware.com" }, + { 9, "", new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3934), "CAR", "DEMO", 1.0, 9, 0.0, "samuele.locatelli@egalware.com" }, + { 10, "", new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3937), "CAR", "DEMO", 1.0, 10, 0.0, "samuele.locatelli@egalware.com" } + }); + + migrationBuilder.InsertData( + table: "task_job_step_item", + columns: new[] { "JobStepItemID", "Description", "Index", "ItemID", "JobStepID", "Qty" }, + values: new object[,] + { + { 1, "Grezzo legno abete", 1, 1, 1, 1.0 }, + { 2, "Vernice trasparente standard 1L", 2, 8, 3, 0.10000000000000001 }, + { 3, "Ferramenta AGB - rif. AGFD.00000.00000", 3, 9, 4, 1.0 } + }); + + migrationBuilder.CreateIndex( + name: "IX_cost_resource_CostDriverID", + table: "cost_resource", + column: "CostDriverID"); + + migrationBuilder.CreateIndex( + name: "IX_item_item_CodGroup", + table: "item_item", + column: "CodGroup"); + + migrationBuilder.CreateIndex( + name: "IX_item_selling_item_JobID", + table: "item_selling_item", + column: "JobID"); + + migrationBuilder.CreateIndex( + name: "IX_production_item_OrderRowID", + table: "production_item", + column: "OrderRowID"); + + migrationBuilder.CreateIndex( + name: "IX_production_item_ProductionBatchID", + table: "production_item", + column: "ProductionBatchID"); + + migrationBuilder.CreateIndex( + name: "IX_production_item_step_PhaseID", + table: "production_item_step", + column: "PhaseID"); + + migrationBuilder.CreateIndex( + name: "IX_production_item_step_ProdItemID", + table: "production_item_step", + column: "ProdItemID"); + + migrationBuilder.CreateIndex( + name: "IX_production_item_step_ResourceID", + table: "production_item_step", + column: "ResourceID"); + + migrationBuilder.CreateIndex( + name: "IX_sales_offer_CustomerID", + table: "sales_offer", + column: "CustomerID"); + + migrationBuilder.CreateIndex( + name: "IX_sales_offer_DealerID", + table: "sales_offer", + column: "DealerID"); + + migrationBuilder.CreateIndex( + name: "IX_sales_offer_row_OfferID", + table: "sales_offer_row", + column: "OfferID"); + + migrationBuilder.CreateIndex( + name: "IX_sales_offer_row_SellingItemID", + table: "sales_offer_row", + column: "SellingItemID"); + + migrationBuilder.CreateIndex( + name: "IX_sales_order_CustomerID", + table: "sales_order", + column: "CustomerID"); + + migrationBuilder.CreateIndex( + name: "IX_sales_order_DealerID", + table: "sales_order", + column: "DealerID"); + + migrationBuilder.CreateIndex( + name: "IX_sales_order_OfferID", + table: "sales_order", + column: "OfferID"); + + migrationBuilder.CreateIndex( + name: "IX_sales_order_row_OrderID", + table: "sales_order_row", + column: "OrderID"); + + migrationBuilder.CreateIndex( + name: "IX_sales_order_row_SellingItemID", + table: "sales_order_row", + column: "SellingItemID"); + + migrationBuilder.CreateIndex( + name: "IX_stock_mov_MovCod", + table: "stock_mov", + column: "MovCod"); + + migrationBuilder.CreateIndex( + name: "IX_stock_mov_StockStatusId", + table: "stock_mov", + column: "StockStatusId"); + + migrationBuilder.CreateIndex( + name: "IX_stock_status_ItemID", + table: "stock_status", + column: "ItemID"); + + migrationBuilder.CreateIndex( + name: "IX_task_job_step_CostDriverID", + table: "task_job_step", + column: "CostDriverID"); + + migrationBuilder.CreateIndex( + name: "IX_task_job_step_JobID", + table: "task_job_step", + column: "JobID"); + + migrationBuilder.CreateIndex( + name: "IX_task_job_step_PhaseID", + table: "task_job_step", + column: "PhaseID"); + + migrationBuilder.CreateIndex( + name: "IX_task_job_step_ResourceID", + table: "task_job_step", + column: "ResourceID"); + + migrationBuilder.CreateIndex( + name: "IX_task_job_step_item_ItemID", + table: "task_job_step_item", + column: "ItemID"); + + migrationBuilder.CreateIndex( + name: "IX_task_job_step_item_JobStepID", + table: "task_job_step_item", + column: "JobStepID"); + + migrationBuilder.CreateIndex( + name: "IX_utils_gen_value_ClassCod", + table: "utils_gen_value", + column: "ClassCod"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "conf_envir"); + + migrationBuilder.DropTable( + name: "conf_glass"); + + migrationBuilder.DropTable( + name: "conf_profile"); + + migrationBuilder.DropTable( + name: "conf_wood"); + + migrationBuilder.DropTable( + name: "item_supplier"); + + migrationBuilder.DropTable( + name: "production_item_step"); + + migrationBuilder.DropTable( + name: "sales_offer_row"); + + migrationBuilder.DropTable( + name: "stock_mov"); + + migrationBuilder.DropTable( + name: "task_job_step_item"); + + migrationBuilder.DropTable( + name: "utils_counter"); + + migrationBuilder.DropTable( + name: "utils_gen_value"); + + migrationBuilder.DropTable( + name: "utils_tags"); + + migrationBuilder.DropTable( + name: "production_item"); + + migrationBuilder.DropTable( + name: "stock_status"); + + migrationBuilder.DropTable( + name: "utils_mov_type"); + + migrationBuilder.DropTable( + name: "task_job_step"); + + migrationBuilder.DropTable( + name: "utils_gen_class"); + + migrationBuilder.DropTable( + name: "production_batch"); + + migrationBuilder.DropTable( + name: "sales_order_row"); + + migrationBuilder.DropTable( + name: "item_item"); + + migrationBuilder.DropTable( + name: "cost_resource"); + + migrationBuilder.DropTable( + name: "task_phase"); + + migrationBuilder.DropTable( + name: "item_selling_item"); + + migrationBuilder.DropTable( + name: "sales_order"); + + migrationBuilder.DropTable( + name: "item_group"); + + migrationBuilder.DropTable( + name: "cost_driver"); + + migrationBuilder.DropTable( + name: "task_job"); + + migrationBuilder.DropTable( + name: "sales_offer"); + + migrationBuilder.DropTable( + name: "sales_customer"); + + migrationBuilder.DropTable( + name: "sales_dealer"); + } + } +} diff --git a/EgwCoreLib.Lux.Data/Migrations/DataLayerContextModelSnapshot.cs b/EgwCoreLib.Lux.Data/Migrations/DataLayerContextModelSnapshot.cs index 99c7dc50..d7bae0ea 100644 --- a/EgwCoreLib.Lux.Data/Migrations/DataLayerContextModelSnapshot.cs +++ b/EgwCoreLib.Lux.Data/Migrations/DataLayerContextModelSnapshot.cs @@ -22,133 +22,414 @@ namespace EgwCoreLib.Lux.Data.Migrations MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.CounterModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Config.EnvirParamModel", b => { - b.Property("RefYear") + b.Property("EnvirID") .HasColumnType("int"); - b.Property("CountName") - .HasColumnType("varchar(255)"); - - b.Property("Counter") - .HasColumnType("int"); - - b.HasKey("RefYear", "CountName"); - - b.ToTable("Counter"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.CustomerModel", b => - { - b.Property("CustomerID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CustomerID")); - - b.Property("CompanyName") + b.Property("SerStrucKey") .IsRequired() .HasColumnType("longtext"); - b.Property("FirstName") - .IsRequired() - .HasColumnType("longtext"); + b.HasKey("EnvirID"); - b.Property("LastName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("VAT") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("CustomerID"); - - b.ToTable("RegCustomer"); + b.ToTable("conf_envir"); b.HasData( new { - CustomerID = 1, - CompanyName = "", - FirstName = "Customer A", - LastName = "Egalware", - VAT = "1234567890123456" + EnvirID = 1, + SerStrucKey = "Jwd" }, new { - CustomerID = 2, - CompanyName = "", - FirstName = "Customer B", - LastName = "User", - VAT = "1234567890123456" + EnvirID = 2, + SerStrucKey = "Btl" }, new { - CustomerID = 3, - CompanyName = "", - FirstName = "Customer C", - LastName = "User Test", - VAT = "1234567890123456" + EnvirID = 4, + SerStrucKey = "Btl" + }, + new + { + EnvirID = 3, + SerStrucKey = "Btl" }); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.DealerModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Config.GlassModel", b => { - b.Property("DealerID") + b.Property("GlassID") .ValueGeneratedOnAdd() .HasColumnType("int"); - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("DealerID")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("GlassID")); - b.Property("CompanyName") - .IsRequired() + b.Property("Code") .HasColumnType("longtext"); - b.Property("FirstName") - .IsRequired() + b.Property("Description") .HasColumnType("longtext"); - b.Property("LastName") - .IsRequired() - .HasColumnType("longtext"); + b.Property("Thickness") + .HasColumnType("double"); - b.Property("VAT") - .IsRequired() - .HasColumnType("longtext"); + b.HasKey("GlassID"); - b.HasKey("DealerID"); - - b.ToTable("RegDealer"); + b.ToTable("conf_glass"); b.HasData( new { - DealerID = 1, - CompanyName = "Company First", - FirstName = "Dealer A", - LastName = "Egalware", - VAT = "9587362514671527" + GlassID = 1, + Code = "0001", + Description = "Vetro BE 2S 4/12/4", + Thickness = 20.0 }, new { - DealerID = 2, - CompanyName = "Company First", - FirstName = "Dealer B", - LastName = "User", - VAT = "9587362514671527" + GlassID = 2, + Code = "0002", + Description = "Vetro BE 2S 4/16/4", + Thickness = 24.0 }, new { - DealerID = 3, - CompanyName = "Company Second", - FirstName = "Dealer C", - LastName = "User Test", - VAT = "9587362514671527" + GlassID = 3, + Code = "0003", + Description = "Vetro BE 3S 4/12/4/12/4", + Thickness = 36.0 + }, + new + { + GlassID = 4, + Code = "0004", + Description = "Vetro BE 3S 4/16/4/16/4", + Thickness = 44.0 + }, + new + { + GlassID = 5, + Code = "0005", + Description = "Vetro BE 2S 4T/12/4T", + Thickness = 20.0 + }, + new + { + GlassID = 6, + Code = "0006", + Description = "Vetro BE 2S 4T/16/4T", + Thickness = 24.0 + }, + new + { + GlassID = 7, + Code = "0007", + Description = "Vetro BE 3S 4T/12/4T/12/4T", + Thickness = 36.0 + }, + new + { + GlassID = 8, + Code = "0008", + Description = "Vetro BE 3S 4T/16/4T/16/4T", + Thickness = 44.0 }); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ItemGroupModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Config.ProfileModel", b => + { + b.Property("ProfileID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProfileID")); + + b.Property("Code") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Thickness") + .HasColumnType("double"); + + b.HasKey("ProfileID"); + + b.ToTable("conf_profile"); + + b.HasData( + new + { + ProfileID = 1, + Code = "0001", + Description = "Profilo60", + Thickness = 60.0 + }, + new + { + ProfileID = 2, + Code = "0002", + Description = "Profilo78", + Thickness = 78.0 + }, + new + { + ProfileID = 3, + Code = "0003", + Description = "Profilo90", + Thickness = 90.0 + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Config.WoodModel", b => + { + b.Property("WoodID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("WoodID")); + + b.Property("Code") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("WoodID"); + + b.ToTable("conf_wood"); + + b.HasData( + new + { + WoodID = 1, + Code = "0001", + Description = "Abete", + Type = 1 + }, + new + { + WoodID = 2, + Code = "0002", + Description = "Acero", + Type = 1 + }, + new + { + WoodID = 3, + Code = "0003", + Description = "Pino", + Type = 2 + }, + new + { + WoodID = 4, + Code = "0004", + Description = "Tek", + Type = 3 + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Cost.CostDriverModel", b => + { + b.Property("CostDriverID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CostDriverID")); + + b.Property("Descript") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Unit") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("CostDriverID"); + + b.ToTable("cost_driver"); + + b.HasData( + new + { + CostDriverID = 1, + Descript = "Ore lavorate per step/fase", + Name = "WorkHour", + Unit = "h" + }, + new + { + CostDriverID = 2, + Descript = "Metri prodotti per step/fase", + Name = "Meter", + Unit = "m" + }, + new + { + CostDriverID = 3, + Descript = "Numero unità prodotte (lavorate) per step/fase", + Name = "Unit", + Unit = "#" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Cost.ResourceModel", b => + { + b.Property("ResourceID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ResourceID")); + + b.Property("CostDriverBudget") + .HasColumnType("decimal(65,30)"); + + b.Property("CostDriverID") + .HasColumnType("int"); + + b.Property("EBTPerc") + .HasColumnType("decimal(65,30)"); + + b.Property("FixedCost") + .HasColumnType("decimal(65,30)"); + + b.Property("LaborCost") + .HasColumnType("decimal(65,30)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OverHeadCost") + .HasColumnType("decimal(65,30)"); + + b.Property("OverHeadPerc") + .HasColumnType("decimal(65,30)"); + + b.Property("PriceMargin") + .HasColumnType("decimal(65,30)"); + + b.Property("VariableCost") + .HasColumnType("decimal(65,30)"); + + b.HasKey("ResourceID"); + + b.HasIndex("CostDriverID"); + + b.ToTable("cost_resource"); + + b.HasData( + new + { + ResourceID = 1, + CostDriverBudget = 880m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 12000m, + LaborCost = 30m, + Name = "Sezionatrice", + OverHeadCost = 5000m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 6000m + }, + new + { + ResourceID = 2, + CostDriverBudget = 1760m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 100000m, + LaborCost = 40m, + Name = "Linea SAOMAD WoodPecker Just 3500", + OverHeadCost = 15000m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 30000m + }, + new + { + ResourceID = 3, + CostDriverBudget = 1760m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 24000m, + LaborCost = 35m, + Name = "Linea Pantografo", + OverHeadCost = 5000m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 6000m + }, + new + { + ResourceID = 4, + CostDriverBudget = 880m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 24000m, + LaborCost = 30m, + Name = "Stazione Verniciatura", + OverHeadCost = 3000m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 6000m + }, + new + { + ResourceID = 5, + CostDriverBudget = 220m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 6000m, + LaborCost = 30m, + Name = "Verniciatura Manuale", + OverHeadCost = 3000m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 2000m + }, + new + { + ResourceID = 6, + CostDriverBudget = 3520m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 500m, + LaborCost = 30m, + Name = "Montaggio Manuale", + OverHeadCost = 500m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 500m + }, + new + { + ResourceID = 7, + CostDriverBudget = 3520m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 0m, + LaborCost = 40m, + Name = "Installatore", + OverHeadCost = 0m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 3000m + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.ItemGroupModel", b => { b.Property("CodGroup") .HasColumnType("varchar(255)"); @@ -159,7 +440,7 @@ namespace EgwCoreLib.Lux.Data.Migrations b.HasKey("CodGroup"); - b.ToTable("RegItemGroup"); + b.ToTable("item_group"); b.HasData( new @@ -184,7 +465,7 @@ namespace EgwCoreLib.Lux.Data.Migrations }); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ItemModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.ItemModel", b => { b.Property("ItemID") .ValueGeneratedOnAdd() @@ -240,7 +521,7 @@ namespace EgwCoreLib.Lux.Data.Migrations b.HasIndex("CodGroup"); - b.ToTable("RegItem"); + b.ToTable("item_item"); b.HasData( new @@ -449,104 +730,301 @@ namespace EgwCoreLib.Lux.Data.Migrations }); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.JobModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.SellingItemModel", b => { - b.Property("JobID") + b.Property("SellingItemID") .ValueGeneratedOnAdd() .HasColumnType("int"); - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobID")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SellingItemID")); - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("JobID"); - - b.ToTable("JobList"); - - b.HasData( - new - { - JobID = 1, - Description = "Rivendita / servizi" - }, - new - { - JobID = 2, - Description = "Serramento Completo Legno su linea Saomad e installatore interno" - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.JobRowItemModel", b => - { - b.Property("JobRowItemID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobRowItemID")); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Index") - .HasColumnType("int"); - - b.Property("ItemID") - .HasColumnType("int"); - - b.Property("JobRowID") - .HasColumnType("int"); - - b.Property("Qty") + b.Property("Cost") .HasColumnType("double"); - b.HasKey("JobRowItemID"); + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); - b.HasIndex("ItemID"); + b.Property("Envir") + .HasColumnType("int"); - b.HasIndex("JobRowID"); + b.Property("ExtItemCode") + .IsRequired() + .HasColumnType("longtext"); - b.ToTable("JobRowItemList"); + b.Property("IsService") + .HasColumnType("tinyint(1)"); + + b.Property("ItemCode") + .HasColumnType("int"); + + b.Property("ItemSteps") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("JobID") + .HasColumnType("int"); + + b.Property("Margin") + .HasColumnType("double"); + + b.Property("SerStruct") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("SupplCode") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UM") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("SellingItemID"); + + b.HasIndex("JobID"); + + b.ToTable("item_selling_item"); b.HasData( new { - JobRowItemID = 1, - Description = "Grezzo legno abete", - Index = 1, - ItemID = 1, - JobRowID = 1, - Qty = 1.0 + SellingItemID = 1, + Cost = 500.0, + Description = "Finestra Anta Singola", + Envir = 1, + ExtItemCode = "", + IsService = false, + ItemCode = 0, + ItemSteps = "", + JobID = 2, + Margin = 0.20000000000000001, + SerStruct = "{\"ProfilePath\":\"Profilo78\",\"Material\":\"Abete\",\"ColorMaterial\":\"White\",\"Glass\":\"Vetro BE 2S 4/12/4\",\"AreaList\":[{\"Shape\":\"RECTANGLE\",\"DimensionList\":[{\"nIndex\":1,\"sName\":\"Width\",\"dValue\":800.0},{\"nIndex\":2,\"sName\":\"Height\",\"dValue\":1200.0}],\"JointList\":[{\"nIndex\":1,\"JointType\":\"FULL_H\"},{\"nIndex\":2,\"JointType\":\"FULL_H\"},{\"nIndex\":3,\"JointType\":\"FULL_H\"},{\"nIndex\":4,\"JointType\":\"FULL_H\"}],\"BottomRail\":false,\"BottomRailQty\":0,\"IdGroup\":1,\"AreaList\":[{\"bIsSashVertical\":true,\"SashList\":[{\"nSashId\":1,\"OpeningType\":\"TILTTURN_LEFT\",\"bHasHandle\":true,\"dDimension\":100.0}],\"SashType\":\"NULL\",\"JointList\":[{\"nIndex\":1,\"JointType\":\"FULL_H\"},{\"nIndex\":2,\"JointType\":\"FULL_H\"},{\"nIndex\":3,\"JointType\":\"FULL_H\"},{\"nIndex\":4,\"JointType\":\"FULL_H\"}],\"BottomRail\":false,\"BottomRailQty\":0,\"Hardware\":\"000558\",\"IdGroup\":2,\"AreaList\":[{\"FillType\":\"GLASS\",\"IdGroup\":3,\"AreaList\":[],\"AreaType\":\"FILL\"}],\"AreaType\":\"SASH\"}],\"AreaType\":\"FRAME\"}]}", + SupplCode = "", + UM = "#" }, new { - JobRowItemID = 2, - Description = "Vernice trasparente standard 1L", - Index = 2, - ItemID = 8, - JobRowID = 3, - Qty = 0.10000000000000001 + SellingItemID = 2, + Cost = 300.0, + Description = "Finestra Vetro Fisso ", + Envir = 1, + ExtItemCode = "", + IsService = false, + ItemCode = 0, + ItemSteps = "", + JobID = 2, + Margin = 0.20000000000000001, + SerStruct = "{\"ProfilePath\":\"Profilo78\",\"Material\":\"Abete\",\"ColorMaterial\":\"White\",\"Glass\":\"Vetro BE 2S 4/12/4\",\"AreaList\":[{\"Shape\":\"RECTANGLE\",\"DimensionList\":[{\"nIndex\":1,\"sName\":\"Width\",\"dValue\":800.0},{\"nIndex\":2,\"sName\":\"Height\",\"dValue\":1200.0}],\"JointList\":[{\"nIndex\":1,\"JointType\":\"FULL_H\"},{\"nIndex\":2,\"JointType\":\"FULL_H\"},{\"nIndex\":3,\"JointType\":\"FULL_H\"},{\"nIndex\":4,\"JointType\":\"FULL_H\"}],\"BottomRail\":false,\"BottomRailQty\":0,\"IdGroup\":1,\"AreaList\":[{\"FillType\":\"GLASS\",\"IdGroup\":4,\"AreaList\":[],\"AreaType\":\"FILL\"}],\"AreaType\":\"FRAME\"}]}", + SupplCode = "", + UM = "#" }, new { - JobRowItemID = 3, - Description = "Ferramenta AGB - rif. AGFD.00000.00000", - Index = 3, - ItemID = 9, - JobRowID = 4, - Qty = 1.0 + SellingItemID = 3, + Cost = 150.0, + Description = "Persiana anta singola", + Envir = 1, + ExtItemCode = "", + IsService = false, + ItemCode = 0, + ItemSteps = "", + JobID = 1, + Margin = 0.10000000000000001, + SerStruct = "", + SupplCode = "", + UM = "#" + }, + new + { + SellingItemID = 4, + Cost = 200.0, + Description = "Installazione", + Envir = 1, + ExtItemCode = "", + IsService = true, + ItemCode = 0, + ItemSteps = "", + JobID = 1, + Margin = 0.29999999999999999, + SerStruct = "", + SupplCode = "", + UM = "#" + }, + new + { + SellingItemID = 5, + Cost = 1000.0, + Description = "Trave lamellare", + Envir = 2, + ExtItemCode = "", + IsService = false, + ItemCode = 0, + ItemSteps = "", + JobID = 3, + Margin = 0.29999999999999999, + SerStruct = "", + SupplCode = "", + UM = "#" + }, + new + { + SellingItemID = 6, + Cost = 500.0, + Description = "Cabinet", + Envir = 4, + ExtItemCode = "", + IsService = false, + ItemCode = 0, + ItemSteps = "", + JobID = 4, + Margin = 0.29999999999999999, + SerStruct = "", + SupplCode = "", + UM = "#" + }, + new + { + SellingItemID = 7, + Cost = 2000.0, + Description = "Parete", + Envir = 3, + ExtItemCode = "", + IsService = false, + ItemCode = 0, + ItemSteps = "", + JobID = 5, + Margin = 0.29999999999999999, + SerStruct = "", + SupplCode = "", + UM = "#" }); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.JobRowModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.SupplierModel", b => { - b.Property("JobRowID") + b.Property("SupplierID") .ValueGeneratedOnAdd() .HasColumnType("int"); - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobRowID")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SupplierID")); + + b.Property("CompanyName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("VAT") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("SupplierID"); + + b.ToTable("item_supplier"); + + b.HasData( + new + { + SupplierID = 1, + CompanyName = "Company One", + FirstName = "Supplier A", + LastName = "Egalware", + VAT = "7294857103879254" + }, + new + { + SupplierID = 2, + CompanyName = "Company Two", + FirstName = "Supplier B", + LastName = "User", + VAT = "7294857103879254" + }, + new + { + SupplierID = 3, + CompanyName = "Company Two", + FirstName = "Supplier C", + LastName = "User Test", + VAT = "7294857103879254" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Production.ProductionBatchModel", b => + { + b.Property("ProductionBatchID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProductionBatchID")); + + b.Property("DateEnd") + .HasColumnType("datetime(6)"); + + b.Property("DateStart") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DueDate") + .HasColumnType("datetime(6)"); + + b.HasKey("ProductionBatchID"); + + b.ToTable("production_batch"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Production.ProductionItemModel", b => + { + b.Property("ProdItemID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProdItemID")); + + b.Property("ExtItemCode") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ItemCode") + .HasColumnType("int"); + + b.Property("OrderRowID") + .HasColumnType("int"); + + b.Property("ProductionBatchID") + .HasColumnType("int"); + + b.HasKey("ProdItemID"); + + b.HasIndex("OrderRowID"); + + b.HasIndex("ProductionBatchID"); + + b.ToTable("production_item"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Production.ProductionItemStepModel", b => + { + b.Property("ProdItemStepID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProdItemStepID")); + + b.Property("DateEnd") + .HasColumnType("datetime(6)"); + + b.Property("DateStart") + .HasColumnType("datetime(6)"); b.Property("Description") .IsRequired() @@ -555,128 +1033,143 @@ namespace EgwCoreLib.Lux.Data.Migrations b.Property("Index") .HasColumnType("int"); - b.Property("JobID") - .HasColumnType("int"); - b.Property("PhaseID") .HasColumnType("int"); + b.Property("ProdItemID") + .HasColumnType("int"); + b.Property("Qty") .HasColumnType("double"); b.Property("ResourceID") .HasColumnType("int"); - b.HasKey("JobRowID"); + b.Property("WorkTime") + .HasColumnType("double"); - b.HasIndex("JobID"); + b.HasKey("ProdItemStepID"); b.HasIndex("PhaseID"); + b.HasIndex("ProdItemID"); + b.HasIndex("ResourceID"); - b.ToTable("JobRowList"); - - b.HasData( - new - { - JobRowID = 1, - Description = "", - Index = 1, - JobID = 2, - PhaseID = 1, - Qty = 1.0, - ResourceID = 1 - }, - new - { - JobRowID = 2, - Description = "", - Index = 2, - JobID = 2, - PhaseID = 2, - Qty = 1.0, - ResourceID = 2 - }, - new - { - JobRowID = 3, - Description = "", - Index = 3, - JobID = 2, - PhaseID = 3, - Qty = 1.0, - ResourceID = 4 - }, - new - { - JobRowID = 4, - Description = "", - Index = 4, - JobID = 2, - PhaseID = 4, - Qty = 1.0, - ResourceID = 6 - }, - new - { - JobRowID = 5, - Description = "", - Index = 5, - JobID = 2, - PhaseID = 6, - Qty = 1.0, - ResourceID = 7 - }); + b.ToTable("production_item_step"); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.MovTypeModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.CustomerModel", b => { - b.Property("MovCod") - .HasColumnType("varchar(255)"); + b.Property("CustomerID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("Description") + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CustomerID")); + + b.Property("CompanyName") .IsRequired() .HasColumnType("longtext"); - b.HasKey("MovCod"); + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); - b.ToTable("RegMovType"); + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("VAT") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("CustomerID"); + + b.ToTable("sales_customer"); b.HasData( new { - MovCod = "CAR", - Description = "Carico a magazzino" + CustomerID = 1, + CompanyName = "", + FirstName = "Customer A", + LastName = "Egalware", + VAT = "1234567890123456" }, new { - MovCod = "MOV", - Description = "Movimento interno (spostamento)" + CustomerID = 2, + CompanyName = "", + FirstName = "Customer B", + LastName = "User", + VAT = "1234567890123456" }, new { - MovCod = "ND", - Description = "Non Definito" - }, - new - { - MovCod = "OFOR", - Description = "Ordine Fornitore" - }, - new - { - MovCod = "RETT", - Description = "Rettifica magazzino" - }, - new - { - MovCod = "SCAR", - Description = "Scarico da magazzino" + CustomerID = 3, + CompanyName = "", + FirstName = "Customer C", + LastName = "User Test", + VAT = "1234567890123456" }); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OfferModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.DealerModel", b => + { + b.Property("DealerID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("DealerID")); + + b.Property("CompanyName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("VAT") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("DealerID"); + + b.ToTable("sales_dealer"); + + b.HasData( + new + { + DealerID = 1, + CompanyName = "Company First", + FirstName = "Dealer A", + LastName = "Egalware", + VAT = "9587362514671527" + }, + new + { + DealerID = 2, + CompanyName = "Company First", + FirstName = "Dealer B", + LastName = "User", + VAT = "9587362514671527" + }, + new + { + DealerID = 3, + CompanyName = "Company Second", + FirstName = "Dealer C", + LastName = "User Test", + VAT = "9587362514671527" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OfferModel", b => { b.Property("OfferID") .ValueGeneratedOnAdd() @@ -684,6 +1177,10 @@ namespace EgwCoreLib.Lux.Data.Migrations MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OfferID")); + b.Property("ConsNote") + .IsRequired() + .HasColumnType("longtext"); + b.Property("CustomerID") .HasColumnType("int"); @@ -694,6 +1191,16 @@ namespace EgwCoreLib.Lux.Data.Migrations .IsRequired() .HasColumnType("longtext"); + b.Property("DictPresel") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Discount") + .HasColumnType("double"); + + b.Property("Envir") + .HasColumnType("int"); + b.Property("Inserted") .HasColumnType("datetime(6)"); @@ -721,26 +1228,84 @@ namespace EgwCoreLib.Lux.Data.Migrations b.HasIndex("DealerID"); - b.ToTable("Offer"); + b.ToTable("sales_offer"); b.HasData( new { OfferID = 1, + ConsNote = "", CustomerID = 2, DealerID = 2, Description = "Offerta per tre serramenti", - Inserted = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9069), - Modified = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9071), + DictPresel = "", + Discount = 0.0, + Envir = 1, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4161), + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4162), OffertState = 0, RefNum = 1, RefRev = 1, RefYear = 2024, - ValidUntil = new DateTime(2025, 10, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9064) + ValidUntil = new DateTime(2025, 11, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4158) + }, + new + { + OfferID = 2, + ConsNote = "", + CustomerID = 2, + DealerID = 2, + Description = "Offerta BEAM", + DictPresel = "", + Discount = 0.0, + Envir = 2, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4169), + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4170), + OffertState = 0, + RefNum = 2, + RefRev = 1, + RefYear = 2024, + ValidUntil = new DateTime(2025, 11, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4167) + }, + new + { + OfferID = 3, + ConsNote = "", + CustomerID = 2, + DealerID = 2, + Description = "Offerta Cabinet", + DictPresel = "", + Discount = 0.0, + Envir = 4, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4175), + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4177), + OffertState = 0, + RefNum = 3, + RefRev = 1, + RefYear = 2024, + ValidUntil = new DateTime(2025, 11, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4174) + }, + new + { + OfferID = 4, + ConsNote = "", + CustomerID = 2, + DealerID = 2, + Description = "Offerta Wall", + DictPresel = "", + Discount = 0.0, + Envir = 3, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4182), + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4183), + OffertState = 0, + RefNum = 4, + RefRev = 1, + RefYear = 2024, + ValidUntil = new DateTime(2025, 11, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4181) }); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OfferRowModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OfferRowModel", b => { b.Property("OfferRowID") .ValueGeneratedOnAdd() @@ -748,16 +1313,35 @@ namespace EgwCoreLib.Lux.Data.Migrations MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OfferRowID")); + b.Property("AwaitBom") + .HasColumnType("tinyint(1)"); + + b.Property("AwaitPrice") + .HasColumnType("tinyint(1)"); + + b.Property("BomCost") + .HasColumnType("double"); + b.Property("BomOk") .HasColumnType("tinyint(1)"); - b.Property("Cost") + b.Property("BomPrice") .HasColumnType("double"); - b.Property("Environment") + b.Property("Envir") + .HasColumnType("int"); + + b.Property("FileName") .IsRequired() .HasColumnType("longtext"); + b.Property("FileResource") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + b.Property("Inserted") .HasColumnType("datetime(6)"); @@ -768,7 +1352,7 @@ namespace EgwCoreLib.Lux.Data.Migrations b.Property("ItemOk") .HasColumnType("tinyint(1)"); - b.Property("ItemSPP") + b.Property("ItemSteps") .IsRequired() .HasColumnType("longtext"); @@ -799,75 +1383,294 @@ namespace EgwCoreLib.Lux.Data.Migrations .IsRequired() .HasColumnType("longtext"); + b.Property("StepCost") + .HasColumnType("double"); + + b.Property("StepPrice") + .HasColumnType("double"); + b.HasKey("OfferRowID"); b.HasIndex("OfferID"); b.HasIndex("SellingItemID"); - b.ToTable("OfferRowList"); + b.ToTable("sales_offer_row"); b.HasData( new { OfferRowID = 1, + AwaitBom = false, + AwaitPrice = false, + BomCost = 900.0, BomOk = true, - Cost = 950.0, - Environment = "WINDOW", - Inserted = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9104), + BomPrice = 950.0, + Envir = 1, + FileName = "", + FileResource = "", + FileSize = 0L, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4304), ItemBOM = "", ItemOk = true, - ItemSPP = "{}", - Modified = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9106), - Note = "Finestra anta singola 2025", + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4306), + Note = "Finestra Vetro Fisso 2025", OfferID = 1, - OfferRowUID = "OFF0000000001", + OfferRowUID = "SOR.25.00000001", Qty = 3.0, RowNum = 1, - SellingItemID = 1, - SerStruct = "{}" + SellingItemID = 2, + SerStruct = "{\"ProfilePath\":\"Profilo78\",\"Material\":\"Abete\",\"ColorMaterial\":\"White\",\"Glass\":\"Vetro BE 2S 4/12/4\",\"AreaList\":[{\"Shape\":\"RECTANGLE\",\"DimensionList\":[{\"nIndex\":1,\"sName\":\"Width\",\"dValue\":800.0},{\"nIndex\":2,\"sName\":\"Height\",\"dValue\":1200.0}],\"JointList\":[{\"nIndex\":1,\"JointType\":\"FULL_H\"},{\"nIndex\":2,\"JointType\":\"FULL_H\"},{\"nIndex\":3,\"JointType\":\"FULL_H\"},{\"nIndex\":4,\"JointType\":\"FULL_H\"}],\"BottomRail\":false,\"BottomRailQty\":0,\"IdGroup\":1,\"AreaList\":[{\"FillType\":\"GLASS\",\"IdGroup\":4,\"AreaList\":[],\"AreaType\":\"FILL\"}],\"AreaType\":\"FRAME\"}]}", + StepCost = 0.0, + StepPrice = 0.0 }, new { OfferRowID = 2, + AwaitBom = false, + AwaitPrice = false, + BomCost = 900.0, BomOk = true, - Cost = 160.0, - Environment = "WINDOW", - Inserted = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9114), + BomPrice = 950.0, + Envir = 1, + FileName = "", + FileResource = "", + FileSize = 0L, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4320), ItemBOM = "", ItemOk = true, - ItemSPP = "{}", - Modified = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9116), - Note = "Persiana per Finestra anta singola 2025", + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4321), + Note = "Finestra Anta Singola 2025", OfferID = 1, - OfferRowUID = "OFF0000000002", + OfferRowUID = "SOR.25.00000002", Qty = 3.0, - RowNum = 2, - SellingItemID = 2, - SerStruct = "{}" + RowNum = 1, + SellingItemID = 1, + SerStruct = "{\"ProfilePath\":\"Profilo78\",\"Material\":\"Abete\",\"ColorMaterial\":\"White\",\"Glass\":\"Vetro BE 2S 4/12/4\",\"AreaList\":[{\"Shape\":\"RECTANGLE\",\"DimensionList\":[{\"nIndex\":1,\"sName\":\"Width\",\"dValue\":800.0},{\"nIndex\":2,\"sName\":\"Height\",\"dValue\":1200.0}],\"JointList\":[{\"nIndex\":1,\"JointType\":\"FULL_H\"},{\"nIndex\":2,\"JointType\":\"FULL_H\"},{\"nIndex\":3,\"JointType\":\"FULL_H\"},{\"nIndex\":4,\"JointType\":\"FULL_H\"}],\"BottomRail\":false,\"BottomRailQty\":0,\"IdGroup\":1,\"AreaList\":[{\"bIsSashVertical\":true,\"SashList\":[{\"nSashId\":1,\"OpeningType\":\"TILTTURN_LEFT\",\"bHasHandle\":true,\"dDimension\":100.0}],\"SashType\":\"NULL\",\"JointList\":[{\"nIndex\":1,\"JointType\":\"FULL_H\"},{\"nIndex\":2,\"JointType\":\"FULL_H\"},{\"nIndex\":3,\"JointType\":\"FULL_H\"},{\"nIndex\":4,\"JointType\":\"FULL_H\"}],\"BottomRail\":false,\"BottomRailQty\":0,\"Hardware\":\"000558\",\"IdGroup\":2,\"AreaList\":[{\"FillType\":\"GLASS\",\"IdGroup\":3,\"AreaList\":[],\"AreaType\":\"FILL\"}],\"AreaType\":\"SASH\"}],\"AreaType\":\"FRAME\"}]}", + StepCost = 0.0, + StepPrice = 0.0 }, new { OfferRowID = 3, + AwaitBom = false, + AwaitPrice = false, + BomCost = 160.0, BomOk = true, - Cost = 200.0, - Environment = "WINDOW", - Inserted = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9123), + BomPrice = 200.0, + Envir = 1, + FileName = "", + FileResource = "", + FileSize = 0L, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4332), ItemBOM = "", ItemOk = true, - ItemSPP = "{}", - Modified = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(9125), + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4334), + Note = "Persiana per Finestra anta singola 2025", + OfferID = 1, + OfferRowUID = "SOR.25.00000003", + Qty = 3.0, + RowNum = 2, + SellingItemID = 2, + SerStruct = "{}", + StepCost = 0.0, + StepPrice = 0.0 + }, + new + { + OfferRowID = 4, + AwaitBom = false, + AwaitPrice = false, + BomCost = 200.0, + BomOk = true, + BomPrice = 250.0, + Envir = 1, + FileName = "", + FileResource = "", + FileSize = 0L, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4344), + ItemBOM = "", + ItemOk = true, + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4346), Note = "Installazione serramento", OfferID = 1, - OfferRowUID = "OFF0000000003", + OfferRowUID = "SOR.25.00000004", Qty = 3.0, RowNum = 3, SellingItemID = 3, - SerStruct = "{}" + SerStruct = "{}", + StepCost = 0.0, + StepPrice = 0.0 + }, + new + { + OfferRowID = 5, + AwaitBom = false, + AwaitPrice = false, + BomCost = 800.0, + BomOk = true, + BomPrice = 1150.0, + Envir = 2, + FileName = "", + FileResource = "", + FileSize = 0L, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4376), + ItemBOM = "", + ItemOk = true, + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4378), + Note = "Demo file 01", + OfferID = 2, + OfferRowUID = "SOR.25.00000005", + Qty = 10.0, + RowNum = 1, + SellingItemID = 4, + SerStruct = "", + StepCost = 0.0, + StepPrice = 0.0 + }, + new + { + OfferRowID = 6, + AwaitBom = false, + AwaitPrice = false, + BomCost = 600.0, + BomOk = true, + BomPrice = 950.0, + Envir = 2, + FileName = "", + FileResource = "", + FileSize = 0L, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4389), + ItemBOM = "", + ItemOk = true, + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4390), + Note = "Demo file 02", + OfferID = 2, + OfferRowUID = "SOR.25.00000006", + Qty = 4.0, + RowNum = 1, + SellingItemID = 4, + SerStruct = "", + StepCost = 0.0, + StepPrice = 0.0 + }, + new + { + OfferRowID = 7, + AwaitBom = false, + AwaitPrice = false, + BomCost = 200.0, + BomOk = true, + BomPrice = 250.0, + Envir = 3, + FileName = "", + FileResource = "", + FileSize = 0L, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4419), + ItemBOM = "", + ItemOk = true, + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4421), + Note = "Demo file 01", + OfferID = 3, + OfferRowUID = "SOR.25.00000007", + Qty = 4.0, + RowNum = 1, + SellingItemID = 5, + SerStruct = "", + StepCost = 0.0, + StepPrice = 0.0 + }, + new + { + OfferRowID = 8, + AwaitBom = false, + AwaitPrice = false, + BomCost = 50.0, + BomOk = true, + BomPrice = 80.0, + Envir = 3, + FileName = "", + FileResource = "", + FileSize = 0L, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4432), + ItemBOM = "", + ItemOk = true, + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4433), + Note = "Demo file 02", + OfferID = 3, + OfferRowUID = "SOR.25.00000008", + Qty = 12.0, + RowNum = 1, + SellingItemID = 5, + SerStruct = "", + StepCost = 0.0, + StepPrice = 0.0 + }, + new + { + OfferRowID = 9, + AwaitBom = false, + AwaitPrice = false, + BomCost = 800.0, + BomOk = true, + BomPrice = 1150.0, + Envir = 4, + FileName = "", + FileResource = "", + FileSize = 0L, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4462), + ItemBOM = "", + ItemOk = true, + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4464), + Note = "Demo file 01", + OfferID = 4, + OfferRowUID = "SOR.25.00000009", + Qty = 6.0, + RowNum = 1, + SellingItemID = 6, + SerStruct = "", + StepCost = 0.0, + StepPrice = 0.0 + }, + new + { + OfferRowID = 10, + AwaitBom = false, + AwaitPrice = false, + BomCost = 600.0, + BomOk = true, + BomPrice = 950.0, + Envir = 4, + FileName = "", + FileResource = "", + FileSize = 0L, + Inserted = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4475), + ItemBOM = "", + ItemOk = true, + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(4477), + Note = "Demo file 02", + OfferID = 4, + OfferRowUID = "SOR.25.0000000A", + Qty = 4.0, + RowNum = 1, + SellingItemID = 6, + SerStruct = "", + StepCost = 0.0, + StepPrice = 0.0 }); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OrderModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OrderModel", b => { b.Property("OrderID") .ValueGeneratedOnAdd() @@ -875,6 +1678,10 @@ namespace EgwCoreLib.Lux.Data.Migrations MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OrderID")); + b.Property("ConsNote") + .IsRequired() + .HasColumnType("longtext"); + b.Property("CustomerID") .HasColumnType("int"); @@ -885,6 +1692,10 @@ namespace EgwCoreLib.Lux.Data.Migrations .IsRequired() .HasColumnType("longtext"); + b.Property("DictPresel") + .IsRequired() + .HasColumnType("longtext"); + b.Property("Inserted") .HasColumnType("datetime(6)"); @@ -917,10 +1728,10 @@ namespace EgwCoreLib.Lux.Data.Migrations b.HasIndex("OfferID"); - b.ToTable("Order"); + b.ToTable("sales_order"); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OrderRowModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OrderRowModel", b => { b.Property("OrderRowID") .ValueGeneratedOnAdd() @@ -928,13 +1739,16 @@ namespace EgwCoreLib.Lux.Data.Migrations MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OrderRowID")); - b.Property("Cost") + b.Property("BomCost") + .HasColumnType("double"); + + b.Property("BomPrice") .HasColumnType("double"); b.Property("Inserted") .HasColumnType("datetime(6)"); - b.Property("ItemSPP") + b.Property("ItemSteps") .IsRequired() .HasColumnType("longtext"); @@ -961,385 +1775,22 @@ namespace EgwCoreLib.Lux.Data.Migrations .IsRequired() .HasColumnType("longtext"); + b.Property("StepCost") + .HasColumnType("double"); + + b.Property("StepPrice") + .HasColumnType("double"); + b.HasKey("OrderRowID"); b.HasIndex("OrderID"); b.HasIndex("SellingItemID"); - b.ToTable("OrderRowList"); + b.ToTable("sales_order_row"); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.PhaseModel", b => - { - b.Property("PhaseID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PhaseID")); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("PhaseID"); - - b.ToTable("RegPhase"); - - b.HasData( - new - { - PhaseID = 1, - Description = "Taglio tronchetti" - }, - new - { - PhaseID = 2, - Description = "Lavorazione pezzi serramento" - }, - new - { - PhaseID = 3, - Description = "Verniciatura" - }, - new - { - PhaseID = 4, - Description = "Assemblaggio completo" - }, - new - { - PhaseID = 5, - Description = "Assemblaggio Ferramenta" - }, - new - { - PhaseID = 6, - Description = "Installazione e posa in opera" - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ProductionBatchModel", b => - { - b.Property("ProductionBatchID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProductionBatchID")); - - b.Property("DateEnd") - .HasColumnType("datetime(6)"); - - b.Property("DateStart") - .HasColumnType("datetime(6)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("DueDate") - .HasColumnType("datetime(6)"); - - b.HasKey("ProductionBatchID"); - - b.ToTable("ProductionBatch"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ProductionItemModel", b => - { - b.Property("ProdItemID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProdItemID")); - - b.Property("ExtItemCode") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ItemCode") - .HasColumnType("int"); - - b.Property("OrderRowID") - .HasColumnType("int"); - - b.Property("ProductionBatchID") - .HasColumnType("int"); - - b.HasKey("ProdItemID"); - - b.HasIndex("OrderRowID"); - - b.HasIndex("ProductionBatchID"); - - b.ToTable("ProductionItem"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ProductionItemRowModel", b => - { - b.Property("ProdItemRowID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProdItemRowID")); - - b.Property("DateEnd") - .HasColumnType("datetime(6)"); - - b.Property("DateStart") - .HasColumnType("datetime(6)"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Index") - .HasColumnType("int"); - - b.Property("PhaseID") - .HasColumnType("int"); - - b.Property("ProdItemID") - .HasColumnType("int"); - - b.Property("Qty") - .HasColumnType("double"); - - b.Property("ResourceID") - .HasColumnType("int"); - - b.Property("WorkTime") - .HasColumnType("double"); - - b.HasKey("ProdItemRowID"); - - b.HasIndex("PhaseID"); - - b.HasIndex("ProdItemID"); - - b.HasIndex("ResourceID"); - - b.ToTable("ProductionItemRowList"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ResourceModel", b => - { - b.Property("ResourceID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ResourceID")); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsAsset") - .HasColumnType("tinyint(1)"); - - b.Property("IsHuman") - .HasColumnType("tinyint(1)"); - - b.Property("UmFix") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("UmProp") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("UnitCostFix") - .HasColumnType("double"); - - b.Property("UnitCostProp") - .HasColumnType("double"); - - b.HasKey("ResourceID"); - - b.ToTable("RegResource"); - - b.HasData( - new - { - ResourceID = 1, - Description = "Sezionatrice", - IsAsset = true, - IsHuman = false, - UmFix = "€/h", - UmProp = "", - UnitCostFix = 15.0, - UnitCostProp = 0.0 - }, - new - { - ResourceID = 2, - Description = "Linea SAOMAD WoodPecker Just 3500", - IsAsset = true, - IsHuman = false, - UmFix = "€/h", - UmProp = "€/m", - UnitCostFix = 240.0, - UnitCostProp = 1.8999999999999999 - }, - new - { - ResourceID = 3, - Description = "Linea Pantografo", - IsAsset = true, - IsHuman = false, - UmFix = "€/h", - UmProp = "€/m", - UnitCostFix = 90.0, - UnitCostProp = 5.9000000000000004 - }, - new - { - ResourceID = 4, - Description = "Stazione Verniciatura", - IsAsset = true, - IsHuman = false, - UmFix = "€/h", - UmProp = "€/m", - UnitCostFix = 40.0, - UnitCostProp = 1.8999999999999999 - }, - new - { - ResourceID = 5, - Description = "Verniciatura Manuale", - IsAsset = false, - IsHuman = true, - UmFix = "€/h", - UmProp = "€/m", - UnitCostFix = 10.0, - UnitCostProp = 1.8999999999999999 - }, - new - { - ResourceID = 6, - Description = "Montaggio Manuale", - IsAsset = false, - IsHuman = true, - UmFix = "", - UmProp = "€/h", - UnitCostFix = 0.0, - UnitCostProp = 40.0 - }, - new - { - ResourceID = 7, - Description = "Installatore", - IsAsset = false, - IsHuman = true, - UmFix = "", - UmProp = "€/h", - UnitCostFix = 0.0, - UnitCostProp = 40.0 - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.SellingItemModel", b => - { - b.Property("SellingItemID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SellingItemID")); - - b.Property("Cost") - .HasColumnType("double"); - - b.Property("Description") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ExtItemCode") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IsService") - .HasColumnType("tinyint(1)"); - - b.Property("ItemCode") - .HasColumnType("int"); - - b.Property("ItemSPP") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("JobID") - .HasColumnType("int"); - - b.Property("Margin") - .HasColumnType("double"); - - b.Property("SerStruct") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("SupplCode") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("UM") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("SellingItemID"); - - b.HasIndex("JobID"); - - b.ToTable("SellingItem"); - - b.HasData( - new - { - SellingItemID = 1, - Cost = 820.0, - Description = "Finestra anta Singola", - ExtItemCode = "", - IsService = false, - ItemCode = 0, - ItemSPP = "", - JobID = 2, - Margin = 0.20000000000000001, - SerStruct = "", - SupplCode = "", - UM = "#" - }, - new - { - SellingItemID = 2, - Cost = 150.0, - Description = "Persiana anta singola", - ExtItemCode = "", - IsService = false, - ItemCode = 0, - ItemSPP = "", - JobID = 1, - Margin = 0.10000000000000001, - SerStruct = "", - SupplCode = "", - UM = "#" - }, - new - { - SellingItemID = 3, - Cost = 200.0, - Description = "Installazione", - ExtItemCode = "", - IsService = true, - ItemCode = 0, - ItemSPP = "", - JobID = 1, - Margin = 0.29999999999999999, - SerStruct = "", - SupplCode = "", - UM = "#" - }); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.StockMovModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Stock.StockMovModel", b => { b.Property("StockMovID") .ValueGeneratedOnAdd() @@ -1390,15 +1841,15 @@ namespace EgwCoreLib.Lux.Data.Migrations b.HasIndex("StockStatusId"); - b.ToTable("StockMov"); + b.ToTable("stock_mov"); b.HasData( new { StockMovID = 1, CodDoc = "", - DtCreate = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8693), - DtMod = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8782), + DtCreate = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3856), + DtMod = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3906), MovCod = "CAR", Note = "DEMO", QtyRec = 5.0, @@ -1410,8 +1861,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 2, CodDoc = "", - DtCreate = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8785), - DtMod = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8787), + DtCreate = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3909), + DtMod = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3910), MovCod = "CAR", Note = "DEMO", QtyRec = 8.0, @@ -1423,8 +1874,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 3, CodDoc = "", - DtCreate = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8790), - DtMod = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8792), + DtCreate = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3912), + DtMod = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3913), MovCod = "CAR", Note = "DEMO", QtyRec = 5.0, @@ -1436,8 +1887,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 4, CodDoc = "", - DtCreate = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8794), - DtMod = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8796), + DtCreate = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3916), + DtMod = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3917), MovCod = "CAR", Note = "DEMO", QtyRec = 1.0, @@ -1449,8 +1900,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 5, CodDoc = "", - DtCreate = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8799), - DtMod = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8801), + DtCreate = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3919), + DtMod = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3921), MovCod = "CAR", Note = "DEMO", QtyRec = 10.0, @@ -1462,8 +1913,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 6, CodDoc = "", - DtCreate = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8803), - DtMod = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8805), + DtCreate = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3923), + DtMod = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3924), MovCod = "CAR", Note = "DEMO", QtyRec = 1.0, @@ -1475,8 +1926,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 7, CodDoc = "", - DtCreate = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8808), - DtMod = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8809), + DtCreate = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3926), + DtMod = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3928), MovCod = "CAR", Note = "DEMO", QtyRec = 50.0, @@ -1488,8 +1939,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 8, CodDoc = "", - DtCreate = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8812), - DtMod = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8814), + DtCreate = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3930), + DtMod = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3931), MovCod = "CAR", Note = "DEMO", QtyRec = 1.0, @@ -1501,8 +1952,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 9, CodDoc = "", - DtCreate = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8817), - DtMod = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8818), + DtCreate = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3934), + DtMod = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3935), MovCod = "CAR", Note = "DEMO", QtyRec = 1.0, @@ -1514,8 +1965,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 10, CodDoc = "", - DtCreate = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8821), - DtMod = new DateTime(2025, 9, 16, 17, 23, 0, 861, DateTimeKind.Local).AddTicks(8823), + DtCreate = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3937), + DtMod = new DateTime(2025, 10, 20, 12, 6, 19, 419, DateTimeKind.Local).AddTicks(3939), MovCod = "CAR", Note = "DEMO", QtyRec = 1.0, @@ -1525,7 +1976,7 @@ namespace EgwCoreLib.Lux.Data.Migrations }); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.StockStatusModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Stock.StockStatusModel", b => { b.Property("StockStatusId") .ValueGeneratedOnAdd() @@ -1553,7 +2004,7 @@ namespace EgwCoreLib.Lux.Data.Migrations b.HasIndex("ItemID"); - b.ToTable("StockStatus"); + b.ToTable("stock_status"); b.HasData( new @@ -1648,62 +2099,462 @@ namespace EgwCoreLib.Lux.Data.Migrations }); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.SupplierModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.JobModel", b => { - b.Property("SupplierID") + b.Property("JobID") .ValueGeneratedOnAdd() .HasColumnType("int"); - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SupplierID")); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobID")); - b.Property("CompanyName") + b.Property("Description") .IsRequired() .HasColumnType("longtext"); - b.Property("FirstName") - .IsRequired() - .HasColumnType("longtext"); + b.HasKey("JobID"); - b.Property("LastName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("VAT") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("SupplierID"); - - b.ToTable("RegSupplier"); + b.ToTable("task_job"); b.HasData( new { - SupplierID = 1, - CompanyName = "Company One", - FirstName = "Supplier A", - LastName = "Egalware", - VAT = "7294857103879254" + JobID = 1, + Description = "Rivendita / servizi" }, new { - SupplierID = 2, - CompanyName = "Company Two", - FirstName = "Supplier B", - LastName = "User", - VAT = "7294857103879254" + JobID = 2, + Description = "Serramento Completo Legno su linea Saomad e installatore interno" }, new { - SupplierID = 3, - CompanyName = "Company Two", - FirstName = "Supplier C", - LastName = "User Test", - VAT = "7294857103879254" + JobID = 3, + Description = "Realizzazione Trave" + }, + new + { + JobID = 4, + Description = "Realizzazione Cabinet" + }, + new + { + JobID = 5, + Description = "Realizzazione Parete" }); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.TagsModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.JobStepItemModel", b => + { + b.Property("JobStepItemID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobStepItemID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("ItemID") + .HasColumnType("int"); + + b.Property("JobStepID") + .HasColumnType("int"); + + b.Property("Qty") + .HasColumnType("double"); + + b.HasKey("JobStepItemID"); + + b.HasIndex("ItemID"); + + b.HasIndex("JobStepID"); + + b.ToTable("task_job_step_item"); + + b.HasData( + new + { + JobStepItemID = 1, + Description = "Grezzo legno abete", + Index = 1, + ItemID = 1, + JobStepID = 1, + Qty = 1.0 + }, + new + { + JobStepItemID = 2, + Description = "Vernice trasparente standard 1L", + Index = 2, + ItemID = 8, + JobStepID = 3, + Qty = 0.10000000000000001 + }, + new + { + JobStepItemID = 3, + Description = "Ferramenta AGB - rif. AGFD.00000.00000", + Index = 3, + ItemID = 9, + JobStepID = 4, + Qty = 1.0 + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.JobStepModel", b => + { + b.Property("JobStepID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobStepID")); + + b.Property("CostDriverID") + .HasColumnType("int"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("JobID") + .HasColumnType("int"); + + b.Property("PhaseID") + .HasColumnType("int"); + + b.Property("ProductivityRate") + .HasColumnType("decimal(65,30)"); + + b.Property("ResourceID") + .HasColumnType("int"); + + b.HasKey("JobStepID"); + + b.HasIndex("CostDriverID"); + + b.HasIndex("JobID"); + + b.HasIndex("PhaseID"); + + b.HasIndex("ResourceID"); + + b.ToTable("task_job_step"); + + b.HasData( + new + { + JobStepID = 1, + CostDriverID = 3, + Description = "", + Index = 1, + JobID = 2, + PhaseID = 1, + ProductivityRate = 1m, + ResourceID = 1 + }, + new + { + JobStepID = 2, + CostDriverID = 2, + Description = "", + Index = 2, + JobID = 2, + PhaseID = 2, + ProductivityRate = 1m, + ResourceID = 2 + }, + new + { + JobStepID = 3, + CostDriverID = 3, + Description = "", + Index = 3, + JobID = 2, + PhaseID = 3, + ProductivityRate = 1m, + ResourceID = 4 + }, + new + { + JobStepID = 4, + CostDriverID = 3, + Description = "", + Index = 4, + JobID = 2, + PhaseID = 4, + ProductivityRate = 1m, + ResourceID = 6 + }, + new + { + JobStepID = 5, + CostDriverID = 3, + Description = "", + Index = 5, + JobID = 2, + PhaseID = 6, + ProductivityRate = 1m, + ResourceID = 7 + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.PhaseModel", b => + { + b.Property("PhaseID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PhaseID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("PhaseID"); + + b.ToTable("task_phase"); + + b.HasData( + new + { + PhaseID = 1, + Description = "Taglio tronchetti" + }, + new + { + PhaseID = 2, + Description = "Lavorazione pezzi serramento" + }, + new + { + PhaseID = 3, + Description = "Verniciatura" + }, + new + { + PhaseID = 4, + Description = "Assemblaggio completo" + }, + new + { + PhaseID = 5, + Description = "Assemblaggio Ferramenta" + }, + new + { + PhaseID = 6, + Description = "Installazione e posa in opera" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.CounterModel", b => + { + b.Property("RefYear") + .HasColumnType("int"); + + b.Property("CountName") + .HasColumnType("varchar(255)"); + + b.Property("Counter") + .HasColumnType("int"); + + b.HasKey("RefYear", "CountName"); + + b.ToTable("utils_counter"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.GenClassModel", b => + { + b.Property("ClassCod") + .HasColumnType("varchar(255)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("ClassCod"); + + b.ToTable("utils_gen_class"); + + b.HasData( + new + { + ClassCod = "ShapeList", + Description = "Elenco Shape Gestite" + }, + new + { + ClassCod = "WoodCol", + Description = "Elenco Colori Legno" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.GenValueModel", b => + { + b.Property("GenValID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("GenValID")); + + b.Property("ClassCod") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("Ordinal") + .HasColumnType("int"); + + b.Property("ValString") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("GenValID"); + + b.HasIndex("ClassCod"); + + b.ToTable("utils_gen_value"); + + b.HasData( + new + { + GenValID = 1, + ClassCod = "WoodCol", + Ordinal = 1, + ValString = "Blue" + }, + new + { + GenValID = 2, + ClassCod = "WoodCol", + Ordinal = 2, + ValString = "White" + }, + new + { + GenValID = 3, + ClassCod = "WoodCol", + Ordinal = 3, + ValString = "Red" + }, + new + { + GenValID = 4, + ClassCod = "WoodCol", + Ordinal = 4, + ValString = "Black" + }, + new + { + GenValID = 5, + ClassCod = "ShapeList", + Ordinal = 1, + ValString = "Rectangular" + }, + new + { + GenValID = 6, + ClassCod = "ShapeList", + Ordinal = 2, + ValString = "Trapezoidal" + }, + new + { + GenValID = 7, + ClassCod = "ShapeList", + Ordinal = 3, + ValString = "Triangular" + }, + new + { + GenValID = 8, + ClassCod = "ShapeList", + Ordinal = 4, + ValString = "Arc" + }, + new + { + GenValID = 9, + ClassCod = "ShapeList", + Ordinal = 5, + ValString = "FullArc" + }, + new + { + GenValID = 10, + ClassCod = "ShapeList", + Ordinal = 6, + ValString = "SemiFullArc" + }, + new + { + GenValID = 11, + ClassCod = "ShapeList", + Ordinal = 7, + ValString = "SemiArc" + }, + new + { + GenValID = 12, + ClassCod = "ShapeList", + Ordinal = 8, + ValString = "Circular" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.MovTypeModel", b => + { + b.Property("MovCod") + .HasColumnType("varchar(255)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("MovCod"); + + b.ToTable("utils_mov_type"); + + b.HasData( + new + { + MovCod = "CAR", + Description = "Carico a magazzino" + }, + new + { + MovCod = "MOV", + Description = "Movimento interno (spostamento)" + }, + new + { + MovCod = "ND", + Description = "Non Definito" + }, + new + { + MovCod = "OFOR", + Description = "Ordine Fornitore" + }, + new + { + MovCod = "RETT", + Description = "Rettifica magazzino" + }, + new + { + MovCod = "SCAR", + Description = "Scarico da magazzino" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.TagsModel", b => { b.Property("TagID") .ValueGeneratedOnAdd() @@ -1717,7 +2568,7 @@ namespace EgwCoreLib.Lux.Data.Migrations b.HasKey("TagID"); - b.ToTable("RegTags"); + b.ToTable("utils_tags"); b.HasData( new @@ -1747,9 +2598,20 @@ namespace EgwCoreLib.Lux.Data.Migrations }); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ItemModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Cost.ResourceModel", b => { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.ItemGroupModel", "ItemGroupNav") + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Cost.CostDriverModel", "DriverNav") + .WithMany() + .HasForeignKey("CostDriverID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("DriverNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.ItemModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Items.ItemGroupModel", "ItemGroupNav") .WithMany() .HasForeignKey("CodGroup") .OnDelete(DeleteBehavior.Restrict) @@ -1758,145 +2620,26 @@ namespace EgwCoreLib.Lux.Data.Migrations b.Navigation("ItemGroupNav"); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.JobRowItemModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.SellingItemModel", b => { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.ItemModel", "ItemNav") - .WithMany() - .HasForeignKey("ItemID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.JobRowModel", "JobRowNav") - .WithMany() - .HasForeignKey("JobRowID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("ItemNav"); - - b.Navigation("JobRowNav"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.JobRowModel", b => - { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.JobModel", "JobNav") + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Task.JobModel", "JobNav") .WithMany() .HasForeignKey("JobID") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); - b.HasOne("EgwCoreLib.Lux.Data.DbModel.PhaseModel", "PhaseNav") - .WithMany() - .HasForeignKey("PhaseID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.ResourceModel", "ResourceNav") - .WithMany() - .HasForeignKey("ResourceID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - b.Navigation("JobNav"); - - b.Navigation("PhaseNav"); - - b.Navigation("ResourceNav"); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OfferModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Production.ProductionItemModel", b => { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.CustomerModel", "CustomerNav") - .WithMany() - .HasForeignKey("CustomerID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.DealerModel", "DealerNav") - .WithMany() - .HasForeignKey("DealerID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CustomerNav"); - - b.Navigation("DealerNav"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OfferRowModel", b => - { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.OfferModel", "OfferNav") - .WithMany("OfferRowNav") - .HasForeignKey("OfferID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.SellingItemModel", "SellingItemNav") - .WithMany() - .HasForeignKey("SellingItemID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("OfferNav"); - - b.Navigation("SellingItemNav"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OrderModel", b => - { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.CustomerModel", "CustomerNav") - .WithMany() - .HasForeignKey("CustomerID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.DealerModel", "DealerNav") - .WithMany() - .HasForeignKey("DealerID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.OfferModel", "OfferNav") - .WithMany() - .HasForeignKey("OfferID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CustomerNav"); - - b.Navigation("DealerNav"); - - b.Navigation("OfferNav"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OrderRowModel", b => - { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.OrderModel", "OrderNav") - .WithMany() - .HasForeignKey("OrderID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("EgwCoreLib.Lux.Data.DbModel.SellingItemModel", "SellingItemNav") - .WithMany() - .HasForeignKey("SellingItemID") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("OrderNav"); - - b.Navigation("SellingItemNav"); - }); - - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ProductionItemModel", b => - { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.OrderRowModel", "OrderRowNav") + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.OrderRowModel", "OrderRowNav") .WithMany() .HasForeignKey("OrderRowID") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); - b.HasOne("EgwCoreLib.Lux.Data.DbModel.ProductionBatchModel", "ProductionBatchNav") + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Production.ProductionBatchModel", "ProductionBatchNav") .WithMany() .HasForeignKey("ProductionBatchID") .OnDelete(DeleteBehavior.Restrict) @@ -1907,21 +2650,21 @@ namespace EgwCoreLib.Lux.Data.Migrations b.Navigation("ProductionBatchNav"); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.ProductionItemRowModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Production.ProductionItemStepModel", b => { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.PhaseModel", "PhaseNav") + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Task.PhaseModel", "PhaseNav") .WithMany() .HasForeignKey("PhaseID") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); - b.HasOne("EgwCoreLib.Lux.Data.DbModel.ProductionItemModel", "ProdItemNav") + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Production.ProductionItemModel", "ProdItemNav") .WithMany() .HasForeignKey("ProdItemID") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); - b.HasOne("EgwCoreLib.Lux.Data.DbModel.ResourceModel", "ResourceNav") + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Cost.ResourceModel", "ResourceNav") .WithMany() .HasForeignKey("ResourceID") .OnDelete(DeleteBehavior.Restrict) @@ -1934,26 +2677,99 @@ namespace EgwCoreLib.Lux.Data.Migrations b.Navigation("ResourceNav"); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.SellingItemModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OfferModel", b => { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.JobModel", "JobNav") + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.CustomerModel", "CustomerNav") .WithMany() - .HasForeignKey("JobID") + .HasForeignKey("CustomerID") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); - b.Navigation("JobNav"); + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.DealerModel", "DealerNav") + .WithMany() + .HasForeignKey("DealerID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CustomerNav"); + + b.Navigation("DealerNav"); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.StockMovModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OfferRowModel", b => { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.MovTypeModel", "MovTypeNav") + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.OfferModel", "OfferNav") + .WithMany("OfferRowNav") + .HasForeignKey("OfferID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Items.SellingItemModel", "SellingItemNav") + .WithMany() + .HasForeignKey("SellingItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("OfferNav"); + + b.Navigation("SellingItemNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OrderModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.CustomerModel", "CustomerNav") + .WithMany() + .HasForeignKey("CustomerID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.DealerModel", "DealerNav") + .WithMany() + .HasForeignKey("DealerID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.OfferModel", "OfferNav") + .WithMany() + .HasForeignKey("OfferID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CustomerNav"); + + b.Navigation("DealerNav"); + + b.Navigation("OfferNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OrderRowModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.OrderModel", "OrderNav") + .WithMany() + .HasForeignKey("OrderID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Items.SellingItemModel", "SellingItemNav") + .WithMany() + .HasForeignKey("SellingItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("OrderNav"); + + b.Navigation("SellingItemNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Stock.StockMovModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Utils.MovTypeModel", "MovTypeNav") .WithMany() .HasForeignKey("MovCod") .OnDelete(DeleteBehavior.Restrict) .IsRequired(); - b.HasOne("EgwCoreLib.Lux.Data.DbModel.StockStatusModel", "StockStatusNav") + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Stock.StockStatusModel", "StockStatusNav") .WithMany() .HasForeignKey("StockStatusId") .OnDelete(DeleteBehavior.Restrict) @@ -1964,9 +2780,9 @@ namespace EgwCoreLib.Lux.Data.Migrations b.Navigation("StockStatusNav"); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.StockStatusModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Stock.StockStatusModel", b => { - b.HasOne("EgwCoreLib.Lux.Data.DbModel.ItemModel", "ItemNav") + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Items.ItemModel", "ItemNav") .WithMany() .HasForeignKey("ItemID") .OnDelete(DeleteBehavior.Restrict) @@ -1975,10 +2791,85 @@ namespace EgwCoreLib.Lux.Data.Migrations b.Navigation("ItemNav"); }); - modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.OfferModel", b => + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.JobStepItemModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Items.ItemModel", "ItemNav") + .WithMany() + .HasForeignKey("ItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Task.JobStepModel", "JobStepNav") + .WithMany() + .HasForeignKey("JobStepID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ItemNav"); + + b.Navigation("JobStepNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.JobStepModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Cost.CostDriverModel", "DriverNav") + .WithMany() + .HasForeignKey("CostDriverID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Task.JobModel", "JobNav") + .WithMany("JobStepNav") + .HasForeignKey("JobID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Task.PhaseModel", "PhaseNav") + .WithMany() + .HasForeignKey("PhaseID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Cost.ResourceModel", "ResourceNav") + .WithMany() + .HasForeignKey("ResourceID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("DriverNav"); + + b.Navigation("JobNav"); + + b.Navigation("PhaseNav"); + + b.Navigation("ResourceNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.GenValueModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Utils.GenClassModel", "GenClassNav") + .WithMany("GenValNav") + .HasForeignKey("ClassCod") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("GenClassNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OfferModel", b => { b.Navigation("OfferRowNav"); }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.JobModel", b => + { + b.Navigation("JobStepNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.GenClassModel", b => + { + b.Navigation("GenValNav"); + }); #pragma warning restore 612, 618 } } diff --git a/EgwCoreLib.Lux.Data/ModelBuilderExtensions.cs b/EgwCoreLib.Lux.Data/ModelBuilderExtensions.cs index f266ca3d..6ac3f512 100644 --- a/EgwCoreLib.Lux.Data/ModelBuilderExtensions.cs +++ b/EgwCoreLib.Lux.Data/ModelBuilderExtensions.cs @@ -1,10 +1,11 @@ -using EgwCoreLib.Lux.Data.DbModel; +using EgwCoreLib.Lux.Data.DbModel.Config; +using EgwCoreLib.Lux.Data.DbModel.Cost; +using EgwCoreLib.Lux.Data.DbModel.Items; +using EgwCoreLib.Lux.Data.DbModel.Sales; +using EgwCoreLib.Lux.Data.DbModel.Stock; +using EgwCoreLib.Lux.Data.DbModel.Task; +using EgwCoreLib.Lux.Data.DbModel.Utils; using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace EgwCoreLib.Lux.Data { @@ -18,7 +19,8 @@ namespace EgwCoreLib.Lux.Data /// public static void Seed(this ModelBuilder modelBuilder) { - // inizializzazione dei valori di default x Ruoli + + // inizializzazione dei valori di default x Ruoli/Tags modelBuilder.Entity().HasData( new TagsModel { TagID = 1, Description = "Tag 01" }, new TagsModel { TagID = 2, Description = "Tag 02" }, @@ -27,6 +29,60 @@ namespace EgwCoreLib.Lux.Data new TagsModel { TagID = 5, Description = "Tag 05" } ); + // init classi generiche x gestione liste + modelBuilder.Entity().HasData( + new GenClassModel { ClassCod = "ShapeList", Description = "Elenco Shape Gestite" }, + new GenClassModel { ClassCod = "WoodCol", Description = "Elenco Colori Legno" } + ); + + // init dati x invio serializzazioni da environment + modelBuilder.Entity().HasData( + new EnvirParamModel { EnvirID = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW, SerStrucKey = "Jwd" }, + new EnvirParamModel { EnvirID = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.BEAM, SerStrucKey = "Btl" }, + new EnvirParamModel { EnvirID = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.CABINET, SerStrucKey = "Btl" }, + new EnvirParamModel { EnvirID = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WALL, SerStrucKey = "Btl" } + ); + + modelBuilder.Entity().HasData( + new GenValueModel { GenValID = 1, Ordinal = 1, ClassCod = "WoodCol", ValString = "Blue" }, + new GenValueModel { GenValID = 2, Ordinal = 2, ClassCod = "WoodCol", ValString = "White" }, + new GenValueModel { GenValID = 3, Ordinal = 3, ClassCod = "WoodCol", ValString = "Red" }, + new GenValueModel { GenValID = 4, Ordinal = 4, ClassCod = "WoodCol", ValString = "Black" }, + new GenValueModel { GenValID = 5, Ordinal = 1, ClassCod = "ShapeList", ValString = "Rectangular" }, + new GenValueModel { GenValID = 6, Ordinal = 2, ClassCod = "ShapeList", ValString = "Trapezoidal" }, + new GenValueModel { GenValID = 7, Ordinal = 3, ClassCod = "ShapeList", ValString = "Triangular" }, + new GenValueModel { GenValID = 8, Ordinal = 4, ClassCod = "ShapeList", ValString = "Arc" }, + new GenValueModel { GenValID = 9, Ordinal = 5, ClassCod = "ShapeList", ValString = "FullArc" }, + new GenValueModel { GenValID = 10, Ordinal = 6, ClassCod = "ShapeList", ValString = "SemiFullArc" }, + new GenValueModel { GenValID = 11, Ordinal = 7, ClassCod = "ShapeList", ValString = "SemiArc" }, + new GenValueModel { GenValID = 12, Ordinal = 8, ClassCod = "ShapeList", ValString = "Circular" } + ); + + modelBuilder.Entity().HasData( + new GlassModel { GlassID = 1, Code = "0001", Description = "Vetro BE 2S 4/12/4", Thickness = 20 }, + new GlassModel { GlassID = 2, Code = "0002", Description = "Vetro BE 2S 4/16/4", Thickness = 24 }, + new GlassModel { GlassID = 3, Code = "0003", Description = "Vetro BE 3S 4/12/4/12/4", Thickness = 36 }, + new GlassModel { GlassID = 4, Code = "0004", Description = "Vetro BE 3S 4/16/4/16/4", Thickness = 44 }, + new GlassModel { GlassID = 5, Code = "0005", Description = "Vetro BE 2S 4T/12/4T", Thickness = 20 }, + new GlassModel { GlassID = 6, Code = "0006", Description = "Vetro BE 2S 4T/16/4T", Thickness = 24 }, + new GlassModel { GlassID = 7, Code = "0007", Description = "Vetro BE 3S 4T/12/4T/12/4T", Thickness = 36 }, + new GlassModel { GlassID = 8, Code = "0008", Description = "Vetro BE 3S 4T/16/4T/16/4T", Thickness = 44 } + ); + modelBuilder.Entity().HasData( + new ProfileModel { ProfileID = 1, Code = "0001", Description = "Profilo60", Thickness = 60 }, + new ProfileModel { ProfileID = 2, Code = "0002", Description = "Profilo78", Thickness = 78 }, + new ProfileModel { ProfileID = 3, Code = "0003", Description = "Profilo90", Thickness = 90 } + ); + modelBuilder.Entity().HasData( + new WoodModel { WoodID = 1, Code = "0001", Description = "Abete", Type = 1 }, + new WoodModel { WoodID = 2, Code = "0002", Description = "Acero", Type = 1 }, + new WoodModel { WoodID = 3, Code = "0003", Description = "Pino", Type = 2 }, + new WoodModel { WoodID = 4, Code = "0004", Description = "Tek", Type = 3 } + ); + + + // valori base classi generiche + // inizializzazione dei valori di default x Customer modelBuilder.Entity().HasData( new CustomerModel { CustomerID = 1, FirstName = "Customer A", LastName = "Egalware", VAT = "1234567890123456" }, @@ -131,15 +187,23 @@ namespace EgwCoreLib.Lux.Data new StockMovModel { StockMovID = 10, StockStatusId = 10, QtyRec = 1, MovCod = "CAR", UserId = "samuele.locatelli@egalware.com", Note = "DEMO" } ); + // init cost drivers + modelBuilder.Entity().HasData( + // Risorsa principale di calcolo produttività/costi + new CostDriverModel() { CostDriverID = 1, Name = "WorkHour", Unit = "h", Descript = "Ore lavorate per step/fase" }, + new CostDriverModel() { CostDriverID = 2, Name = "Meter", Unit = "m", Descript = "Metri prodotti per step/fase" }, + new CostDriverModel() { CostDriverID = 3, Name = "Unit", Unit = "#", Descript = "Numero unità prodotte (lavorate) per step/fase" } + ); + // inizializzazione risorse modelBuilder.Entity().HasData( - new ResourceModel { ResourceID = 1, Description = "Sezionatrice", IsAsset = true, IsHuman = false, UnitCostFix = 15, UmFix = "€/h" }, - new ResourceModel { ResourceID = 2, Description = "Linea SAOMAD WoodPecker Just 3500", IsAsset = true, IsHuman = false, UnitCostFix = 240, UmFix = "€/h", UnitCostProp = 1.9, UmProp = "€/m" }, - new ResourceModel { ResourceID = 3, Description = "Linea Pantografo", IsAsset = true, IsHuman = false, UnitCostFix = 90, UmFix = "€/h", UnitCostProp = 5.9, UmProp = "€/m" }, - new ResourceModel { ResourceID = 4, Description = "Stazione Verniciatura", IsAsset = true, IsHuman = false, UnitCostFix = 40, UmFix = "€/h", UnitCostProp = 1.9, UmProp = "€/m" }, - new ResourceModel { ResourceID = 5, Description = "Verniciatura Manuale", IsAsset = false, IsHuman = true, UnitCostFix = 10, UmFix = "€/h", UnitCostProp = 1.9, UmProp = "€/m" }, - new ResourceModel { ResourceID = 6, Description = "Montaggio Manuale", IsAsset = false, IsHuman = true, UnitCostProp = 40, UmProp = "€/h" }, - new ResourceModel { ResourceID = 7, Description = "Installatore", IsAsset = false, IsHuman = true, UnitCostProp = 40, UmProp = "€/h" } + new ResourceModel { ResourceID = 1, Name = "Sezionatrice", FixedCost = 12000, VariableCost = 6000, OverHeadCost = 5000, CostDriverID = 1, CostDriverBudget = 220 * 4, LaborCost = 30, OverHeadPerc = 0.15M, EBTPerc = 0.15M }, + new ResourceModel { ResourceID = 2, Name = "Linea SAOMAD WoodPecker Just 3500", FixedCost = 100000, VariableCost = 30000, OverHeadCost = 15000, CostDriverID = 1, CostDriverBudget = 220 * 8, LaborCost = 40, OverHeadPerc = 0.15M, EBTPerc = 0.15M }, + new ResourceModel { ResourceID = 3, Name = "Linea Pantografo", FixedCost = 24000, VariableCost = 6000, OverHeadCost = 5000, CostDriverID = 1, CostDriverBudget = 220 * 8, LaborCost = 35, OverHeadPerc = 0.15M, EBTPerc = 0.15M }, + new ResourceModel { ResourceID = 4, Name = "Stazione Verniciatura", FixedCost = 24000, VariableCost = 6000, OverHeadCost = 3000, CostDriverID = 1, CostDriverBudget = 220 * 4, LaborCost = 30, OverHeadPerc = 0.15M, EBTPerc = 0.15M }, + new ResourceModel { ResourceID = 5, Name = "Verniciatura Manuale", FixedCost = 6000, VariableCost = 2000, OverHeadCost = 3000, CostDriverID = 1, CostDriverBudget = 220 * 1, LaborCost = 30, OverHeadPerc = 0.15M, EBTPerc = 0.15M }, + new ResourceModel { ResourceID = 6, Name = "Montaggio Manuale", FixedCost = 500, VariableCost = 500, OverHeadCost = 500, CostDriverID = 1, CostDriverBudget = 220 * 8 * 2, LaborCost = 30, OverHeadPerc = 0.15M, EBTPerc = 0.15M }, + new ResourceModel { ResourceID = 7, Name = "Installatore", FixedCost = 0, VariableCost = 3000, OverHeadCost = 0, CostDriverID = 1, CostDriverBudget = 220 * 8 * 2, LaborCost = 40, OverHeadPerc = 0.15M, EBTPerc = 0.15M } ); // inizializzazione fasi @@ -156,57 +220,92 @@ namespace EgwCoreLib.Lux.Data // inizializzazione cicli di lavoro modelBuilder.Entity().HasData( new JobModel { JobID = 1, Description = "Rivendita / servizi" }, - new JobModel { JobID = 2, Description = "Serramento Completo Legno su linea Saomad e installatore interno" }//, - //new JobModel { JobID = 2, Description = "Serramento Completo Legno/Alluminio" }, - //new JobModel { JobID = 3, Description = "Persiana Legno" }, - //new JobModel { JobID = 4, Description = "restauro Persiana Esistente" } + new JobModel { JobID = 2, Description = "Serramento Completo Legno su linea Saomad e installatore interno" }, + new JobModel { JobID = 3, Description = "Realizzazione Trave" }, + new JobModel { JobID = 4, Description = "Realizzazione Cabinet" }, + new JobModel { JobID = 5, Description = "Realizzazione Parete" } ); // init righe ciclo (fasi di ciclo) - modelBuilder.Entity().HasData( + modelBuilder.Entity().HasData( // per fare 1 finestra singola/semplice taglio 4 tronchetti telaio + 4 tronchetti finestra, considero 1 perché mi arriva dal sistema preventivo/motore - new JobRowModel { JobRowID = 1, JobID = 2, Index = 1, PhaseID = 1, Qty = 1, ResourceID = 1 }, + new JobStepModel { JobStepID = 1, JobID = 2, Index = 1, CostDriverID = 3, PhaseID = 1, ProductivityRate = 1, ResourceID = 1 }, // taglio profilo su linea saomad, considero 1 perché mi arriva dal sistema preventivo/motore - new JobRowModel { JobRowID = 2, JobID = 2, Index = 2, PhaseID = 2, Qty = 1, ResourceID = 2 }, + new JobStepModel { JobStepID = 2, JobID = 2, Index = 2, CostDriverID = 2, PhaseID = 2, ProductivityRate = 1, ResourceID = 2 }, // verniciatura automatica, considero 1 perché mi arriva dal sistema preventivo/motore - new JobRowModel { JobRowID = 3, JobID = 2, Index = 3, PhaseID = 3, Qty = 1, ResourceID = 4 }, + new JobStepModel { JobStepID = 3, JobID = 2, Index = 3, CostDriverID = 3, PhaseID = 3, ProductivityRate = 1, ResourceID = 4 }, // assemblaggio - new JobRowModel { JobRowID = 4, JobID = 2, Index = 4, PhaseID = 4, Qty = 1, ResourceID = 6 }, + new JobStepModel { JobStepID = 4, JobID = 2, Index = 4, CostDriverID = 3, PhaseID = 4, ProductivityRate = 1, ResourceID = 6 }, // installazione - new JobRowModel { JobRowID = 5, JobID = 2, Index = 5, PhaseID = 6, Qty = 1, ResourceID = 7 } + new JobStepModel { JobStepID = 5, JobID = 2, Index = 5, CostDriverID = 3, PhaseID = 6, ProductivityRate = 1, ResourceID = 7 } ); // init item righe ciclo (articoli + prodotti delle fasi del ciclo) - modelBuilder.Entity().HasData( + modelBuilder.Entity().HasData( // eventuale scarto del materiale tra grezzo e finito--> porta ad un numero >1 (QUI NON USATO, ho il valore calcolato dal motore) - new JobRowItemModel { JobRowItemID = 1, JobRowID = 1, Index = 1, ItemID = 1, Qty = 1, Description = "Grezzo legno abete" }, + new JobStepItemModel { JobStepItemID = 1, JobStepID = 1, Index = 1, ItemID = 1, Qty = 1, Description = "Grezzo legno abete" }, // 1/10 litro di vernice per metro lineare prodotto - new JobRowItemModel { JobRowItemID = 2, JobRowID = 3, Index = 2, ItemID = 8, Qty = 0.1, Description = "Vernice trasparente standard 1L" }, + new JobStepItemModel { JobStepItemID = 2, JobStepID = 3, Index = 2, ItemID = 8, Qty = 0.1, Description = "Vernice trasparente standard 1L" }, // uso un KIT intero (vs specifico n prodotti singoli) x questo modello; se dal preventivo arrivano n pezzi spcifici, qui li esplodiamo - new JobRowItemModel { JobRowItemID = 3, JobRowID = 4, Index = 3, ItemID = 9, Qty = 1, Description = "Ferramenta AGB - rif. AGFD.00000.00000" } + new JobStepItemModel { JobStepItemID = 3, JobStepID = 4, Index = 3, ItemID = 9, Qty = 1, Description = "Ferramenta AGB - rif. AGFD.00000.00000" } ); + + // JWD finestra cVetro Fisso / Cieca + string jwdVetroFisso = "{\"ProfilePath\":\"Profilo78\",\"Material\":\"Abete\",\"ColorMaterial\":\"White\",\"Glass\":\"Vetro BE 2S 4/12/4\",\"AreaList\":[{\"Shape\":\"RECTANGLE\",\"DimensionList\":[{\"nIndex\":1,\"sName\":\"Width\",\"dValue\":800.0},{\"nIndex\":2,\"sName\":\"Height\",\"dValue\":1200.0}],\"JointList\":[{\"nIndex\":1,\"JointType\":\"FULL_H\"},{\"nIndex\":2,\"JointType\":\"FULL_H\"},{\"nIndex\":3,\"JointType\":\"FULL_H\"},{\"nIndex\":4,\"JointType\":\"FULL_H\"}],\"BottomRail\":false,\"BottomRailQty\":0,\"IdGroup\":1,\"AreaList\":[{\"FillType\":\"GLASS\",\"IdGroup\":4,\"AreaList\":[],\"AreaType\":\"FILL\"}],\"AreaType\":\"FRAME\"}]}"; + + // JWD finestra 1 Anta 800x1200 + string jwdAntaSingola = "{\"ProfilePath\":\"Profilo78\",\"Material\":\"Abete\",\"ColorMaterial\":\"White\",\"Glass\":\"Vetro BE 2S 4/12/4\",\"AreaList\":[{\"Shape\":\"RECTANGLE\",\"DimensionList\":[{\"nIndex\":1,\"sName\":\"Width\",\"dValue\":800.0},{\"nIndex\":2,\"sName\":\"Height\",\"dValue\":1200.0}],\"JointList\":[{\"nIndex\":1,\"JointType\":\"FULL_H\"},{\"nIndex\":2,\"JointType\":\"FULL_H\"},{\"nIndex\":3,\"JointType\":\"FULL_H\"},{\"nIndex\":4,\"JointType\":\"FULL_H\"}],\"BottomRail\":false,\"BottomRailQty\":0,\"IdGroup\":1,\"AreaList\":[{\"bIsSashVertical\":true,\"SashList\":[{\"nSashId\":1,\"OpeningType\":\"TILTTURN_LEFT\",\"bHasHandle\":true,\"dDimension\":100.0}],\"SashType\":\"NULL\",\"JointList\":[{\"nIndex\":1,\"JointType\":\"FULL_H\"},{\"nIndex\":2,\"JointType\":\"FULL_H\"},{\"nIndex\":3,\"JointType\":\"FULL_H\"},{\"nIndex\":4,\"JointType\":\"FULL_H\"}],\"BottomRail\":false,\"BottomRailQty\":0,\"Hardware\":\"000558\",\"IdGroup\":2,\"AreaList\":[{\"FillType\":\"GLASS\",\"IdGroup\":3,\"AreaList\":[],\"AreaType\":\"FILL\"}],\"AreaType\":\"SASH\"}],\"AreaType\":\"FRAME\"}]}"; + // inizializzazione dei valori di default x SellingItem modelBuilder.Entity().HasData( - new SellingItemModel { SellingItemID = 1, IsService = false, Description = "Finestra anta Singola", Cost = 820, Margin = 0.2, JobID = 2 }, - new SellingItemModel { SellingItemID = 2, IsService = false, Description = "Persiana anta singola", Cost = 150, Margin = 0.1, JobID = 1 }, - new SellingItemModel { SellingItemID = 3, IsService = true, Description = "Installazione", Cost = 200, Margin = 0.3, JobID = 1 } + new SellingItemModel { SellingItemID = 1, IsService = false, Description = "Finestra Anta Singola", Cost = 500, Margin = 0.2, JobID = 2, SerStruct = jwdAntaSingola, Envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW }, + new SellingItemModel { SellingItemID = 2, IsService = false, Description = "Finestra Vetro Fisso ", Cost = 300, Margin = 0.2, JobID = 2, SerStruct = jwdVetroFisso, Envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW }, + new SellingItemModel { SellingItemID = 3, IsService = false, Description = "Persiana anta singola", Cost = 150, Margin = 0.1, JobID = 1, Envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW }, + new SellingItemModel { SellingItemID = 4, IsService = true, Description = "Installazione", Cost = 200, Margin = 0.3, JobID = 1, Envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW }, + new SellingItemModel { SellingItemID = 5, IsService = false, Description = "Trave lamellare", Cost = 1000, Margin = 0.3, JobID = 3, Envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.BEAM }, + new SellingItemModel { SellingItemID = 6, IsService = false, Description = "Cabinet", Cost = 500, Margin = 0.3, JobID = 4, Envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.CABINET }, + new SellingItemModel { SellingItemID = 7, IsService = false, Description = "Parete", Cost = 2000, Margin = 0.3, JobID = 5, Envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WALL } ); // inizializzazione dei valori di default x Offer modelBuilder.Entity().HasData( - new OfferModel { OfferID = 1, RefYear = 2024, RefNum = 1, RefRev = 1, Description = "Offerta per tre serramenti", CustomerID = 2, DealerID = 2 } - //new OfferModel { OfferID = 2, RefYear = 2025, RefNum = 2, RefRev = 1, Description = "Offerta per un serramento + installazione", CustomerID = 1, DealerID = 1 }, - //new OfferModel { OfferID = 3, RefYear = 2025, RefNum = 3, RefRev = 1, Description = "Offerta per tre serramenti", CustomerID = 2, DealerID = 1 }, - //new OfferModel { OfferID = 5, RefYear = 2025, RefNum = 4, RefRev = 2, Description = "Offerta per cinque serramenti + installazione", CustomerID = 3, DealerID = 2 } + new OfferModel { OfferID = 1, RefYear = 2024, RefNum = 1, RefRev = 1, Description = "Offerta per tre serramenti", CustomerID = 2, DealerID = 2, Envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW }, + new OfferModel { OfferID = 2, RefYear = 2024, RefNum = 2, RefRev = 1, Description = "Offerta BEAM", CustomerID = 2, DealerID = 2, Envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.BEAM }, + new OfferModel { OfferID = 3, RefYear = 2024, RefNum = 3, RefRev = 1, Description = "Offerta Cabinet", CustomerID = 2, DealerID = 2, Envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.CABINET }, + new OfferModel { OfferID = 4, RefYear = 2024, RefNum = 4, RefRev = 1, Description = "Offerta Wall", CustomerID = 2, DealerID = 2, Envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WALL } + //new OfferModel { OfferID = 2, RefYear = 2025, RefNum = 2, RefRev = 1, Name = "Offerta per un serramento + installazione", CustomerID = 1, DealerID = 1 }, + //new OfferModel { OfferID = 3, RefYear = 2025, RefNum = 3, RefRev = 1, Name = "Offerta per tre serramenti", CustomerID = 2, DealerID = 1 }, + //new OfferModel { OfferID = 5, RefYear = 2025, RefNum = 4, RefRev = 2, Name = "Offerta per cinque serramenti + installazione", CustomerID = 3, DealerID = 2 } ); - // inizializzazione dei valori di default x OfferRow + + // inizializzazione dei valori di default x Offerta 1 = WINDOW modelBuilder.Entity().HasData( - new OfferRowModel { OfferRowID = 1, OfferID = 1, OfferRowUID = "OFF0000000001", Inserted = DateTime.Now, Modified = DateTime.Now, Cost = 950, SellingItemID = 1, Qty = 3, RowNum = 1, SerStruct = "{}", Note = "Finestra anta singola 2025", ItemSPP = "{}", BomOk = true, ItemOk = true }, - new OfferRowModel { OfferRowID = 2, OfferID = 1, OfferRowUID = "OFF0000000002", Inserted = DateTime.Now, Modified = DateTime.Now, Cost = 160, SellingItemID = 2, Qty = 3, RowNum = 2, SerStruct = "{}", Note = "Persiana per Finestra anta singola 2025", ItemSPP = "{}", BomOk = true, ItemOk = true }, - new OfferRowModel { OfferRowID = 3, OfferID = 1, OfferRowUID = "OFF0000000003", Inserted = DateTime.Now, Modified = DateTime.Now, Cost = 200, SellingItemID = 3, Qty = 3, RowNum = 3, SerStruct = "{}", Note = "Installazione serramento", ItemSPP = "{}", BomOk = true, ItemOk = true } + new OfferRowModel { OfferRowID = 1, OfferID = 1, Envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW, OfferRowUID = $"SOR.{DateTime.Today:yy}.{1:X8}", Inserted = DateTime.Now, Modified = DateTime.Now, BomCost = 900, BomPrice = 950, SellingItemID = 2, Qty = 3, RowNum = 1, SerStruct = jwdVetroFisso, Note = "Finestra Vetro Fisso 2025", ItemSteps = "{}", BomOk = true, ItemOk = true }, + new OfferRowModel { OfferRowID = 2, OfferID = 1, Envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW, OfferRowUID = $"SOR.{DateTime.Today:yy}.{2:X8}", Inserted = DateTime.Now, Modified = DateTime.Now, BomCost = 900, BomPrice = 950, SellingItemID = 1, Qty = 3, RowNum = 1, SerStruct = jwdAntaSingola, Note = "Finestra Anta Singola 2025", ItemSteps = "{}", BomOk = true, ItemOk = true }, + new OfferRowModel { OfferRowID = 3, OfferID = 1, Envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW, OfferRowUID = $"SOR.{DateTime.Today:yy}.{3:X8}", Inserted = DateTime.Now, Modified = DateTime.Now, BomCost = 160, BomPrice = 200, SellingItemID = 2, Qty = 3, RowNum = 2, SerStruct = "{}", Note = "Persiana per Finestra anta singola 2025", ItemSteps = "{}", BomOk = true, ItemOk = true }, + new OfferRowModel { OfferRowID = 4, OfferID = 1, Envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW, OfferRowUID = $"SOR.{DateTime.Today:yy}.{4:X8}", Inserted = DateTime.Now, Modified = DateTime.Now, BomCost = 200, BomPrice = 250, SellingItemID = 3, Qty = 3, RowNum = 3, SerStruct = "{}", Note = "Installazione serramento", ItemSteps = "{}", BomOk = true, ItemOk = true } ); + + // inizializzazione dei valori di default x Offerta 2 = BEAM + modelBuilder.Entity().HasData( + new OfferRowModel { OfferRowID = 5, OfferID = 2, Envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.BEAM, OfferRowUID = $"SOR.{DateTime.Today:yy}.{5:X8}", Inserted = DateTime.Now, Modified = DateTime.Now, BomCost = 800, BomPrice = 1150, SellingItemID = 4, Qty = 10, RowNum = 1, SerStruct = "", Note = "Demo file 01", ItemSteps = "{}", BomOk = true, ItemOk = true }, + new OfferRowModel { OfferRowID = 6, OfferID = 2, Envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.BEAM, OfferRowUID = $"SOR.{DateTime.Today:yy}.{6:X8}", Inserted = DateTime.Now, Modified = DateTime.Now, BomCost = 600, BomPrice = 950, SellingItemID = 4, Qty = 4, RowNum = 1, SerStruct = "", Note = "Demo file 02", ItemSteps = "{}", BomOk = true, ItemOk = true } + ); + + // inizializzazione dei valori di default x Offerta 3 = CABINET + modelBuilder.Entity().HasData( + new OfferRowModel { OfferRowID = 7, OfferID = 3, Envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WALL, OfferRowUID = $"SOR.{DateTime.Today:yy}.{7:X8}", Inserted = DateTime.Now, Modified = DateTime.Now, BomCost = 200, BomPrice = 250, SellingItemID = 5, Qty = 4, RowNum = 1, SerStruct = "", Note = "Demo file 01", ItemSteps = "{}", BomOk = true, ItemOk = true }, + new OfferRowModel { OfferRowID = 8, OfferID = 3, Envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WALL, OfferRowUID = $"SOR.{DateTime.Today:yy}.{8:X8}", Inserted = DateTime.Now, Modified = DateTime.Now, BomCost = 50, BomPrice = 80, SellingItemID = 5, Qty = 12, RowNum = 1, SerStruct = "", Note = "Demo file 02", ItemSteps = "{}", BomOk = true, ItemOk = true } + ); + + // inizializzazione dei valori di default x Offerta 4 = WALL + modelBuilder.Entity().HasData( + new OfferRowModel { OfferRowID = 9, OfferID = 4, Envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.CABINET, OfferRowUID = $"SOR.{DateTime.Today:yy}.{9:X8}", Inserted = DateTime.Now, Modified = DateTime.Now, BomCost = 800, BomPrice = 1150, SellingItemID = 6, Qty = 6, RowNum = 1, SerStruct = "", Note = "Demo file 01", ItemSteps = "{}", BomOk = true, ItemOk = true }, + new OfferRowModel { OfferRowID = 10, OfferID = 4, Envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.CABINET, OfferRowUID = $"SOR.{DateTime.Today:yy}.{10:X8}", Inserted = DateTime.Now, Modified = DateTime.Now, BomCost = 600, BomPrice = 950, SellingItemID = 6, Qty = 4, RowNum = 1, SerStruct = "", Note = "Demo file 02", ItemSteps = "{}", BomOk = true, ItemOk = true } + ); + } #endregion Public Methods diff --git a/EgwCoreLib.Lux.Data/Services/BaseServ.cs b/EgwCoreLib.Lux.Data/Services/BaseServ.cs index 1cb1d8c8..944f1610 100644 --- a/EgwCoreLib.Lux.Data/Services/BaseServ.cs +++ b/EgwCoreLib.Lux.Data/Services/BaseServ.cs @@ -13,58 +13,105 @@ using System.Threading.Tasks; namespace EgwCoreLib.Lux.Data.Services { + /// + /// Classe base per i servizi che fornisce funzionalità comuni come + /// - connessione a Redis + /// - configurazione + /// - gestione dei messaggi + /// - strategie di caching. + /// + /// Questa classe agisce come modello per altri servizi derivati. + /// public class BaseServ { #region Public Constructors + /// + /// Inizializza una nuova istanza della classe BaseServ. + /// Configura la connessione Redis, carica le impostazioni di configurazione e inizializza il serializzatore JSON. + /// + /// Oggetto di configurazione per recuperare le impostazioni dell'applicazione. + /// Multiplexer di connessione Redis per operazioni sul database. public BaseServ(IConfiguration Configuration, IConnectionMultiplexer RedisConn) { - configuration = Configuration; - - // setup componenti REDIS -#if false - redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis") ?? "localhost"); -#endif + _config = Configuration; redisConn = RedisConn; redisDb = redisConn.GetDatabase(); - svgChannel = configuration.GetValue("ServerConf:SvgChannel") ?? "svg:img"; - // aggiungo ricerca generica ":*" al channel... + // channel name setup + svgChannel = _config.GetValue("ServerConf:SvgChannel") ?? "Egw-svg:img"; + bomChannel = _config.GetValue("ServerConf:BomChannel") ?? "Egw-bom"; + updateChannel = _config.GetValue("ServerConf:UpdateChannel") ?? "Egw-update"; + // Appends ":*" to the channels to enable wildcard subscription for dynamic events if (!svgChannel.EndsWith(":*")) { svgChannel += ":*"; - } + } + if (!bomChannel.EndsWith(":*")) + { + bomChannel += ":*"; + } + if (!updateChannel.EndsWith(":*")) + { + updateChannel += ":*"; + } - // json serializer... FIX errore loop circolare https://www.ryadel.com/en/jsonserializationexception-self-referencing-loop-detected-error-fix-entity-framework-asp-net-core/ + // Configurazione serializzatore JSON per risolvere errore di loop circolare JSSettings = new JsonSerializerSettings() { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }; - // conf message pipe + + // Configurazione pipe dei messaggi CalcDonePipe = new MessagePipe(redisConn, svgChannel); + BomPipe = new MessagePipe(RedisConn, bomChannel); + UpdatePipe = new MessagePipe(RedisConn, updateChannel); } #endregion Public Constructors - #region Protected Fields - - private string svgChannel = ""; - protected static IConfiguration configuration = null!; - protected JsonSerializerSettings? JSSettings; + #region Public Properties /// - /// Message pipe esecuzione elaborazione EgwCalc >> UI + /// Pipe dei messaggi per la comunicazione riguardo update calcolo BOM + /// + public MessagePipe BomPipe { get; set; } = null!; + + /// + /// Pipe dei messaggi per la comunicazione tra servizi di calcolo e interfaccia utente. + /// I messaggi vengono inviati sul canale Redis definito da svgChannel. /// public MessagePipe CalcDonePipe { get; set; } = null!; /// - /// Oggetto per connessione a REDIS + /// Pipe dei messaggi per la comunicazione riguardo update generico UI + /// + public MessagePipe UpdatePipe { get; set; } = null!; + + #endregion Public Properties + + #region Protected Fields + + /// + /// Oggetto di configurazione statico per accedere alle impostazioni dell'applicazione (es. stringhe di connessione). + /// Condiviso tra tutte le istanze di BaseServ. + /// + protected static IConfiguration _config = null!; + + /// + /// Impostazioni del serializzatore JSON utilizzato per gestire oggetti con riferimenti circolari + /// (es. oggetti che si fanno riferimento reciprocamente). + /// + protected JsonSerializerSettings? JSSettings; + + /// + /// Oggetto per la connessione a Redis utilizzato per operazioni di lettura/scrittura. /// protected IConnectionMultiplexer redisConn = null!; - //ISubscriber sub = redis.GetSubscriber(); /// - /// Oggetto DB redis da impiegare x chiamate R/W + /// Database Redis utilizzato per le operazioni di lettura/scrittura + /// nb: ottenuto tramite redisConn.GetDatabase() /// protected IDatabase redisDb = null!; @@ -73,7 +120,7 @@ namespace EgwCoreLib.Lux.Data.Services #region Protected Properties /// - /// Durata cache breve (1 min circa + perturbazione percentuale +/-10%) + /// Durata della cache breve (circa 1 minuto + variazione del +/-10%) /// protected TimeSpan FastCache { @@ -81,7 +128,7 @@ namespace EgwCoreLib.Lux.Data.Services } /// - /// Durata cache lunga (+ perturbazione percentuale +/-10%) + /// Durata della cache lunga (+ variazione del +/-10%) /// protected TimeSpan LongCache { @@ -89,7 +136,7 @@ namespace EgwCoreLib.Lux.Data.Services } /// - /// Durata cache MOLTO breve (10 sec circa + perturbazione percentuale +/-10%) + /// Durata della cache molto breve (circa 10 secondi + variazione del +/-10%) /// protected TimeSpan UltraFastCache { @@ -97,7 +144,7 @@ namespace EgwCoreLib.Lux.Data.Services } /// - /// Durata cache MOLTO lunga (+ perturbazione percentuale +/-10%) + /// Durata della cache molto lunga (+ variazione del +/-10%) /// protected TimeSpan UltraLongCache { @@ -108,20 +155,46 @@ namespace EgwCoreLib.Lux.Data.Services #region Private Fields + /// + /// Oggetto logger utilizzato per registrare eventi e errori a livello di classe. + /// Utile per il monitoraggio del comportamento dell'applicazione e la risoluzione di problemi. + /// private static Logger Log = LogManager.GetCurrentClassLogger(); /// - /// Durata cache lunga IN SECONDI + /// Redis channel for BOM related info + /// + private string bomChannel = ""; + + /// + /// Durata della cache lunga in secondi (predefinito: 5 minuti) + /// Utilizzato nella proprietà LongCache per definire quanto a lungo i dati devono essere memorizzati in cache. /// private int cacheTtlLong = 60 * 5; /// - /// Durata cache breve IN SECONDI + /// Durata della cache breve in secondi (predefinito: 1 minuto) + /// Utilizzato nelle proprietà FastCache e UltraFastCache per definire la durata della cache breve. /// private int cacheTtlShort = 60 * 1; + /// + /// Generatore di numeri casuali utilizzato per introdurre variabilità dinamica nelle durate della cache + /// (simula variazioni reali nella freschezza dei dati e nei tempi di scadenza). + /// private Random rnd = new Random(); + /// + /// Nome del canale Redis utilizzato per l'invio/ricezione di messaggi relativi a img svg. + /// Predefinito a "svg:img" con suffisso ":*". + /// + private string svgChannel = ""; + + /// + /// Nome del canale Redis utilizzato per l'invio/ricezione di messaggi di update + /// + private string updateChannel = ""; + #endregion Private Fields } } \ No newline at end of file diff --git a/EgwCoreLib.Lux.Data/Services/CalcRequestService.cs b/EgwCoreLib.Lux.Data/Services/CalcRequestService.cs new file mode 100644 index 00000000..e74fb77f --- /dev/null +++ b/EgwCoreLib.Lux.Data/Services/CalcRequestService.cs @@ -0,0 +1,83 @@ +using Microsoft.Extensions.Configuration; +using Newtonsoft.Json; +using NLog; +using RestSharp; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EgwCoreLib.Lux.Data.Services +{ + public class CalcRequestService + { + #region Public Constructors + + public CalcRequestService(IConfiguration config, IRedisService redisService) + { + _config = config; + _redisService = redisService; + bomChannel = _config.GetValue("ServerConf:BomChannel") ?? "bom"; + // verifico la url base + apiUrl = _config.GetValue("ServerConf:Prog.ApiUrl") ?? "https://iis01.egalware.com/lux/srv/api"; + routeBasePath = _config.GetValue("ServerConf:RouteBaseUrl") ?? "window"; + // fix opzioni base del RestClient + restOptStd = new RestClientOptions + { + Timeout = TimeSpan.FromSeconds(60), + BaseUrl = new Uri($"{apiUrl}/{routeBasePath}") + }; + Log.Info("ImageCache Service Started"); + } + + #endregion Public Constructors + + #region Public Methods + + /// + /// Effettua una generica chiamata ApiRest + /// + /// URL Api di base + /// Richiesta completa + /// Corpo Json trasmesso con richiesta + /// + public async Task CallRestPost(string ApiUrl, string ApiRequest, object rawBody) + { + RestResponse response; + // cerco online + using (RestClient client = new RestClient(ApiUrl)) + { + var request = new RestRequest(ApiRequest, Method.Post); + string rawData = JsonConvert.SerializeObject(rawBody); + request.AddJsonBody(rawData); + response = await client.ExecutePostAsync(request); + } + return response; + } + + #endregion Public Methods + + #region Private Fields + + private static Logger Log = LogManager.GetCurrentClassLogger(); + private readonly IRedisService _redisService; + private readonly string apiUrl = ""; + private readonly string bomChannel = "bomdev"; + private readonly string routeBasePath = ""; + private IConfiguration _config; + + #endregion Private Fields + + #region Private Properties + + /// + /// Conf client RestSharp standard: + /// - base URI al sito + /// - timeout 1 min + /// + private RestClientOptions restOptStd { get; set; } = new RestClientOptions(); + + #endregion Private Properties + } +} \ No newline at end of file diff --git a/EgwCoreLib.Lux.Data/Services/ConfigDataService.cs b/EgwCoreLib.Lux.Data/Services/ConfigDataService.cs new file mode 100644 index 00000000..c7be39bf --- /dev/null +++ b/EgwCoreLib.Lux.Data/Services/ConfigDataService.cs @@ -0,0 +1,53 @@ +using EgwCoreLib.Lux.Core.RestPayload; +using EgwCoreLib.Lux.Data.Controllers; +using EgwCoreLib.Lux.Data.DbModel.Config; +using EgwMultiEngineManager.Data; +using Microsoft.Extensions.Configuration; +using Newtonsoft.Json; +using NLog; +using StackExchange.Redis; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EgwCoreLib.Lux.Data.Services +{ + public class ConfigDataService : BaseServ + { + + public ConfigDataService(IConfiguration configuration, IConnectionMultiplexer RedisConn) : base(configuration, RedisConn) + { + // init implicito + Log.Info($"ConfigDataService | Init OK"); + } + + /// + /// restituisce l'elenco dell'HW valido in memoria + /// + /// + public List ElencoHw(Constants.EXECENVIRONMENTS execEnvironment, string HwReq = "HW.AGB") + { + List result = new List(); + // leggo obj da redis cache + var currKey = $"{redisBaseKey}:{execEnvironment}:HML:{HwReq}"; + RedisValue rawData = redisDb.StringGet(currKey); + // prendo solo i valori validi (Description <> FamilyName) + if (rawData.HasValue) + { + var currList = JsonConvert.DeserializeObject>($"{rawData}"); + result = currList ?? new List(); + //var currList = JsonConvert.DeserializeObject($"{rawData}"); + //if (currList != null && currList.ListItem != null) + //{ + // result = currList.ListItem; + //} + } + return result; + } + + private static Logger Log = LogManager.GetCurrentClassLogger(); + private string redisBaseKey = "Lux"; + } +} diff --git a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs index 98387b12..68ec8871 100644 --- a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs +++ b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs @@ -1,6 +1,7 @@ using EgwCoreLib.Lux.Core.RestPayload; using EgwCoreLib.Lux.Data.Controllers; -using EgwCoreLib.Lux.Data.DbModel; +using EgwCoreLib.Lux.Data.DbModel.Utils; +using EgwCoreLib.Lux.Data.DbModel.Sales; using EgwMultiEngineManager.Data; using Microsoft.Extensions.Configuration; using Newtonsoft.Json; @@ -15,6 +16,8 @@ using System.Text; using System.Threading.Tasks; using static EgwCoreLib.Lux.Core.Enums; using static System.Runtime.InteropServices.JavaScript.JSType; +using EgwCoreLib.Lux.Data.DbModel.Items; +using EgwCoreLib.Lux.Data.DbModel.Config; namespace EgwCoreLib.Lux.Data.Services { @@ -25,15 +28,15 @@ namespace EgwCoreLib.Lux.Data.Services public DataLayerServices(IConfiguration configuration, IConnectionMultiplexer RedisConn) : base(configuration, RedisConn) { // conf DB - string connStr = BaseServ.configuration.GetConnectionString("Lux.All") ?? ""; + string connStr = BaseServ._config.GetConnectionString("Lux.All") ?? ""; if (string.IsNullOrEmpty(connStr)) { Log.Error("ConnString empty!"); } else { + //dbController = new Controllers.LuxController(_config); dbController = new LuxController(); - //dbController = new Controllers.LuxController(configuration); StringBuilder sb = new StringBuilder(); sb.AppendLine($"DataLayerServices | LuxController OK"); Log.Info(sb.ToString()); @@ -42,14 +45,216 @@ namespace EgwCoreLib.Lux.Data.Services #endregion Public Constructors - #region Public Properties - - public static LuxController dbController { get; set; } = null!; - - #endregion Public Properties - #region Public Methods + /// + /// Elenco completo Config Envir + /// + /// + public async Task> ConfEnvirParamGetAllAsync() + { + string source = "DB"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + List? result = new List(); + // cerco in redis... + string currKey = $"{redisBaseKey}:ConfEnvir"; + RedisValue rawData = await redisDb.StringGetAsync(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + source = "REDIS"; + } + else + { + result = await dbController.ConfEnvirParamGetAllAsync(); + // serializzo e salvo con config x evitare loop... + rawData = JsonConvert.SerializeObject(result, JSSettings); + await redisDb.StringSetAsync(currKey, rawData, UltraLongCache); + } + if (result == null) + { + result = new List(); + } + sw.Stop(); + Log.Debug($"ConfEnvirParamGetAllAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + return result; + } + + /// + /// Esegue eliminazione + refresh cache + /// + /// + /// + public async Task ConfGlassDeleteAsync(GlassModel selRec) + { + bool result = await dbController.ConfGlassDeleteAsync(selRec); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:ConfGlass"); + return result; + } + + /// + /// Elenco completo Config Glass + /// + /// + public async Task> ConfGlassGetAllAsync() + { + string source = "DB"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + List? result = new List(); + // cerco in redis... + string currKey = $"{redisBaseKey}:ConfGlass"; + RedisValue rawData = await redisDb.StringGetAsync(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + source = "REDIS"; + } + else + { + result = await dbController.ConfGlassGetAllAsync(); + // serializzo e salvo con config x evitare loop... + rawData = JsonConvert.SerializeObject(result, JSSettings); + await redisDb.StringSetAsync(currKey, rawData, UltraLongCache); + } + if (result == null) + { + result = new List(); + } + sw.Stop(); + Log.Debug($"ConfGlassGetAllAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + return result; + } + + /// + /// Esegue Upsert del record ricevuto + /// + /// + /// + public async Task ConfGlassUpsertAsync(GlassModel upsRec) + { + bool result = await dbController.ConfGlassUpsertAsync(upsRec); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:ConfGlass"); + return result; + } + + /// + /// Esegue eliminazione + refresh cache + /// + /// + /// + public async Task ConfProfileDeleteAsync(ProfileModel selRec) + { + bool result = await dbController.ConfProfileDeleteAsync(selRec); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:ConfProfile"); + return result; + } + + /// + /// Elenco completo Config Profile + /// + /// + public async Task> ConfProfileGetAllAsync() + { + string source = "DB"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + List? result = new List(); + // cerco in redis... + string currKey = $"{redisBaseKey}:ConfProfile"; + RedisValue rawData = await redisDb.StringGetAsync(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + source = "REDIS"; + } + else + { + result = await dbController.ConfProfileGetAllAsync(); + // serializzo e salvo con config x evitare loop... + rawData = JsonConvert.SerializeObject(result, JSSettings); + await redisDb.StringSetAsync(currKey, rawData, UltraLongCache); + } + if (result == null) + { + result = new List(); + } + sw.Stop(); + Log.Debug($"ConfProfileGetAllAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + return result; + } + + /// + /// Esegue Upsert del record ricevuto + /// + /// + /// + public async Task ConfProfileUpsertAsync(ProfileModel upsRec) + { + bool result = await dbController.ConfProfileUpsertAsync(upsRec); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:ConfProfile"); + return result; + } + + /// + /// Esegue eliminazione + refresh cache + /// + /// + /// + public async Task ConfWoodDeleteAsync(WoodModel selRec) + { + bool result = await dbController.ConfWoodDeleteAsync(selRec); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:ConfWood"); + return result; + } + + /// + /// Elenco completo Config Wood + /// + /// + public async Task> ConfWoodGetAllAsync() + { + string source = "DB"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + List? result = new List(); + // cerco in redis... + string currKey = $"{redisBaseKey}:ConfWood"; + RedisValue rawData = await redisDb.StringGetAsync(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + source = "REDIS"; + } + else + { + result = await dbController.ConfWoodGetAllAsync(); + // serializzo e salvo con config x evitare loop... + rawData = JsonConvert.SerializeObject(result, JSSettings); + await redisDb.StringSetAsync(currKey, rawData, UltraLongCache); + } + if (result == null) + { + result = new List(); + } + sw.Stop(); + Log.Debug($"ConfWoodGetAllAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + return result; + } + + /// + /// Esegue Upsert del record ricevuto + /// + /// + /// + public async Task ConfWoodUpsertAsync(WoodModel upsRec) + { + bool result = await dbController.ConfWoodUpsertAsync(upsRec); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:ConfWood"); + return result; + } + /// /// Elenco completo Customers /// @@ -73,7 +278,7 @@ namespace EgwCoreLib.Lux.Data.Services result = dbController.CustomersGetAll(); // serializzo e salvo... rawData = JsonConvert.SerializeObject(result); - redisDb.StringSet(currKey, rawData, LongCache); + redisDb.StringSet(currKey, rawData, UltraLongCache); } if (result == null) { @@ -148,6 +353,171 @@ namespace EgwCoreLib.Lux.Data.Services return answ; } + /// + /// Reset cache sistema x Offerte modalità async + /// + public async Task FlushCacheOffersAsync() + { + bool answ = false; + Stopwatch sw = new Stopwatch(); + sw.Start(); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Offers:*"); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:OfferRows:*"); + sw.Stop(); + Log.Debug($"FlushCacheOffersAsync in {sw.Elapsed.TotalMilliseconds} ms"); + return answ; + } + + /// + /// Reset cache sistema x Ordini modalità async + /// + public async Task FlushCacheOrdersAsync() + { + bool answ = false; + Stopwatch sw = new Stopwatch(); + sw.Start(); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Orders:*"); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:OrderRows:*"); + sw.Stop(); + Log.Debug($"FlushCacheOrdersAsync in {sw.Elapsed.TotalMilliseconds} ms"); + return answ; + } + + /// + /// Esegue eliminazione + refresh cache + /// + /// + /// + public async Task GenClassDeleteAsync(GenClassModel selRec) + { + bool result = await dbController.GenClassDeleteAsync(selRec); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:GenClass"); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:GenVal:*"); + return result; + } + + /// + /// Elenco completo GenClass + /// + /// + public async Task> GenClassGetAllAsync() + { + string source = "DB"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + List? result = new List(); + // cerco in redis... + string currKey = $"{redisBaseKey}:GenClass"; + RedisValue rawData = await redisDb.StringGetAsync(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + source = "REDIS"; + } + else + { + result = await dbController.GenClassGetAllAsync(); + // serializzo e salvo con config x evitare loop... + rawData = JsonConvert.SerializeObject(result, JSSettings); + await redisDb.StringSetAsync(currKey, rawData, LongCache); + } + if (result == null) + { + result = new List(); + } + sw.Stop(); + Log.Debug($"GenClassGetAllAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + return result; + } + + /// + /// Esegue Upsert del record ricevuto + /// + /// + /// + public async Task GenClassUpsertAsync(GenClassModel upsRec) + { + bool result = await dbController.GenClassUpsertAsync(upsRec); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:GenClass"); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:GenVal:*"); + return result; + } + + /// + /// Esegue eliminazione + refresh cache + /// + /// + /// + public async Task GenValDeleteAsync(GenValueModel selRec) + { + bool result = await dbController.GenValDeleteAsync(selRec); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:GenClass"); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:GenVal:*"); + return result; + } + + /// + /// Elenco valori x classe richiesta + /// + /// + /// + public async Task> GenValGetFiltAsync(string codClass) + { + string source = "DB"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + List? result = new List(); + // cerco in redis... + string currKey = $"{redisBaseKey}:GenVal:{codClass}"; + RedisValue rawData = await redisDb.StringGetAsync(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + source = "REDIS"; + } + else + { + result = await dbController.GenValGetFiltAsync(codClass); + // serializzo e salvo con config x evitare loop... + rawData = JsonConvert.SerializeObject(result, JSSettings); + await redisDb.StringSetAsync(currKey, rawData, LongCache); + } + if (result == null) + { + result = new List(); + } + sw.Stop(); + Log.Debug($"GenValGetFiltAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + return result; + } + + /// + /// Esegue spostamento nell'ordinamento relativo alla classe + refresh cache + /// + /// + /// + /// + public async Task GenValMoveAsync(GenValueModel selRec, bool moveUp) + { + bool result = await dbController.GenValMoveAsync(selRec, moveUp); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:GenClass"); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:GenVal:*"); + return result; + } + + /// + /// Esegue Upsert del record ricevuto + /// + /// + /// + public async Task GenValUpsertAsync(GenValueModel upsRec) + { + bool result = await dbController.GenValUpsertAsync(upsRec); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:GenClass"); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:GenVal:*"); + return result; + } + /// /// Eliminazione record item /// @@ -197,43 +567,6 @@ namespace EgwCoreLib.Lux.Data.Services return result; } -#if false - /// - /// Elenco item Child da ParentId (per sostituzione) async - /// - /// ID corrente di cui cercare parent + fratelli - /// - public List ItemGetChild(int ItemId) - { - string source = "DB"; - Stopwatch sw = new Stopwatch(); - sw.Start(); - List? result = new List(); - // cerco in redis... - string currKey = $"{redisBaseKey}:Item:ListChild:{ItemId}"; - RedisValue rawData = redisDb.StringGet(currKey); - if (rawData.HasValue) - { - result = JsonConvert.DeserializeObject>($"{rawData}"); - source = "REDIS"; - } - else - { - result = dbController.ItemGetChild(ItemId); - // serializzo e salvo con config x evitare loop... - rawData = JsonConvert.SerializeObject(result, JSSettings); - redisDb.StringSet(currKey, rawData, FastCache); - } - if (result == null) - { - result = new List(); - } - sw.Stop(); - Log.Debug($"ItemGetChild | {source} | {sw.Elapsed.TotalMilliseconds}ms"); - return result; - } -#endif - /// /// Elenco item da ricerca completa Async /// @@ -442,7 +775,27 @@ namespace EgwCoreLib.Lux.Data.Services } /// - /// Effettua update dei costi di tutte le righe dell'offerta indicata + /// Effettua fix UID righe child dell'offerta indicata e restituisce elenco UID da chiamare x refresh + /// + /// Key + /// + public async Task> OffertRowFixUid(int OffertID) + { + List answ = new List(); + Stopwatch sw = new Stopwatch(); + sw.Start(); + // calcolo + answ = dbController.OffertRowFixUid(OffertID); + // svuoto cache... + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Offers:*"); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:OfferRows:*"); + sw.Stop(); + Log.Debug($"OffertRowFixUid in {sw.Elapsed.TotalMilliseconds} ms"); + return answ; + } + + /// + /// Effettua update della BOM (e dei costi) di tutte le righe dell'offerta indicata /// /// ID riga offerta da aggiornare /// Bom aggiornata da salvare @@ -461,6 +814,111 @@ namespace EgwCoreLib.Lux.Data.Services return fatto; } + /// + /// Effettua update delle info legate al file per la riga offerta + /// + /// IRiga offerta coin dati FILE da aggiornare + /// + public async Task OffertRowUpdateFileData(OfferRowModel updRec) + { + Stopwatch sw = new Stopwatch(); + sw.Start(); + // calcolo + bool fatto = await dbController.OffertRowUpdateFileData(updRec); + // svuoto cache... + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Offers:*"); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:OfferRows:*"); + sw.Stop(); + Log.Debug($"OffertRowUpdateFileData in {sw.Elapsed.TotalMilliseconds} ms"); + return fatto; + } + + /// + /// Effettua update del valore serializzato della riga offerta + /// + /// ID riga offerta da aggiornare + /// Serializzazione oggetto (es JWD) + /// + public async Task OffertRowUpdateSerStruct(int OfferRowID, string serStruct) + { + Stopwatch sw = new Stopwatch(); + sw.Start(); + // calcolo + bool fatto = await dbController.OffertRowUpdateSerStruct(OfferRowID, serStruct); + // svuoto cache... + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Offers:*"); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:OfferRows:*"); + sw.Stop(); + Log.Debug($"OffertRowUpdateSerStruct in {sw.Elapsed.TotalMilliseconds} ms"); + return fatto; + } + + + /// + /// Effettua eliminazione della riga offerta + /// + /// IRiga offerta coin dati FILE da aggiornare + /// + public async Task OffertRowDelete(OfferRowModel updRec) + { + Stopwatch sw = new Stopwatch(); + sw.Start(); + // calcolo + bool fatto = await dbController.OffertRowDelete(updRec); + // svuoto cache... + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Offers:*"); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:OfferRows:*"); + sw.Stop(); + Log.Debug($"OffertRowDelete in {sw.Elapsed.TotalMilliseconds} ms"); + return fatto; + } + + /// + /// Effettua Upsert della riga offerta + /// + /// IRiga offerta coin dati FILE da aggiornare + /// + public async Task OffertRowUpsert(OfferRowModel updRec) + { + Stopwatch sw = new Stopwatch(); + sw.Start(); + // calcolo + bool fatto = await dbController.OffertRowUpsert(updRec); + // svuoto cache... + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Offers:*"); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:OfferRows:*"); + sw.Stop(); + Log.Debug($"OffertRowUpsert in {sw.Elapsed.TotalMilliseconds} ms"); + return fatto; + } + + /// + /// Effettua update stato await BOM/PRICE per l'offerta indicata + /// + /// ID singola riga offerta + /// Se non nullo è il nuovo stato await BOM + /// Se non nullo è stato await Price + /// Indica se svuotare la cache + /// + public async Task OffertUpdateAwaitState(int offerRowID, bool? awaitBom, bool? awaitPrice, bool flushCache = false) + { + Stopwatch sw = new Stopwatch(); + sw.Start(); + // aggiorno + bool fatto = await dbController.OffertUpdateAwaitState(offerRowID, awaitBom, awaitPrice); + if (flushCache) + { + // svuoto cache... +#if false + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Offers:*"); +#endif + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:OfferRows:*"); + } + sw.Stop(); + Log.Debug($"OffertUpdateAwaitState in {sw.Elapsed.TotalMilliseconds} ms"); + return fatto; + } + /// /// Effettua update dei costi di tutte le righe dell'offerta indicata /// @@ -480,6 +938,25 @@ namespace EgwCoreLib.Lux.Data.Services return fatto; } + /// + /// Effettua Upsert complessivo record offerta + /// + /// Key + /// + public async Task OffertUpsert(OfferModel updRec) + { + Stopwatch sw = new Stopwatch(); + sw.Start(); + // calcolo + bool fatto = await dbController.OffertUpsert(updRec); + // svuoto cache... + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Offers:*"); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:OfferRows:*"); + sw.Stop(); + Log.Debug($"OffertUpsert in {sw.Elapsed.TotalMilliseconds} ms"); + return fatto; + } + /// /// Esegue salvataggio BOM sul DB /// @@ -498,7 +975,7 @@ namespace EgwCoreLib.Lux.Data.Services var bomList = JsonConvert.DeserializeObject>(bomContent); if (bomList != null) { - // verifico 1:1 gli item ricevuti dalla BOM sul DB con eventuale insert in anagrafica + // verifico 1:1 gli item ricevuti dalla BOM sul DB con eventuale insert in anagrafica dei nuovi dbController.ItemUpsertFromBom(bomList); // salvo la BOM nel record del DB relativo all'oggetto richiesto dbController.OfferUpsertFromBom(uID, bomList); @@ -732,5 +1209,48 @@ namespace EgwCoreLib.Lux.Data.Services private string redisBaseKey = "Lux:Cache"; #endregion Private Fields + + #region Private Properties + + private static LuxController dbController { get; set; } = null!; + + #endregion Private Properties + +#if false + /// + /// Elenco item Child da ParentId (per sostituzione) async + /// + /// ID corrente di cui cercare parent + fratelli + /// + public List ItemGetChild(int ItemId) + { + string source = "DB"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + List? result = new List(); + // cerco in redis... + string currKey = $"{redisBaseKey}:Item:ListChild:{ItemId}"; + RedisValue rawData = redisDb.StringGet(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + source = "REDIS"; + } + else + { + result = dbController.ItemGetChild(ItemId); + // serializzo e salvo con config x evitare loop... + rawData = JsonConvert.SerializeObject(result, JSSettings); + redisDb.StringSet(currKey, rawData, FastCache); + } + if (result == null) + { + result = new List(); + } + sw.Stop(); + Log.Debug($"ItemGetChild | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + return result; + } +#endif } } \ No newline at end of file diff --git a/EgwCoreLib.Lux.Data/Services/IRedisService.cs b/EgwCoreLib.Lux.Data/Services/IRedisService.cs index 11ee11b5..4525ea5c 100644 --- a/EgwCoreLib.Lux.Data/Services/IRedisService.cs +++ b/EgwCoreLib.Lux.Data/Services/IRedisService.cs @@ -12,10 +12,6 @@ namespace EgwCoreLib.Lux.Data.Services /// public interface IRedisService { -#if false - IDatabase GetDatabase(); - void Publish(string channel, string message); -#endif long Publish(string channel, string message); Task PublishAsync(string channel, string message); diff --git a/EgwCoreLib.Lux.Data/Services/ImageCacheService.cs b/EgwCoreLib.Lux.Data/Services/ImageCacheService.cs index ed109aba..20f1c660 100644 --- a/EgwCoreLib.Lux.Data/Services/ImageCacheService.cs +++ b/EgwCoreLib.Lux.Data/Services/ImageCacheService.cs @@ -25,6 +25,8 @@ namespace EgwCoreLib.Lux.Data.Services liveTag = _config.GetValue("ServerConf:ImageLiveTag") ?? "svg"; cacheTag = _config.GetValue("ServerConf:ImageFileTag") ?? "svgfile"; calcTag = _config.GetValue("ServerConf:ImageCalcTag") ?? "svg-preview"; + bomChannel = _config.GetValue("ServerConf:BomChannel") ?? "Egw-bom"; + updateChannel = _config.GetValue("ServerConf:UpdateChannel") ?? "Egw-update"; // verifico la url base apiUrl = _config.GetValue("ServerConf:Prog.ApiUrl") ?? "https://iis01.egalware.com/lux/srv/api"; imgBasePath = _config.GetValue("ServerConf:ImageBaseUrl") ?? "window"; @@ -114,11 +116,12 @@ namespace EgwCoreLib.Lux.Data.Services public string ImageUrl(string baseUrl, bool isLive, string imgUID, EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW) { string tag = isLive ? liveTag : cacheTag; - if (!imgUID.EndsWith(".svg")) + if (imgUID.EndsWith(".svg")) { - imgUID += ".svg"; + imgUID.Replace(".svg",""); } - string fullUrl = $"{baseUrl}/{tag}/{imgUID}?envir={envir}".Replace("////", "//"); + string rndImg = $"{DateTime.Now:HHmmssfff}"; + string fullUrl = $"{baseUrl}/{tag}/{imgUID}-{rndImg}.svg?envir={envir}".Replace("////", "//"); return fullUrl; } @@ -168,13 +171,14 @@ namespace EgwCoreLib.Lux.Data.Services } /// - /// Salva e invia su channel img redis SVG per il doc richiesto + /// Salva e invia su channel BOM redis il doc richiesto /// /// + /// /// - public async Task SaveBomAsync(string uid, EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS env, string bomContent) + public async Task SaveBomAsync(string uid, Constants.EXECENVIRONMENTS env, string bomContent) { - // salvo img in cache + // salvo in cache string currKey = $"{redisBaseKey}:{env}:BOM:{uid.Replace("/", ":")}"; var done = await _redisService.SetAsync(currKey, bomContent); // invio notifica nuova svg generata sul canale... viene inviato solo svg con ID nel canale @@ -183,12 +187,29 @@ namespace EgwCoreLib.Lux.Data.Services return done; } + /// + /// Salva e invia su channel richiesto un update x UID + /// è attesao un refresh per chi sottoscrive il canale + /// + /// + /// + public async Task PublishUpdateAsync(string uid, Constants.EXECENVIRONMENTS env) + { + bool done = false; + // invio notifica sul canale di update generale... + string notifyChannel = $"{updateChannel}:{env}"; + // contenuto è UID + long numSent = await _redisService.PublishAsync(notifyChannel, $"{uid}"); + done = numSent > 0; + return done; + } + /// /// Salva e invia su channel img redis SVG per il doc richiesto /// /// /// - public async Task SaveHmlAsync(string uid, EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS env, string rawData) + public async Task SaveHmlAsync(string uid, Constants.EXECENVIRONMENTS env, string rawData) { // salvo img in cache string currKey = $"{redisBaseKey}:{env}:HML:{uid.Replace("/", ":")}"; @@ -244,6 +265,7 @@ namespace EgwCoreLib.Lux.Data.Services private readonly string apiUrl = ""; private readonly string bomChannel = "bom:item"; + private readonly string updateChannel = "ui:update"; private readonly string cacheTag = "svgfile"; private readonly string calcTag = "svgpreview"; private readonly string hmlChannel = "hml:item"; diff --git a/EgwCoreLib.Lux.Data/docs/Readme.md b/EgwCoreLib.Lux.Data/docs/Readme.md index d1aac232..9dfffdc2 100644 --- a/EgwCoreLib.Lux.Data/docs/Readme.md +++ b/EgwCoreLib.Lux.Data/docs/Readme.md @@ -7,6 +7,13 @@ Lbreria salvata come nuget SDK per accesso dati per EgalWare's LUX Necessaria rpesenza configurazione DB/Redis in appsettings.json: esempio dev ufficio: +```json + "ConnectionStrings": { + "DefaultConnection": "Server=mdb.ufficio;port=3306;database=Lux_000_dev_;uid=db_user;pwd=secure_password;sslmode=None;", + "Redis": "redis.ufficio:26379, serviceName=devel, DefaultDatabase=6, keepAlive=180, connectTimeout=15000, syncTimeout=15000, asyncTimeout=15000, abortConnect=false, ssl=false, allowAdmin=true" + }, +``` +esempio prod ufficio: ```json "ConnectionStrings": { "DefaultConnection": "Server=mdb.ufficio;port=3306;database=Lux_000;uid=db_user;pwd=secure_password;sslmode=None;", diff --git a/Lux.API/Controllers/GenericController.cs b/Lux.API/Controllers/GenericController.cs index 2ea38ffa..9ff26c35 100644 --- a/Lux.API/Controllers/GenericController.cs +++ b/Lux.API/Controllers/GenericController.cs @@ -36,13 +36,7 @@ namespace Lux.API.Controllers { Stopwatch sw = new Stopwatch(); sw.Start(); - string svgContent = ""; - - // se contiene ".svg" lo levo... - if (id.EndsWith(".svg")) - { - id = id.Replace(".svg", ""); - } + string retVal = ""; // ...se ricevo percorso --> leggo jwd/svg cablato if (currReq != null) @@ -62,11 +56,48 @@ namespace Lux.API.Controllers QuestionDTO currArgs = new QuestionDTO(nId, currReq.EnvType, DictExec); await _redisService.PublishAsync(pubChannel, currArgs.sProcessArgs); - svgContent = "DONE"; + retVal = "DONE"; } sw.Stop(); Log.Info($"calcSvg | {sw.Elapsed.TotalMilliseconds:N3} ms"); - return Ok(svgContent); + return Ok(retVal); + } + + /// + /// Chiamata POST: riceve Json in formato JWD serializzato, invia richiesta calcolo modo 2 (BOM) + /// PUT: api/window/bom/00000000-0000-0000-0000-000000000000 + /// + /// id oggetto + /// + [HttpPost("bom/{id}")] + public async Task> getBom(string id, [FromBody] string currSer) + { + Stopwatch sw = new Stopwatch(); + sw.Start(); + string retVal = ""; + + // se messaggio vuoto --> uso default! + currSer = string.IsNullOrEmpty(currSer) ? "" : currSer; + + // ...se ricevo percorso --> leggo jwd/svg cablato + if (!string.IsNullOrEmpty(currSer)) + { + Dictionary DictExec = new Dictionary(); + // cablata la BOM + DictExec.Add("Mode", "2"); + // UID cablato x ora... + DictExec.Add("UID", id); + DictExec.Add("Jwd", currSer); + int nId = 1; + // da modificare con tipo richiesta... + QuestionDTO currArgs = new QuestionDTO(nId, EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW, DictExec); + + await _redisService.PublishAsync(pubChannel, currArgs.sProcessArgs); + retVal = "DONE"; + } + sw.Stop(); + Log.Info($"getBom | {sw.Elapsed.TotalMilliseconds:N3} ms"); + return Ok(retVal); } #endregion Public Methods diff --git a/Lux.API/Controllers/WindowController.cs b/Lux.API/Controllers/WindowController.cs index a1df77c4..19a05e9e 100644 --- a/Lux.API/Controllers/WindowController.cs +++ b/Lux.API/Controllers/WindowController.cs @@ -1,4 +1,5 @@ using EgwCoreLib.Lux.Core; +using EgwCoreLib.Lux.Data.DbModel.Config; using EgwCoreLib.Lux.Data.Services; using EgwMultiEngineManager.Data; using Microsoft.AspNetCore.Mvc; @@ -13,11 +14,12 @@ namespace Lux.API.Controllers { #region Public Constructors - public WindowController(IConfiguration config, IRedisService redisService, ImageCacheService imgServ) + public WindowController(IConfiguration config, IRedisService redisService, ImageCacheService imgServ, ConfigDataService confServ) { _config = config; _redisService = redisService; _imgService = imgServ; + _confService = confServ; pubChannel = _config.GetValue("ServerConf:PubChannel") ?? ""; } @@ -75,7 +77,7 @@ namespace Lux.API.Controllers } /// - /// Chiamata GET: riceve Json in formato serializzato, invia richiesta modo 3 (HardwareModelList) + /// Chiamata GET: invia richiesta modo 3 (HardwareModelList) che sarà poi salvata /// GET: api/window/hwlist /// /// id oggetto @@ -86,6 +88,19 @@ namespace Lux.API.Controllers Stopwatch sw = new Stopwatch(); sw.Start(); string hwContent = ""; + await sendHwReq(); + hwContent = "DONE"; + sw.Stop(); + Log.Info($"getHardwareList | {sw.Elapsed.TotalMilliseconds:N3} ms"); + return Ok(hwContent); + } + + /// + /// Esegue invio effettivo richiesta elenco HW list + /// + /// + private async Task sendHwReq() + { Dictionary DictExec = new Dictionary(); DictExec.Add("Mode", $"{(int)Enums.EngineQueryType.HardwareModelList}"); // da rivedere? @@ -96,10 +111,38 @@ namespace Lux.API.Controllers // da modificare con tipo richiesta... QuestionDTO currArgs = new QuestionDTO(nId, EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW, DictExec); await _redisService.PublishAsync(pubChannel, currArgs.sProcessArgs); - hwContent = "DONE"; + } + + /// + /// Chiamata GET: + /// - se trova in cache risponde con elenco hw già ricevuto + /// - se non trova invia richiesta modo 3 (HardwareModelList) che sarà poi salvata + /// GET: api/window/hwlist/nome_produttore + /// + /// nome del produttore, es HW.AGB (default) + /// + [HttpGet("hwlist/{id}")] + public async Task>> getHardwareList(string id) + { + Stopwatch sw = new Stopwatch(); + sw.Start(); + string hwReq = id ?? "HW.AGB"; + var answ = _confService.ElencoHw(EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW, hwReq); + if (answ == null || answ.Count == 0) + { + await sendHwReq(); + answ = new List(); + } + // filtro quelli default/non significativi (famili=descript) + else + { + answ = answ + .Where(x => !x.FamilyName.Equals(x.Description, StringComparison.OrdinalIgnoreCase)) + .ToList(); + } sw.Stop(); Log.Info($"getHardwareList | {sw.Elapsed.TotalMilliseconds:N3} ms"); - return Ok(hwContent); + return Ok(answ); } /// @@ -224,6 +267,7 @@ namespace Lux.API.Controllers #region Private Properties private ImageCacheService _imgService { get; set; } + private ConfigDataService _confService { get; set; } #endregion Private Properties } diff --git a/Lux.API/Lux.API.csproj b/Lux.API/Lux.API.csproj index 45a556bc..bc0007fe 100644 --- a/Lux.API/Lux.API.csproj +++ b/Lux.API/Lux.API.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 0.9.2509.1807 + 0.9.2510.2012 @@ -65,8 +65,6 @@ - - diff --git a/Lux.API/Program.cs b/Lux.API/Program.cs index d7ef54a3..86926adb 100644 --- a/Lux.API/Program.cs +++ b/Lux.API/Program.cs @@ -48,6 +48,7 @@ builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddHostedService(); +builder.Services.AddSingleton(); var app = builder.Build(); diff --git a/Lux.API/Services/ExternalMessageProcessor.cs b/Lux.API/Services/ExternalMessageProcessor.cs index ba926c0c..dd41589f 100644 --- a/Lux.API/Services/ExternalMessageProcessor.cs +++ b/Lux.API/Services/ExternalMessageProcessor.cs @@ -59,6 +59,9 @@ namespace Lux.API.Services await cacheService.SaveBomAsync(UID, retData.ExecEnvironment, newBom); // salvo la BOM completa con i dati recuperati dal DB await dbService.SaveBomAsync(UID, retData.ExecEnvironment, newBom); + + // pubblico refresh info così da segnalare richeista di update conseguente + await cacheService.PublishUpdateAsync(UID, retData.ExecEnvironment); } if (retData.Args.ContainsKey("HardwareModelList")) { @@ -90,9 +93,9 @@ namespace Lux.API.Services #region Private Fields + private static Logger Log = LogManager.GetCurrentClassLogger(); private readonly ImageCacheService cacheService; private readonly DataLayerServices dbService; - private static Logger Log = LogManager.GetCurrentClassLogger(); #endregion Private Fields diff --git a/Lux.API/appsettings.Development.json b/Lux.API/appsettings.Development.json index c294297e..e186d4f6 100644 --- a/Lux.API/appsettings.Development.json +++ b/Lux.API/appsettings.Development.json @@ -7,7 +7,8 @@ }, "ServerConf": { "BaseUrl": "/lux/srv/", - "PubChannel": "EgwEngineInput", - "SubChannel": "EgwEngineOutput" + "PubChannel": "EgwDevEngineInput", + "SubChannel": "EgwDevEngineOutput", + "ImageBaseUrl": "https://iis01.egalware.com/lux/srv/api/window/" } } diff --git a/Lux.API/appsettings.Production.json b/Lux.API/appsettings.Production.json index c294297e..535094eb 100644 --- a/Lux.API/appsettings.Production.json +++ b/Lux.API/appsettings.Production.json @@ -8,6 +8,7 @@ "ServerConf": { "BaseUrl": "/lux/srv/", "PubChannel": "EgwEngineInput", - "SubChannel": "EgwEngineOutput" + "SubChannel": "EgwEngineOutput", + "ImageBaseUrl": "https://office.egalware.com/lux/srv/api/window/" } } diff --git a/Lux.API/appsettings.Staging.json b/Lux.API/appsettings.Staging.json index 027eceaa..c294297e 100644 --- a/Lux.API/appsettings.Staging.json +++ b/Lux.API/appsettings.Staging.json @@ -7,9 +7,7 @@ }, "ServerConf": { "BaseUrl": "/lux/srv/", - //"PubChannel": "EgwEngineInput", - //"SubChannel": "EgwEngineOutput", - "PubChannel": "EgwDevEngineInput", - "SubChannel": "EgwDevEngineOutput" + "PubChannel": "EgwEngineInput", + "SubChannel": "EgwEngineOutput" } } diff --git a/Lux.API/appsettings.json b/Lux.API/appsettings.json index 35681f79..827253c5 100644 --- a/Lux.API/appsettings.json +++ b/Lux.API/appsettings.json @@ -50,15 +50,17 @@ }, "AllowedHosts": "*", "ConnectionStrings": { - //"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50;Trusted_Connection=True;MultipleActiveResultSets=true", "DefaultConnection": "Server=mdb.ufficio;port=3306;database=Lux_000;uid=lux_user;pwd=Egal_pwd!;sslmode=None;", "Lux.All": "Server=SQL2016DEV;Database=MoonPro_STATS; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.Land;", "Redis": "redis.ufficio:26379, serviceName=devel, DefaultDatabase=6, keepAlive=180, connectTimeout=15000, syncTimeout=15000, asyncTimeout=15000, abortConnect=false, ssl=false, allowAdmin=true" }, "ServerConf": { + "CalcTag": "calc", "PubChannel": "EgwEngineInput", "SubChannel": "EgwEngineOutput", - "SvgChannel": "svg:img", + "SvgChannel": "Egw:svg:img", + "BomChannel": "Egw:bom", + "UpdateChannel": "Egw:update", "BaseUrl": "/lux/srv/", "ImageBaseUrl": "https://iis01.egalware.com/lux/srv/api/window/", "ImageLiveTag": "svg", diff --git a/Lux.All.sln b/Lux.All.sln index 63b485cb..0e401e85 100644 --- a/Lux.All.sln +++ b/Lux.All.sln @@ -7,8 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EgwCoreLib.Lux.Core", "EgwC EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EgwCoreLib.Lux.Data", "EgwCoreLib.Lux.Data\EgwCoreLib.Lux.Data.csproj", "{9BA9FBAC-0D76-41CA-9970-A8DB982CC5F0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp", "TestApp\TestApp.csproj", "{E94496AD-22BB-4443-9A81-11D19AFBE0A3}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lux.UI", "Lux.UI\Lux.UI.csproj", "{A3B8FAE0-3BAD-4402-B4D9-26DD9CB777E5}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lux.UI.Client", "Lux.UI.Client\Lux.UI.Client.csproj", "{ECA4B6A4-692B-41EB-8238-C33C5FB71942}" @@ -29,10 +27,6 @@ Global {9BA9FBAC-0D76-41CA-9970-A8DB982CC5F0}.Debug|Any CPU.Build.0 = Debug|Any CPU {9BA9FBAC-0D76-41CA-9970-A8DB982CC5F0}.Release|Any CPU.ActiveCfg = Release|Any CPU {9BA9FBAC-0D76-41CA-9970-A8DB982CC5F0}.Release|Any CPU.Build.0 = Release|Any CPU - {E94496AD-22BB-4443-9A81-11D19AFBE0A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E94496AD-22BB-4443-9A81-11D19AFBE0A3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E94496AD-22BB-4443-9A81-11D19AFBE0A3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E94496AD-22BB-4443-9A81-11D19AFBE0A3}.Release|Any CPU.Build.0 = Release|Any CPU {A3B8FAE0-3BAD-4402-B4D9-26DD9CB777E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A3B8FAE0-3BAD-4402-B4D9-26DD9CB777E5}.Debug|Any CPU.Build.0 = Debug|Any CPU {A3B8FAE0-3BAD-4402-B4D9-26DD9CB777E5}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/Lux.UI.Client/Lux.UI.Client.csproj b/Lux.UI.Client/Lux.UI.Client.csproj index 23bd6929..5a9cb290 100644 --- a/Lux.UI.Client/Lux.UI.Client.csproj +++ b/Lux.UI.Client/Lux.UI.Client.csproj @@ -9,7 +9,7 @@ - + diff --git a/Lux.UI/Components/Compo/Component.razor b/Lux.UI/Components/Compo/Component.razor new file mode 100644 index 00000000..e69de29b diff --git a/Lux.UI/Components/Compo/Config/GlassMan.razor b/Lux.UI/Components/Compo/Config/GlassMan.razor new file mode 100644 index 00000000..11b57793 --- /dev/null +++ b/Lux.UI/Components/Compo/Config/GlassMan.razor @@ -0,0 +1,81 @@ +
+
+
+
+
Conf. Vetro
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+ @if (isLoading || ListRecords == null) + { + + } + else if (totalCount == 0) + { +
Nessun record trovato
+ } + else + { + + + + + @* *@ + + + + + + + + + @foreach (var item in ListRecords) + { + + + + + + + + } + + @if (totalCount >= numRecord) + { + + + + + + } +
+ + IDCod.DescrizioneSize mm + +
@item.GlassID@item.Code@item.Description@($"{item.Thickness:N2}") + @if (false) + { + + } + else + { + + } +
+ +
+ } +
+
diff --git a/Lux.UI/Components/Compo/Config/GlassMan.razor.cs b/Lux.UI/Components/Compo/Config/GlassMan.razor.cs new file mode 100644 index 00000000..dd33bb6a --- /dev/null +++ b/Lux.UI/Components/Compo/Config/GlassMan.razor.cs @@ -0,0 +1,199 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using EgwCoreLib.Lux.Data.DbModel.Config; +using EgwCoreLib.Lux.Data.Services; + +namespace Lux.UI.Components.Compo.Config +{ + public partial class GlassMan + { + #region Protected Properties + + [Inject] + protected DataLayerServices DLService { get; set; } = null!; + + [Inject] + protected IJSRuntime JSRuntime { get; set; } = null!; + + protected string SearchVal + { + get => searchVal; + set + { + if (searchVal != value) + { + searchVal = value; + _ = FullUpdate(); + } + } + } + + #endregion Protected Properties + + #region Protected Methods + + /// + /// impossta record x eliminazione + /// + /// + protected async Task DoDelete(GlassModel selRec) + { + if (!await JSRuntime.InvokeAsync("confirm", $"Sicuro di voler eliminare il record? Dettagli: {selRec.GlassID} | {selRec.Description} | {selRec.Thickness}")) + return; + + // esegue eliminazione del record... + await DLService.ConfGlassDeleteAsync(selRec); + + EditRecord = null; + SelRecord = null; + await ReloadData(); + UpdateTable(); + } + + /// + /// Edit articolo selezionato + /// + /// + protected void DoEdit(GlassModel curRec) + { + EditRecord = curRec; + } + + /// + /// Reset selezione + /// + protected void DoReset() + { + EditRecord = null; + } + + /// + /// Selezione articolo x display info + /// + /// + protected void DoSelect(GlassModel curRec) + { + SelRecord = curRec; + } + + protected override async Task OnParametersSetAsync() + { + await ReloadData(); + UpdateTable(); + } + + protected void ResetSearch() + { + SearchVal = ""; + } + + protected void SaveNumRec(int newNum) + { + numRecord = newNum; + UpdateTable(); + } + + protected void SavePage(int newNum) + { + currPage = newNum; + UpdateTable(); + } + + #endregion Protected Methods + + #region Private Fields + + private List AllRecords = new(); + private int currPage = 1; + private GlassModel? EditRecord = null; + private bool isLoading = false; + private List ListRecords = new(); + private int numRecord = 5; + private GlassModel? SelRecord = null; + private int totalCount = 0; + + #endregion Private Fields + + #region Private Properties + + private string searchVal { get; set; } = string.Empty; + + #endregion Private Properties + + #region Private Methods + + private async Task DoAdd() + { + // aggiungo un nuovo record in coda... + EditRecord = new GlassModel() + { + Description = "New Glass", + Code = "", + Thickness = 30 + }; + await DoSave(EditRecord); + } + + private async Task DoSave(GlassModel currRec) + { + // salvo + await DLService.ConfGlassUpsertAsync(currRec); + await ResetEdit(); + UpdateTable(); + EditRecord = null; + SelRecord = null; + } + + private async Task FullUpdate() + { + await ReloadData(); + UpdateTable(); + await InvokeAsync(StateHasChanged); + } + + private async Task ReloadData() + { + isLoading = true; + AllRecords = await DLService.ConfGlassGetAllAsync(); + // se ho ricerca testuale faccio filtro ulteriore... + if (string.IsNullOrEmpty(SearchVal)) + { + AllRecords = AllRecords + .OrderBy(x => x.Description) + .ToList(); + } + else + { + AllRecords = AllRecords + .Where(x => + x.Description.Contains(SearchVal, StringComparison.InvariantCultureIgnoreCase) || + x.Code.Contains(SearchVal, StringComparison.InvariantCultureIgnoreCase)) + .OrderBy(x => x.Description) + .ToList(); + } + totalCount = AllRecords.Count; + } + + private async Task ResetEdit() + { + // reset edit + EditRecord = null; + await ReloadData(); + } + + /// + /// Filtro e paginazione + /// + private void UpdateTable() + { + // fix paginazione + ListRecords = AllRecords + .Skip(numRecord * (currPage - 1)) + .Take(numRecord) + .ToList(); + isLoading = false; + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/Lux.UI/Components/Compo/Config/HardwareMan.razor b/Lux.UI/Components/Compo/Config/HardwareMan.razor new file mode 100644 index 00000000..4b250fb1 --- /dev/null +++ b/Lux.UI/Components/Compo/Config/HardwareMan.razor @@ -0,0 +1,74 @@ +
+
+
+
+
Conf. Hardware
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+ @if (isLoading || ListRecords == null) + { + + } + else if (totalCount == 0) + { +
Nessun record trovato
+ } + else + { + + + + + @* *@ + + + + @* *@ + + + + + @foreach (var item in ListRecords) + { + + + + + + + } + + @if (totalCount >= numRecord) + { + + + + + + } +
+ + IDFam.DescrizioneShape + +
@item.Id@item.FamilyName@item.Description@item.Shape
+ +
+ } +
+
+ + + diff --git a/Lux.UI/Components/Compo/Config/HardwareMan.razor.cs b/Lux.UI/Components/Compo/Config/HardwareMan.razor.cs new file mode 100644 index 00000000..475beebb --- /dev/null +++ b/Lux.UI/Components/Compo/Config/HardwareMan.razor.cs @@ -0,0 +1,199 @@ +using EgwCoreLib.Lux.Data.DbModel.Config; +using EgwCoreLib.Lux.Data.Services; +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; + +namespace Lux.UI.Components.Compo.Config +{ + public partial class HardwareMan + { + #region Protected Properties + + [Inject] + protected ConfigDataService CDService { get; set; } = null!; + + [Inject] + protected IJSRuntime JSRuntime { get; set; } = null!; + + protected string SearchVal + { + get => searchVal; + set + { + if (searchVal != value) + { + searchVal = value; + ReloadData(); + UpdateTable(); + } + } + } + + #endregion Protected Properties + + #region Protected Methods + + /// + /// Reset selezione + /// + protected void DoReset() + { + EditRecord = null; + SelRecord = null; + } + + /// + /// Selezione articolo x display info + /// + /// + protected void DoSelect(HardwareModel curRec) + { + SelRecord = curRec; + } + + protected override void OnParametersSet() + { + ReloadData(); + UpdateTable(); + } + + protected void ResetSearch() + { + SearchVal = ""; + } + + protected void SaveNumRec(int newNum) + { + numRecord = newNum; + UpdateTable(); + } + + protected void SavePage(int newNum) + { + currPage = newNum; + UpdateTable(); + } + + #endregion Protected Methods + + #region Private Fields + + private List AllRecords = new(); + private int currPage = 1; + private HardwareModel? EditRecord = null; + private bool isLoading = false; + private List ListRecords = new(); + private int numRecord = 5; + private HardwareModel? SelRecord = null; + private int totalCount = 0; + + #endregion Private Fields + + #region Private Properties + + private string searchVal { get; set; } = string.Empty; + + #endregion Private Properties + +#if false + /// + /// impossta record x eliminazione + /// + /// + protected async Task DoDelete(HardwareModel selRec) + { + if (!await JSRuntime.InvokeAsync("confirm", $"Sicuro di voler eliminare il record? Dettagli: {selRec.HardwareID} | {selRec.Description} | {selRec.Thickness}")) + return; + + // esegue eliminazione del record... + await CDService.ConfHardwareDeleteAsync(selRec); + + EditRecord = null; + SelRecord = null; + await ReloadData(); + UpdateTable(); + } + + /// + /// Edit articolo selezionato + /// + /// + protected void DoEdit(HardwareModel curRec) + { + EditRecord = curRec; + } +#endif +#if false + private async Task DoAdd() + { + // aggiungo un nuovo record in coda... + EditRecord = new HardwareModel() + { + Description = "New Glass", + Code = "", + Thickness = 30 + }; + await DoSave(EditRecord); + } + + private async Task DoSave(HardwareModel currRec) + { + // salvo + await CDService.ConfHardwareUpsertAsync(currRec); + await ResetEdit(); + UpdateTable(); + EditRecord = null; + SelRecord = null; + } +#endif + + #region Private Methods + + private void ReloadData() + { + isLoading = true; + AllRecords = CDService.ElencoHw(EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW, "HW.AGB"); + // se ho ricerca testuale faccio filtro ulteriore... + if (string.IsNullOrEmpty(SearchVal)) + { + AllRecords = AllRecords + .OrderBy(x => x.Description) + .ToList(); + } + else + { + AllRecords = AllRecords + .Where(x => + x.Description.Contains(SearchVal, StringComparison.InvariantCultureIgnoreCase) || + x.FamilyName.Contains(SearchVal, StringComparison.InvariantCultureIgnoreCase)) + .OrderBy(x => x.Description) + .ToList(); + } + totalCount = AllRecords.Count; + } + +#if false + private void ResetEdit() + { + // reset edit + EditRecord = null; + ReloadData(); + } +#endif + + /// + /// Filtro e paginazione + /// + private void UpdateTable() + { + // fix paginazione + ListRecords = AllRecords + .Skip(numRecord * (currPage - 1)) + .Take(numRecord) + .ToList(); + isLoading = false; + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/Lux.UI/Components/Compo/Config/ProfileMan.razor b/Lux.UI/Components/Compo/Config/ProfileMan.razor new file mode 100644 index 00000000..7830abbc --- /dev/null +++ b/Lux.UI/Components/Compo/Config/ProfileMan.razor @@ -0,0 +1,81 @@ +
+
+
+
+
Conf. Profilo
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+ @if (isLoading || ListRecords == null) + { + + } + else if (totalCount == 0) + { +
Nessun record trovato
+ } + else + { + + + + + @* *@ + + + + + + + + + @foreach (var item in ListRecords) + { + + + + + + + + } + + @if (totalCount >= numRecord) + { + + + + + + } +
+ + IDCod.DescrizioneSize mm + +
@item.ProfileID@item.Code@item.Description@($"{item.Thickness:N2}") + @if (false) + { + + } + else + { + + } +
+ +
+ } +
+
diff --git a/Lux.UI/Components/Compo/Config/ProfileMan.razor.cs b/Lux.UI/Components/Compo/Config/ProfileMan.razor.cs new file mode 100644 index 00000000..dd879512 --- /dev/null +++ b/Lux.UI/Components/Compo/Config/ProfileMan.razor.cs @@ -0,0 +1,199 @@ +using EgwCoreLib.Lux.Data.DbModel.Config; +using EgwCoreLib.Lux.Data.Services; +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; + +namespace Lux.UI.Components.Compo.Config +{ + public partial class ProfileMan + { + #region Protected Properties + + [Inject] + protected DataLayerServices DLService { get; set; } = null!; + + [Inject] + protected IJSRuntime JSRuntime { get; set; } = null!; + + protected string SearchVal + { + get => searchVal; + set + { + if (searchVal != value) + { + searchVal = value; + _ = FullUpdate(); + } + } + } + + #endregion Protected Properties + + #region Protected Methods + + /// + /// impossta record x eliminazione + /// + /// + protected async Task DoDelete(ProfileModel selRec) + { + if (!await JSRuntime.InvokeAsync("confirm", $"Sicuro di voler eliminare il record? Dettagli: {selRec.ProfileID} | {selRec.Description} | {selRec.Thickness}")) + return; + + // esegue eliminazione del record... + await DLService.ConfProfileDeleteAsync(selRec); + + EditRecord = null; + SelRecord = null; + await ReloadData(); + UpdateTable(); + } + + /// + /// Edit articolo selezionato + /// + /// + protected void DoEdit(ProfileModel curRec) + { + EditRecord = curRec; + } + + /// + /// Reset selezione + /// + protected void DoReset() + { + EditRecord = null; + } + + /// + /// Selezione articolo x display info + /// + /// + protected void DoSelect(ProfileModel curRec) + { + SelRecord = curRec; + } + + protected override async Task OnParametersSetAsync() + { + await ReloadData(); + UpdateTable(); + } + + protected void ResetSearch() + { + SearchVal = ""; + } + + protected void SaveNumRec(int newNum) + { + numRecord = newNum; + UpdateTable(); + } + + protected void SavePage(int newNum) + { + currPage = newNum; + UpdateTable(); + } + + #endregion Protected Methods + + #region Private Fields + + private List AllRecords = new(); + private int currPage = 1; + private ProfileModel? EditRecord = null; + private bool isLoading = false; + private List ListRecords = new(); + private int numRecord = 5; + private ProfileModel? SelRecord = null; + private int totalCount = 0; + + #endregion Private Fields + + #region Private Properties + + private string searchVal { get; set; } = string.Empty; + + #endregion Private Properties + + #region Private Methods + + private async Task DoAdd() + { + // aggiungo un nuovo record in coda... + EditRecord = new ProfileModel() + { + Description = "New Glass", + Code = "", + Thickness = 30 + }; + await DoSave(EditRecord); + } + + private async Task DoSave(ProfileModel currRec) + { + // salvo + await DLService.ConfProfileUpsertAsync(currRec); + await ResetEdit(); + UpdateTable(); + EditRecord = null; + SelRecord = null; + } + + private async Task FullUpdate() + { + await ReloadData(); + UpdateTable(); + await InvokeAsync(StateHasChanged); + } + + private async Task ReloadData() + { + isLoading = true; + AllRecords = await DLService.ConfProfileGetAllAsync(); + // se ho ricerca testuale faccio filtro ulteriore... + if (string.IsNullOrEmpty(SearchVal)) + { + AllRecords = AllRecords + .OrderBy(x => x.Description) + .ToList(); + } + else + { + AllRecords = AllRecords + .Where(x => + x.Description.Contains(SearchVal, StringComparison.InvariantCultureIgnoreCase) || + x.Code.Contains(SearchVal, StringComparison.InvariantCultureIgnoreCase)) + .OrderBy(x => x.Description) + .ToList(); + } + totalCount = AllRecords.Count; + } + + private async Task ResetEdit() + { + // reset edit + EditRecord = null; + await ReloadData(); + } + + /// + /// Filtro e paginazione + /// + private void UpdateTable() + { + // fix paginazione + ListRecords = AllRecords + .Skip(numRecord * (currPage - 1)) + .Take(numRecord) + .ToList(); + isLoading = false; + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/Lux.UI/Components/Compo/Config/WoodMan.razor b/Lux.UI/Components/Compo/Config/WoodMan.razor new file mode 100644 index 00000000..546274c0 --- /dev/null +++ b/Lux.UI/Components/Compo/Config/WoodMan.razor @@ -0,0 +1,81 @@ +
+
+
+
+
Conf. Legno
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+ @if (isLoading || ListRecords == null) + { + + } + else if (totalCount == 0) + { +
Nessun record trovato
+ } + else + { + + + + + @* *@ + + + + + + + + + @foreach (var item in ListRecords) + { + + + + + + + + } + + @if (totalCount >= numRecord) + { + + + + + + } +
+ + IDCod.DescrizioneTipo + +
@item.WoodID@item.Code@item.Description@item.Type + @if (false) + { + + } + else + { + + } +
+ +
+ } +
+
diff --git a/Lux.UI/Components/Compo/Config/WoodMan.razor.cs b/Lux.UI/Components/Compo/Config/WoodMan.razor.cs new file mode 100644 index 00000000..b6ccb252 --- /dev/null +++ b/Lux.UI/Components/Compo/Config/WoodMan.razor.cs @@ -0,0 +1,199 @@ +using EgwCoreLib.Lux.Data.DbModel.Config; +using EgwCoreLib.Lux.Data.Services; +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; + +namespace Lux.UI.Components.Compo.Config +{ + public partial class WoodMan + { + #region Protected Properties + + [Inject] + protected DataLayerServices DLService { get; set; } = null!; + + [Inject] + protected IJSRuntime JSRuntime { get; set; } = null!; + + protected string SearchVal + { + get => searchVal; + set + { + if (searchVal != value) + { + searchVal = value; + _ = FullUpdate(); + } + } + } + + #endregion Protected Properties + + #region Protected Methods + + /// + /// impossta record x eliminazione + /// + /// + protected async Task DoDelete(WoodModel selRec) + { + if (!await JSRuntime.InvokeAsync("confirm", $"Sicuro di voler eliminare il record? Dettagli: {selRec.WoodID} | {selRec.Description} | Tipo: {selRec.Type}")) + return; + + // esegue eliminazione del record... + await DLService.ConfWoodDeleteAsync(selRec); + + EditRecord = null; + SelRecord = null; + await ReloadData(); + UpdateTable(); + } + + /// + /// Edit articolo selezionato + /// + /// + protected void DoEdit(WoodModel curRec) + { + EditRecord = curRec; + } + + /// + /// Reset selezione + /// + protected void DoReset() + { + EditRecord = null; + } + + /// + /// Selezione articolo x display info + /// + /// + protected void DoSelect(WoodModel curRec) + { + SelRecord = curRec; + } + + protected override async Task OnParametersSetAsync() + { + await ReloadData(); + UpdateTable(); + } + + protected void ResetSearch() + { + SearchVal = ""; + } + + protected void SaveNumRec(int newNum) + { + numRecord = newNum; + UpdateTable(); + } + + protected void SavePage(int newNum) + { + currPage = newNum; + UpdateTable(); + } + + #endregion Protected Methods + + #region Private Fields + + private List AllRecords = new(); + private int currPage = 1; + private WoodModel? EditRecord = null; + private bool isLoading = false; + private List ListRecords = new(); + private int numRecord = 5; + private WoodModel? SelRecord = null; + private int totalCount = 0; + + #endregion Private Fields + + #region Private Properties + + private string searchVal { get; set; } = string.Empty; + + #endregion Private Properties + + #region Private Methods + + private async Task DoAdd() + { + // aggiungo un nuovo record in coda... + EditRecord = new WoodModel() + { + Description = "New Wood", + Code = "", + Type = 1 + }; + await DoSave(EditRecord); + } + + private async Task DoSave(WoodModel currRec) + { + // salvo + await DLService.ConfWoodUpsertAsync(currRec); + await ResetEdit(); + UpdateTable(); + EditRecord = null; + SelRecord = null; + } + + private async Task FullUpdate() + { + await ReloadData(); + UpdateTable(); + await InvokeAsync(StateHasChanged); + } + + private async Task ReloadData() + { + isLoading = true; + AllRecords = await DLService.ConfWoodGetAllAsync(); + // se ho ricerca testuale faccio filtro ulteriore... + if (string.IsNullOrEmpty(SearchVal)) + { + AllRecords = AllRecords + .OrderBy(x => x.Description) + .ToList(); + } + else + { + AllRecords = AllRecords + .Where(x => + x.Description.Contains(SearchVal, StringComparison.InvariantCultureIgnoreCase) || + x.Code.Contains(SearchVal, StringComparison.InvariantCultureIgnoreCase)) + .OrderBy(x => x.Description) + .ToList(); + } + totalCount = AllRecords.Count; + } + + private async Task ResetEdit() + { + // reset edit + EditRecord = null; + await ReloadData(); + } + + /// + /// Filtro e paginazione + /// + private void UpdateTable() + { + // fix paginazione + ListRecords = AllRecords + .Skip(numRecord * (currPage - 1)) + .Take(numRecord) + .ToList(); + isLoading = false; + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/Lux.UI/Components/Compo/EditBom.razor b/Lux.UI/Components/Compo/EditBom.razor index b68183c1..7ee0f337 100644 --- a/Lux.UI/Components/Compo/EditBom.razor +++ b/Lux.UI/Components/Compo/EditBom.razor @@ -15,7 +15,7 @@ @foreach (var item in bomDict) { - @if (item.Key == currIdx && EditRecord != null) + @if (EditRecord != null && item.Key == currIdx) { @(item.Key + 1) diff --git a/Lux.UI/Components/Compo/EditBom.razor.cs b/Lux.UI/Components/Compo/EditBom.razor.cs index 136bb7b4..d85213bc 100644 --- a/Lux.UI/Components/Compo/EditBom.razor.cs +++ b/Lux.UI/Components/Compo/EditBom.razor.cs @@ -1,5 +1,5 @@ using EgwCoreLib.Lux.Core.RestPayload; -using EgwCoreLib.Lux.Data.DbModel; +using EgwCoreLib.Lux.Data.DbModel.Items; using EgwCoreLib.Lux.Data.Services; using EgwMultiEngineManager.Data; using Microsoft.AspNetCore.Components; diff --git a/Lux.UI/Components/Compo/GenClassMan.razor b/Lux.UI/Components/Compo/GenClassMan.razor new file mode 100644 index 00000000..c35d993e --- /dev/null +++ b/Lux.UI/Components/Compo/GenClassMan.razor @@ -0,0 +1,112 @@ +@if (AddVisible) +{ + +} + + + + + + + + + + + + @foreach (var item in ListRecords) + { + + @if (EditRecord != null && item.ClassCod == EditRecord.ClassCod) + { + + + + + + } + else + { + + + + + + } + + } + + @if (totalCount >= numRecord) + { + + + + + + } +
+ + CodDescrizione# Val + +
+ + + @item.ClassCod@item.NumChild + + + + + @* *@ + @item.ClassCod@item.Description@item.NumChild + @if (item.NumChild > 0) + { + + } + else + { + + } +
+ +
\ No newline at end of file diff --git a/Lux.UI/Components/Compo/GenClassMan.razor.cs b/Lux.UI/Components/Compo/GenClassMan.razor.cs new file mode 100644 index 00000000..5d21d892 --- /dev/null +++ b/Lux.UI/Components/Compo/GenClassMan.razor.cs @@ -0,0 +1,244 @@ +using EgwCoreLib.Lux.Data.DbModel.Utils; +using EgwCoreLib.Lux.Data.Services; +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.DataProtection; +using Microsoft.JSInterop; +using NLog.LayoutRenderers; +using System.Threading.Tasks; + +namespace Lux.UI.Components.Compo +{ + public partial class GenClassMan + { + #region Public Properties + + [Parameter] + public EventCallback EC_Selected { get; set; } + + [Parameter] + public EventCallback EC_Updated { get; set; } + + [Parameter] + public List ListGenClass { get; set; } = null!; + + [Parameter] + public string SearchVal { get; set; } = ""; + + #endregion Public Properties + + #region Protected Fields + + protected List AllRecords = new List(); + protected List ListRecords = new List(); + + #endregion Protected Fields + + #region Protected Properties + + [Inject] + protected DataLayerServices DLService { get; set; } = null!; + + [Inject] + protected IJSRuntime JSRuntime { get; set; } = null!; + + #endregion Protected Properties + + #region Protected Methods + + /// + /// Genera nuovo record e lo salva + /// + /// + protected async Task DoAdd() + { + if (NewRecord != null) + { + // verifico non sia duplicato... + var recExist = ListRecords.Count(x => x.ClassCod == NewRecord.ClassCod); + if (recExist > 0) + { + ErrorMsg = $"Errore: record già esistente con codice {NewRecord.ClassCod}"; + } + else + { + ErrorMsg = ""; + // faccio upsert record... + await DLService.GenClassUpsertAsync(NewRecord); + // segnalo update x reload + await EC_Updated.InvokeAsync(true); + NewRecord = null; + } + } + } + + protected void DoCancel() + { + ResetEdit(); + UpdateTable(); + } + + /// + /// Clona record + /// + /// + protected void DoClone(GenClassModel curRec) + { + } + + /// + /// Eliminazione record + /// + /// + protected async Task DoDelete(GenClassModel selRec) + { + // controlo che NON abbia child obj... altrimenti esco + if (selRec.NumChild > 0) + return; + + if (!await JSRuntime.InvokeAsync("confirm", $"Sicuro di voler eliminare il record? Dettagli: {selRec.ClassCod} | {selRec.Description}")) + return; + + // esegue eliminazione del record... + await DLService.GenClassDeleteAsync(selRec); + + // segnalo update x reload + await EC_Updated.InvokeAsync(true); + } + + /// + /// Edit articolo selezionato + /// + /// + protected async void DoEdit(GenClassModel curRec) + { + EditRecord = curRec; + SelRecord = curRec; + await EC_Selected.InvokeAsync(curRec.ClassCod); + } + + /// + /// Reset selezione + /// + protected async void DoReset() + { + EditRecord = null; + SelRecord = null; + await EC_Selected.InvokeAsync(""); + } + + protected async Task DoSave(GenClassModel currRec) + { + // faccio upsert record... + await DLService.GenClassUpsertAsync(currRec); + // segnalo update x reload + await EC_Updated.InvokeAsync(true); + } + + /// + /// Selezione articolo x display info + /// + /// + protected async void DoSelect(GenClassModel curRec) + { + SelRecord = curRec; + await EC_Selected.InvokeAsync(curRec.ClassCod); + } + + protected override void OnParametersSet() + { + ReloadData(); + UpdateTable(); + } + + protected void SaveNumRec(int newNum) + { + numRecord = newNum; + UpdateTable(); + } + + protected void SavePage(int newNum) + { + currPage = newNum; + UpdateTable(); + } + + protected void ToggleAdd() + { + AddVisible = !AddVisible; + NewRecord = new GenClassModel() + { + ClassCod = "NewClass", + Description = $"Descrizione-{DateTime.Now:yyyy.MM.dd-HH.mm.ss}" + }; + } + + #endregion Protected Methods + + #region Private Fields + + private bool AddVisible = false; + private int currPage = 1; + private GenClassModel? EditRecord = null; + private string ErrorMsg = ""; + private bool isLoading = false; + private GenClassModel? NewRecord = null; + private int numRecord = 10; + + private GenClassModel? SelRecord = null; + + private int totalCount = 0; + + #endregion Private Fields + + #region Private Methods + + private string checkSel(GenClassModel curRec) + { + string answ = ""; + if (SelRecord != null) + { + answ = curRec.ClassCod == SelRecord.ClassCod ? "table-info" : ""; + } + return answ; + } + + private void ReloadData() + { + isLoading = true; + AllRecords = ListGenClass; + // se ho ricerca testuale faccio filtro ulteriore... + if (!string.IsNullOrEmpty(SearchVal)) + { + AllRecords = AllRecords + .Where(x => + x.ClassCod.Contains(SearchVal, StringComparison.InvariantCultureIgnoreCase) || + x.Description.Contains(SearchVal, StringComparison.InvariantCultureIgnoreCase)) + .ToList(); + } + totalCount = AllRecords.Count; + } + + private void ResetEdit() + { + // reset edit + EditRecord = null; + ReloadData(); + } + + /// + /// Filtro e paginazione + /// + private void UpdateTable() + { + // fix paginazione + ListRecords = AllRecords + .OrderBy(x => x.ClassCod) + .Skip(numRecord * (currPage - 1)) + .Take(numRecord) + .ToList(); + isLoading = false; + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/Lux.UI/Components/Compo/GenValMan.razor b/Lux.UI/Components/Compo/GenValMan.razor new file mode 100644 index 00000000..a637a5ea --- /dev/null +++ b/Lux.UI/Components/Compo/GenValMan.razor @@ -0,0 +1,81 @@ +@if (isLoading || ListRecords == null) +{ + +} +else if (totalCount == 0) +{ +
Nessun record trovato
+} +else +{ + + + + + @* *@ + + + + + + + @foreach (var item in ListRecords) + { + string cssBtnUp = EditRecord == null && item.Ordinal > 1 ? "btn-outline-primary" : "btn-outline-secondary opacity-50 disabled"; + string cssBtnDown = EditRecord == null && item.Ordinal < totalCount ? "btn-outline-primary" : "btn-outline-secondary opacity-50 disabled"; + + @if (EditRecord != null && item.GenValID == EditRecord.GenValID) + { + + @* *@ + + + + } + else + { + + @* *@ + + + + } + + } + + @if (totalCount >= numRecord) + { + + + + + + } +
+ + IDOrd.Valore + +
+ + + @* *@ + @item.GenValID + + @item.Ordinal + + + + + + + @* *@ + @item.GenValID + + @item.Ordinal + + @item.ValString + +
+ +
+} diff --git a/Lux.UI/Components/Compo/GenValMan.razor.cs b/Lux.UI/Components/Compo/GenValMan.razor.cs new file mode 100644 index 00000000..30b11520 --- /dev/null +++ b/Lux.UI/Components/Compo/GenValMan.razor.cs @@ -0,0 +1,285 @@ +using EgwCoreLib.Lux.Core; +using EgwCoreLib.Lux.Data.DbModel.Utils; +using EgwCoreLib.Lux.Data.Services; +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; + +namespace Lux.UI.Components.Compo +{ + public partial class GenValMan + { + #region Public Properties + + [Parameter] + public List ListGenClass { get; set; } = null!; + + [Parameter] + public FiltSelect SelFilt { get; set; } = null!; + + #endregion Public Properties + + #region Public Classes + + /// + /// Filtro selezione items + /// + public class FiltSelect + { + #region Public Properties + + public string SearchVal { get; set; } = ""; + public string SelCodGroup { get; set; } = ""; + + #endregion Public Properties + + #region Public Methods + + public override bool Equals(object? obj) + { + if (obj == null) + return false; + if (!(obj is FiltSelect item)) + return false; + + if (SelCodGroup != item.SelCodGroup) + return false; + + if (SearchVal != item.SearchVal) + return false; + + return true; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + #endregion Public Methods + } + + #endregion Public Classes + + #region Protected Fields + + protected List AllRecords = new List(); + protected List ListRecords = new List(); + + #endregion Protected Fields + + #region Protected Properties + + [Inject] + protected DataLayerServices DLService { get; set; } = null!; + + [Inject] + protected IJSRuntime JSRuntime { get; set; } = null!; + + #endregion Protected Properties + + #region Protected Methods + + /// + /// Clona record + /// + /// + protected void DoClone(GenValueModel curRec) + { +#if false + editRecord = new ItemModel() + { + ItemIDParent = curRec.ItemType == Enums.ItemClassType.Bom ? curRec.ItemID : curRec.ItemIDParent, + CodGroup = curRec.CodGroup, + ItemType = curRec.ItemType == Enums.ItemClassType.Bom ? Enums.ItemClassType.BomAlt : curRec.ItemType, + IsService = curRec.IsService, + ItemCode = curRec.ItemCode, + ExtItemCode = $"{curRec.ExtItemCode} - COPY", + SupplCode = curRec.ItemType == Enums.ItemClassType.Bom ? $"{curRec.SupplCode} ALT" : curRec.SupplCode, + Description = $"{curRec.Description} - COPY", + Cost = curRec.Cost, + Margin = curRec.Margin, + QtyMin = curRec.QtyMin, + QtyMax = curRec.QtyMax, + UM = curRec.UM + }; +#endif + } + + /// + /// impossta record x eliminazione + /// + /// + protected async Task DoDelete(GenValueModel selRec) + { + if (!await JSRuntime.InvokeAsync("confirm", $"Sicuro di voler eliminare il record? Dettagli: {selRec.ClassCod} | {selRec.ValString}")) + return; + + // esegue eliminazione del record... + await DLService.GenValDeleteAsync(selRec); + + EditRecord = null; + SelRecord = null; + await ReloadData(); + UpdateTable(); +#if false + // segnalo update x reload + await EC_Updated.InvokeAsync(true); +#endif + } + + /// + /// Edit articolo selezionato + /// + /// + protected void DoEdit(GenValueModel curRec) + { + EditRecord = curRec; + } + + /// + /// Reset selezione + /// + protected void DoReset() + { + EditRecord = null; + } + + /// + /// Selezione articolo x display info + /// + /// + protected void DoSelect(GenValueModel curRec) + { + SelRecord = curRec; + } + + protected override async Task OnParametersSetAsync() + { + if (!SelFilt.Equals(actFilt) || true) + { + actFilt = SelFilt; + await ReloadData(); + UpdateTable(); + } + } + + protected void SaveNumRec(int newNum) + { + numRecord = newNum; + UpdateTable(); + } + + protected void SavePage(int newNum) + { + currPage = newNum; + UpdateTable(); + } + + #endregion Protected Methods + + #region Private Fields + + private FiltSelect actFilt = new FiltSelect(); + + private int currPage = 1; + + private GenValueModel? EditRecord = null; + + private bool isLoading = false; + + private int numRecord = 10; + + private GenValueModel? SelRecord = null; + + private int totalCount = 0; + + #endregion Private Fields + + #region Private Methods + + private async Task DoAdd() + { + // aggiungo un nuovo record in coda... + EditRecord = new GenValueModel() + { + ClassCod = actFilt.SelCodGroup, + ValString = $"Nuovo-{DateTime.Now:yy.MM.ss HH.mm.ss}", + Ordinal = totalCount + 1 + }; + await DoSave(EditRecord); + } + + /// + /// Esegue spostamento + /// + /// + /// + /// + private async Task MoveRec(GenValueModel curRec, bool moveUp) + { + await DLService.GenValMoveAsync(curRec, moveUp); + await DoCancel(); + } + + private async Task DoCancel() + { + await ResetEdit(); + UpdateTable(); + } + + private async Task DoSave(GenValueModel currRec) + { + // salvo + await DLService.GenValUpsertAsync(currRec); + await ResetEdit(); + UpdateTable(); + EditRecord = null; + SelRecord = null; + } + + private async Task ReloadData() + { + isLoading = true; + AllRecords = await DLService.GenValGetFiltAsync(actFilt.SelCodGroup); + // se ho ricerca testuale faccio filtro ulteriore... + if (string.IsNullOrEmpty(actFilt.SearchVal)) + { + AllRecords = AllRecords + .OrderBy(x => x.Ordinal) + .ToList(); + } + else + { + AllRecords = AllRecords + .Where(x => + x.ClassCod.Contains(actFilt.SearchVal, StringComparison.InvariantCultureIgnoreCase) || + x.ValString.Contains(actFilt.SearchVal, StringComparison.InvariantCultureIgnoreCase)) + .OrderBy(x => x.Ordinal) + .ToList(); + } + totalCount = AllRecords.Count; + } + + private async Task ResetEdit() + { + // reset edit + EditRecord = null; + await ReloadData(); + } + + /// + /// Filtro e paginazione + /// + private void UpdateTable() + { + // fix paginazione + ListRecords = AllRecords + .Skip(numRecord * (currPage - 1)) + .Take(numRecord) + .ToList(); + isLoading = false; + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/Lux.UI/Components/Compo/ItemEdit.razor.cs b/Lux.UI/Components/Compo/ItemEdit.razor.cs index adcfafa8..9d884891 100644 --- a/Lux.UI/Components/Compo/ItemEdit.razor.cs +++ b/Lux.UI/Components/Compo/ItemEdit.razor.cs @@ -1,4 +1,4 @@ -using EgwCoreLib.Lux.Data.DbModel; +using EgwCoreLib.Lux.Data.DbModel.Items; using Microsoft.AspNetCore.Components; namespace Lux.UI.Components.Compo diff --git a/Lux.UI/Components/Compo/ItemMan.razor b/Lux.UI/Components/Compo/ItemMan.razor index b3575735..b26d13d2 100644 --- a/Lux.UI/Components/Compo/ItemMan.razor +++ b/Lux.UI/Components/Compo/ItemMan.razor @@ -99,5 +99,3 @@ else } - - diff --git a/Lux.UI/Components/Compo/ItemMan.razor.cs b/Lux.UI/Components/Compo/ItemMan.razor.cs index b8ccb1b7..07b8dbe5 100644 --- a/Lux.UI/Components/Compo/ItemMan.razor.cs +++ b/Lux.UI/Components/Compo/ItemMan.razor.cs @@ -1,5 +1,5 @@ using EgwCoreLib.Lux.Core; -using EgwCoreLib.Lux.Data.DbModel; +using EgwCoreLib.Lux.Data.DbModel.Items; using EgwCoreLib.Lux.Data.Services; using Microsoft.AspNetCore.Components; using Microsoft.JSInterop; @@ -68,9 +68,6 @@ namespace Lux.UI.Components.Compo #region Protected Fields protected List AllRecords = new List(); -#if false - protected List ListItemGroup = new List(); -#endif protected List ListRecords = new List(); #endregion Protected Fields @@ -120,7 +117,7 @@ namespace Lux.UI.Components.Compo if (!await JSRuntime.InvokeAsync("confirm", $"Sicuro di voler eliminare il record? Dettagli: {selRec.ItemID} | {selRec.CodGroup} | {selRec.ItemType} | {selRec.ExtItemCode}")) return; //// esegue eliminazione del record... - //await DLService.ItemDeleteAsync(selRec); + //await CDService.ItemDeleteAsync(selRec); editRecord = null; selRecord = null; diff --git a/Lux.UI/Components/Compo/OfferCheck.razor b/Lux.UI/Components/Compo/OfferCheck.razor index 397890d0..1f596a37 100644 --- a/Lux.UI/Components/Compo/OfferCheck.razor +++ b/Lux.UI/Components/Compo/OfferCheck.razor @@ -1,4 +1,5 @@ @using EgwCoreLib.Lux.Data.DbModel +@using EgwCoreLib.Lux.Data.DbModel.Sales
display check finali diff --git a/Lux.UI/Components/Compo/OfferCommonPar.razor b/Lux.UI/Components/Compo/OfferCommonPar.razor new file mode 100644 index 00000000..137c7134 --- /dev/null +++ b/Lux.UI/Components/Compo/OfferCommonPar.razor @@ -0,0 +1,65 @@ +
+ @if (isLoading) + { + + } + else + { + +
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+ +
+ +
+
+ +
+ } +
diff --git a/Lux.UI/Components/Compo/OfferCommonPar.razor.cs b/Lux.UI/Components/Compo/OfferCommonPar.razor.cs new file mode 100644 index 00000000..fdd8684a --- /dev/null +++ b/Lux.UI/Components/Compo/OfferCommonPar.razor.cs @@ -0,0 +1,129 @@ +using EgwCoreLib.Lux.Core; +using EgwCoreLib.Lux.Data.DbModel.Sales; +using EgwCoreLib.Lux.Data.Services; +using Microsoft.AspNetCore.Components; + +namespace Lux.UI.Components.Compo +{ + public partial class OfferCommonPar + { + #region Public Properties + + [Parameter] + public OfferModel CurrRecord { get; set; } = null!; + + [Parameter] + public EventCallback EC_Close { get; set; } + + [Parameter] + public EventCallback EC_Updated { get; set; } + + #endregion Public Properties + + #region Protected Properties + + [Inject] + protected DataLayerServices DLService { get; set; } = null!; + + /// + /// Gestione selezione Colore + /// + protected string SelColor + { + get => CurrSel.GetVal("Color"); + set => CurrSel.SetVal("Color", value); + } + + /// + /// Gestione selezione Glass + /// + protected string SelGlass + { + get => CurrSel.GetVal("Glass"); + set => CurrSel.SetVal("Glass", value); + } + + /// + /// Gestione selezione Profile + /// + protected string SelProfile + { + get => CurrSel.GetVal("Profile"); + set => CurrSel.SetVal("Profile", value); + } + + /// + /// Gestione selezione Wood + /// + protected string SelWood + { + get => CurrSel.GetVal("Wood"); + set => CurrSel.SetVal("Wood", value); + } + + #endregion Protected Properties + + #region Protected Methods + + protected override async Task OnParametersSetAsync() + { + isLoading = true; + // deserializzo se possibile dal record... + CurrSel = new ParamDict(CurrRecord.DictPresel); + // leggo dati di base + var AllColors = await DLService.GenValGetFiltAsync("WoodCol"); + var AllConfGlass = await DLService.ConfGlassGetAllAsync(); + var AllConfProfile = await DLService.ConfProfileGetAllAsync(); + var AllConfWood = await DLService.ConfWoodGetAllAsync(); + // conversione tipi + ListColors = AllColors + .Select(x => x.ValString) + .ToList(); + ListGlass = AllConfGlass + .Select(x => x.Description) + .ToList(); + ListProfiles = AllConfProfile + .Select(x => x.Description) + .ToList(); + ListWood = AllConfWood + .Select(x => x.Description) + .ToList(); + isLoading = false; + } + + #endregion Protected Methods + + #region Private Fields + + private ParamDict CurrSel = new ParamDict(""); + + private bool isLoading = false; + + private List ListColors = new List(); + + private List ListGlass = new List(); + + private List ListProfiles = new List(); + + private List ListWood = new List(); + + #endregion Private Fields + + #region Private Methods + + private async Task DoCancel() + { + await EC_Close.InvokeAsync(true); + } + + private async Task DoSave() + { + // aggiorno valore serializzato... + CurrRecord.DictPresel = CurrSel.Serialized; + // richiesta update con salvataggio record + await EC_Updated.InvokeAsync(CurrRecord); + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/Lux.UI/Components/Compo/OfferMan.razor b/Lux.UI/Components/Compo/OfferMan.razor index 8c033a5d..aab87a73 100644 --- a/Lux.UI/Components/Compo/OfferMan.razor +++ b/Lux.UI/Components/Compo/OfferMan.razor @@ -1,146 +1,61 @@ @using EgwCoreLib.Lux.Core -@*
-
-
-
-
Edit Offerta @CurrRecord.OfferCode
- -
-
*@ -
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
- -
-
- -
-
- @*
-
-
-
*@ -@*