Update migrazione DB

This commit is contained in:
Samuele Locatelli
2025-08-08 16:11:39 +02:00
parent 2aa9f44cd2
commit aa8d768b56
8 changed files with 343 additions and 198 deletions
+28
View File
@@ -28,5 +28,33 @@
Preview,
Edit
}
/// <summary>
/// Tipologia item
/// </summary>
public enum ItemClassType
{
ND=0,
/// <summary>
/// Item acquistato
/// </summary>
Buy,
/// <summary>
/// Item Prodotto
/// </summary>
Make,
/// <summary>
/// Semilavorato
/// </summary>
Wip,
/// <summary>
/// Art da BOM
/// </summary>
Bom,
/// <summary>
/// Art alternativo da BOM
/// </summary>
BomAlt
}
}
}
+122 -24
View File
@@ -7,6 +7,7 @@ using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using static System.Runtime.InteropServices.JavaScript.JSType;
@@ -91,6 +92,27 @@ namespace EgwCoreLib.Lux.Data.Controllers
return dbResult;
}
public List<ItemModel> ItemGetSearch(string term)
{
List<ItemModel> dbResult = new List<ItemModel>();
//using (DataLayerContext dbCtx = new DataLayerContext(configuration))
using (DataLayerContext dbCtx = new DataLayerContext())
{
try
{
dbResult = dbCtx
.DbSetItem
.Where(x => x.Description.Contains(term))
.ToList();
}
catch (Exception exc)
{
Log.Error($"Eccezione durante ItemGetSearch{Environment.NewLine}{exc}");
}
}
return dbResult;
}
/// <summary>
/// Elenco completo ItemGroup gestiti
/// </summary>
@@ -115,27 +137,6 @@ namespace EgwCoreLib.Lux.Data.Controllers
return dbResult;
}
public List<ItemModel> ItemGetSearch(string term)
{
List<ItemModel> dbResult = new List<ItemModel>();
//using (DataLayerContext dbCtx = new DataLayerContext(configuration))
using (DataLayerContext dbCtx = new DataLayerContext())
{
try
{
dbResult = dbCtx
.DbSetItem
.Where(x => x.Description.Contains(term))
.ToList();
}
catch (Exception exc)
{
Log.Error($"Eccezione durante ItemGetSearch{Environment.NewLine}{exc}");
}
}
return dbResult;
}
public bool ItemUpsert(ItemModel newRec)
{
bool answ = false;
@@ -203,6 +204,7 @@ namespace EgwCoreLib.Lux.Data.Controllers
ItemModel newRec = new ItemModel()
{
CodGroup = item.ClassCode,
ItemType = Core.Enum.ItemClassType.Bom,
IsService = false,
// da calcolare meglio x gruppo
ItemCode = 0,
@@ -211,7 +213,6 @@ namespace EgwCoreLib.Lux.Data.Controllers
Description = $"BOM | {item.ClassCode} | {item.ItemCode}",
Cost = 0,
Margin = 0,
BomGen = true,
QtyMin = 0,
QtyMax = 0,
UM = "#"
@@ -285,6 +286,104 @@ namespace EgwCoreLib.Lux.Data.Controllers
return dbResult;
}
/// <summary>
/// Effettua update dei costi di tutte le righe dell'offerta indicata
/// </summary>
/// <param name="OfferID"></param>
/// <returns></returns>
public async Task<bool> OffertUpdateCost(int OfferID)
{
bool answ = false;
//using (DataLayerContext dbCtx = new DataLayerContext(configuration))
using (DataLayerContext dbCtx = new DataLayerContext())
{
try
{
// recupero righe offerta...
var offRowList = dbCtx
.DbSetOfferRow
.Where(x => x.OfferID == OfferID)
.ToList();
// recupero l'elenco degli itemGroup gestiti
var itemGroupList = dbCtx
.DbSetItemGroup
.ToList();
// recupero il subset item da BOM / BomAlt...
var bomGenList = dbCtx
.DbSetItem
.Where(x => (x.ItemType == Core.Enum.ItemClassType.Bom || x.ItemType == Core.Enum.ItemClassType.BomAlt))
.ToList();
// ciclo!
foreach (var currRec in offRowList)
{
// se contiene qualcosa x BOM...
if (!string.IsNullOrEmpty(currRec.ItemBOM) && currRec.ItemBOM.Length > 2)
{
// deserializzo
var bomList = JsonConvert.DeserializeObject<List<BomItemDTO>>(currRec.ItemBOM);
// se ho trovato elementi...
if (bomList != null)
{
// calcolo il NUOVO costo e lo aggiorno...
double totCost = 0;
int numGroupOk = 0;
int numItemOk = 0;
int numElems = bomList.Count;
// 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++;
}
// 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.Price = recCost.Cost * (1 + recCost.Margin) * item.Qty;
totCost += item.Price;
}
else
{
item.ItemID = 0;
item.Price = 0;
}
}
// salvo BOM...
string itemBom = JsonConvert.SerializeObject(bomList);
currRec.ItemBOM = itemBom;
currRec.Cost = totCost;
currRec.BomOk = numElems == numGroupOk;
currRec.ItemOk = numElems == numItemOk;
dbCtx.Entry(currRec).State = EntityState.Modified;
}
}
}
// salvo TUTTI i cambiamenti...
await dbCtx.SaveChangesAsync();
}
catch (Exception exc)
{
Log.Error($"Eccezione durante OffertUpdateCost{Environment.NewLine}{exc}");
}
}
return answ;
}
/// <summary>
/// Esegue upsert del record offerta data la BOM ricevuta
/// </summary>
@@ -312,10 +411,9 @@ namespace EgwCoreLib.Lux.Data.Controllers
// recupero il subset item da BOM...
var bomGenList = dbCtx
.DbSetItem
.Where(x => x.BomGen)
.Where(x => x.ItemType == Core.Enum.ItemClassType.Bom)
.ToList();
// calcolo il NUOVO costo e lo aggiorno...
double totCost = 0;
int numGroupOk = 0;
+6 -4
View File
@@ -1,5 +1,6 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using static EgwCoreLib.Lux.Core.Enum;
namespace EgwCoreLib.Lux.Data.DbModel
{
@@ -21,6 +22,11 @@ namespace EgwCoreLib.Lux.Data.DbModel
/// </summary>
public string CodGroup { get; set; } = "";
/// <summary>
/// Tipologia articolo
/// </summary>
public ItemClassType ItemType { get; set; } = ItemClassType.ND;
/// <summary>
/// Definisce l'articolo come servizio vs concreto=materiale
/// </summary>
@@ -67,10 +73,6 @@ namespace EgwCoreLib.Lux.Data.DbModel
/// </summary>
public double QtyMax { get; set; } = 0;
/// <summary>
/// Indica che è un item di tipo BOM (generico)
/// </summary>
public bool BomGen { get; set; } = false;
/// <summary>
/// Unità di Misura
@@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace EgwCoreLib.Lux.Data.Migrations
{
[DbContext(typeof(DataLayerContext))]
[Migration("20250808082124_InitDb")]
[Migration("20250808131854_InitDb")]
partial class InitDb
{
/// <inheritdoc />
@@ -195,9 +195,6 @@ namespace EgwCoreLib.Lux.Data.Migrations
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ItemID"));
b.Property<bool>("BomGen")
.HasColumnType("tinyint(1)");
b.Property<string>("CodGroup")
.IsRequired()
.HasColumnType("varchar(255)");
@@ -219,6 +216,9 @@ namespace EgwCoreLib.Lux.Data.Migrations
b.Property<int>("ItemCode")
.HasColumnType("int");
b.Property<int>("ItemType")
.HasColumnType("int");
b.Property<double>("Margin")
.HasColumnType("double");
@@ -246,13 +246,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ItemID = 1,
BomGen = false,
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,
@@ -262,13 +262,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ItemID = 2,
BomGen = false,
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,
@@ -278,13 +278,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ItemID = 3,
BomGen = false,
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,
@@ -294,13 +294,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ItemID = 4,
BomGen = false,
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,
@@ -310,13 +310,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ItemID = 5,
BomGen = false,
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,
@@ -326,13 +326,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ItemID = 6,
BomGen = false,
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,
@@ -342,13 +342,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ItemID = 7,
BomGen = false,
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,
@@ -358,13 +358,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ItemID = 8,
BomGen = false,
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,
@@ -374,13 +374,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ItemID = 9,
BomGen = false,
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,
@@ -390,13 +390,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ItemID = 10,
BomGen = false,
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,
@@ -406,13 +406,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ItemID = 11,
BomGen = false,
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,
@@ -422,13 +422,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ItemID = 12,
BomGen = false,
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,
@@ -718,13 +718,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
CustomerID = 2,
DealerID = 2,
Description = "Offerta per tre serramenti",
Inserted = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2063),
Modified = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2064),
Inserted = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9764),
Modified = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9766),
OffertState = 0,
RefNum = 1,
RefRev = 1,
RefYear = 2024,
ValidUntil = new DateTime(2025, 9, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2060)
ValidUntil = new DateTime(2025, 9, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9761)
});
});
@@ -802,11 +802,11 @@ namespace EgwCoreLib.Lux.Data.Migrations
BomOk = false,
Cost = 950.0,
Environment = "WINDOW",
Inserted = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2090),
Inserted = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9790),
ItemBOM = "",
ItemOk = false,
ItemSPP = "{}",
Modified = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2092),
Modified = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9791),
Note = "Finestra anta singola 2025",
OfferID = 1,
OfferRowUID = "OFF0000000001",
@@ -821,11 +821,11 @@ namespace EgwCoreLib.Lux.Data.Migrations
BomOk = false,
Cost = 160.0,
Environment = "WINDOW",
Inserted = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2098),
Inserted = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9798),
ItemBOM = "",
ItemOk = false,
ItemSPP = "{}",
Modified = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2100),
Modified = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9799),
Note = "Persiana per Finestra anta singola 2025",
OfferID = 1,
OfferRowUID = "OFF0000000002",
@@ -840,11 +840,11 @@ namespace EgwCoreLib.Lux.Data.Migrations
BomOk = false,
Cost = 200.0,
Environment = "WINDOW",
Inserted = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2105),
Inserted = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9805),
ItemBOM = "",
ItemOk = false,
ItemSPP = "{}",
Modified = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2107),
Modified = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9806),
Note = "Installazione serramento",
OfferID = 1,
OfferRowUID = "OFF0000000003",
@@ -1385,8 +1385,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 1,
CodDoc = "",
DtCreate = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1806),
DtMod = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1857),
DtCreate = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9506),
DtMod = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9552),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 5.0,
@@ -1398,8 +1398,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 2,
CodDoc = "",
DtCreate = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1860),
DtMod = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1861),
DtCreate = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9555),
DtMod = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9556),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 8.0,
@@ -1411,8 +1411,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 3,
CodDoc = "",
DtCreate = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1863),
DtMod = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1865),
DtCreate = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9559),
DtMod = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9560),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 5.0,
@@ -1424,8 +1424,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 4,
CodDoc = "",
DtCreate = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1867),
DtMod = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1868),
DtCreate = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9562),
DtMod = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9564),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 1.0,
@@ -1437,8 +1437,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 5,
CodDoc = "",
DtCreate = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1870),
DtMod = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1872),
DtCreate = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9566),
DtMod = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9567),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 10.0,
@@ -1450,8 +1450,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 6,
CodDoc = "",
DtCreate = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1874),
DtMod = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1875),
DtCreate = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9569),
DtMod = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9571),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 1.0,
@@ -1463,8 +1463,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 7,
CodDoc = "",
DtCreate = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1878),
DtMod = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1879),
DtCreate = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9573),
DtMod = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9574),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 50.0,
@@ -1476,8 +1476,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 8,
CodDoc = "",
DtCreate = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1881),
DtMod = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1883),
DtCreate = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9576),
DtMod = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9578),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 1.0,
@@ -1489,8 +1489,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 9,
CodDoc = "",
DtCreate = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1885),
DtMod = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1886),
DtCreate = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9580),
DtMod = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9581),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 1.0,
@@ -1502,8 +1502,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 10,
CodDoc = "",
DtCreate = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1888),
DtMod = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1890),
DtCreate = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9583),
DtMod = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9585),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 1.0,
@@ -291,6 +291,7 @@ namespace EgwCoreLib.Lux.Data.Migrations
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
CodGroup = table.Column<string>(type: "varchar(255)", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ItemType = table.Column<int>(type: "int", nullable: false),
IsService = table.Column<bool>(type: "tinyint(1)", nullable: false),
ItemCode = table.Column<int>(type: "int", nullable: false),
ExtItemCode = table.Column<string>(type: "longtext", nullable: false)
@@ -303,7 +304,6 @@ namespace EgwCoreLib.Lux.Data.Migrations
Margin = table.Column<double>(type: "double", nullable: false),
QtyMin = table.Column<double>(type: "double", nullable: false),
QtyMax = table.Column<double>(type: "double", nullable: false),
BomGen = table.Column<bool>(type: "tinyint(1)", nullable: false),
UM = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
@@ -767,25 +767,25 @@ namespace EgwCoreLib.Lux.Data.Migrations
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, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2063), new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2064), 0, 1, 1, 2024, new DateTime(2025, 9, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2060) });
values: new object[] { 1, 2, 2, "Offerta per tre serramenti", new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9764), new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9766), 0, 1, 1, 2024, new DateTime(2025, 9, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9761) });
migrationBuilder.InsertData(
table: "RegItem",
columns: new[] { "ItemID", "BomGen", "CodGroup", "Cost", "Description", "ExtItemCode", "IsService", "ItemCode", "Margin", "QtyMax", "QtyMin", "SupplCode", "UM" },
columns: new[] { "ItemID", "CodGroup", "Cost", "Description", "ExtItemCode", "IsService", "ItemCode", "ItemType", "Margin", "QtyMax", "QtyMin", "SupplCode", "UM" },
values: new object[,]
{
{ 1, false, "WindowTrunk", 20.0, "BARRA-60x80 generica", "", false, 1001, 0.29999999999999999, 0.0, 0.0, "BARR.001", "#" },
{ 2, false, "WindowTrunk", 16.5, "Barra 60x80, lunghezza 12m", "BARRA-60x80x12000", false, 1002, 0.20999999999999999, 0.0, 0.0, "ABC.00123.12000", "#" },
{ 3, false, "WindowTrunk", 17.5, "Barra 60x80, lunghezza 8m", "BARRA-60x80x8000", false, 1003, 0.22, 0.0, 0.0, "ABC.00123.8000", "#" },
{ 4, false, "WindowTrunk", 15.5, "Barra 60x80, lunghezza 16m", "BARRA-60x80x16000", false, 1004, 0.20000000000000001, 0.0, 0.0, "ABC.00123.16000", "#" },
{ 5, false, "WindowGlass", 300.0, "Vetro triplo, basso indice termico, 800x1000", "VETRO-3L-THERMO-800x1000", false, 2001, 0.20000000000000001, 0.0, 0.0, "V3T.800.1000", "m2" },
{ 6, false, "WindowGlass", 200.0, "Vetro doppio, 800x1000", "VETRO-2L-800x1000", false, 2002, 0.14999999999999999, 0.0, 0.0, "V2.800.1000", "m2" },
{ 7, false, "WindowGlass", 250.0, "Vetro triplo, 800x1000", "VETRO-3L-800x1000", false, 2003, 0.17999999999999999, 0.0, 0.0, "V3.800.1000", "m2" },
{ 8, false, "WindowVarnish", 20.0, "Vernice trasparente", "VERN-TRASP", false, 3001, 0.20000000000000001, 0.0, 0.0, "VT.STD", "l" },
{ 9, false, "WindowHardware", 65.0, "Kit standard completo AGB tipo 001", "KIT-001", false, 5001, 0.20000000000000001, 0.0, 0.0, "AGB-KIT-001", "#" },
{ 10, false, "WindowHardware", 10.0, "Cerniera AGB tipo 001", "CERN-001", false, 5002, 0.20000000000000001, 0.0, 0.0, "AGB-CERN-001", "#" },
{ 11, false, "WindowHardware", 15.0, "Serratura AGB tipo 001", "SERR-001", false, 5003, 0.20000000000000001, 0.0, 0.0, "AGB-SERR-001", "#" },
{ 12, false, "WindowHardware", 25.0, "Maniglia AGB tipo 001", "MAN-001", false, 5004, 0.20000000000000001, 0.0, 0.0, "AGB-MAN-001", "#" }
{ 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(
@@ -813,9 +813,9 @@ namespace EgwCoreLib.Lux.Data.Migrations
columns: new[] { "OfferRowID", "BomOk", "Cost", "Environment", "Inserted", "ItemBOM", "ItemOk", "ItemSPP", "Modified", "Note", "OfferID", "OfferRowUID", "Qty", "RowNum", "SellingItemID", "SerStruct" },
values: new object[,]
{
{ 1, false, 950.0, "WINDOW", new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2090), "", false, "{}", new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2092), "Finestra anta singola 2025", 1, "OFF0000000001", 3.0, 1, 1, "{}" },
{ 2, false, 160.0, "WINDOW", new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2098), "", false, "{}", new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2100), "Persiana per Finestra anta singola 2025", 1, "OFF0000000002", 3.0, 2, 2, "{}" },
{ 3, false, 200.0, "WINDOW", new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2105), "", false, "{}", new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2107), "Installazione serramento", 1, "OFF0000000003", 3.0, 3, 3, "{}" }
{ 1, false, 950.0, "WINDOW", new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9790), "", false, "{}", new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9791), "Finestra anta singola 2025", 1, "OFF0000000001", 3.0, 1, 1, "{}" },
{ 2, false, 160.0, "WINDOW", new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9798), "", false, "{}", new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9799), "Persiana per Finestra anta singola 2025", 1, "OFF0000000002", 3.0, 2, 2, "{}" },
{ 3, false, 200.0, "WINDOW", new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9805), "", false, "{}", new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9806), "Installazione serramento", 1, "OFF0000000003", 3.0, 3, 3, "{}" }
});
migrationBuilder.InsertData(
@@ -840,16 +840,16 @@ namespace EgwCoreLib.Lux.Data.Migrations
columns: new[] { "StockMovID", "CodDoc", "DtCreate", "MovCod", "Note", "QtyRec", "StockStatusId", "UnitVal", "UserId" },
values: new object[,]
{
{ 1, "", new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1806), "CAR", "DEMO", 5.0, 1, 0.0, "samuele.locatelli@egalware.com" },
{ 2, "", new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1860), "CAR", "DEMO", 8.0, 2, 0.0, "samuele.locatelli@egalware.com" },
{ 3, "", new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1863), "CAR", "DEMO", 5.0, 3, 0.0, "samuele.locatelli@egalware.com" },
{ 4, "", new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1867), "CAR", "DEMO", 1.0, 4, 0.0, "samuele.locatelli@egalware.com" },
{ 5, "", new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1870), "CAR", "DEMO", 10.0, 5, 0.0, "samuele.locatelli@egalware.com" },
{ 6, "", new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1874), "CAR", "DEMO", 1.0, 6, 0.0, "samuele.locatelli@egalware.com" },
{ 7, "", new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1878), "CAR", "DEMO", 50.0, 7, 0.0, "samuele.locatelli@egalware.com" },
{ 8, "", new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1881), "CAR", "DEMO", 1.0, 8, 0.0, "samuele.locatelli@egalware.com" },
{ 9, "", new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1885), "CAR", "DEMO", 1.0, 9, 0.0, "samuele.locatelli@egalware.com" },
{ 10, "", new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1888), "CAR", "DEMO", 1.0, 10, 0.0, "samuele.locatelli@egalware.com" }
{ 1, "", new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9506), "CAR", "DEMO", 5.0, 1, 0.0, "samuele.locatelli@egalware.com" },
{ 2, "", new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9555), "CAR", "DEMO", 8.0, 2, 0.0, "samuele.locatelli@egalware.com" },
{ 3, "", new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9559), "CAR", "DEMO", 5.0, 3, 0.0, "samuele.locatelli@egalware.com" },
{ 4, "", new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9562), "CAR", "DEMO", 1.0, 4, 0.0, "samuele.locatelli@egalware.com" },
{ 5, "", new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9566), "CAR", "DEMO", 10.0, 5, 0.0, "samuele.locatelli@egalware.com" },
{ 6, "", new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9569), "CAR", "DEMO", 1.0, 6, 0.0, "samuele.locatelli@egalware.com" },
{ 7, "", new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9573), "CAR", "DEMO", 50.0, 7, 0.0, "samuele.locatelli@egalware.com" },
{ 8, "", new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9576), "CAR", "DEMO", 1.0, 8, 0.0, "samuele.locatelli@egalware.com" },
{ 9, "", new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9580), "CAR", "DEMO", 1.0, 9, 0.0, "samuele.locatelli@egalware.com" },
{ 10, "", new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9583), "CAR", "DEMO", 1.0, 10, 0.0, "samuele.locatelli@egalware.com" }
});
migrationBuilder.CreateIndex(
@@ -192,9 +192,6 @@ namespace EgwCoreLib.Lux.Data.Migrations
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ItemID"));
b.Property<bool>("BomGen")
.HasColumnType("tinyint(1)");
b.Property<string>("CodGroup")
.IsRequired()
.HasColumnType("varchar(255)");
@@ -216,6 +213,9 @@ namespace EgwCoreLib.Lux.Data.Migrations
b.Property<int>("ItemCode")
.HasColumnType("int");
b.Property<int>("ItemType")
.HasColumnType("int");
b.Property<double>("Margin")
.HasColumnType("double");
@@ -243,13 +243,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ItemID = 1,
BomGen = false,
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,
@@ -259,13 +259,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ItemID = 2,
BomGen = false,
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,
@@ -275,13 +275,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ItemID = 3,
BomGen = false,
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,
@@ -291,13 +291,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ItemID = 4,
BomGen = false,
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,
@@ -307,13 +307,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ItemID = 5,
BomGen = false,
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,
@@ -323,13 +323,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ItemID = 6,
BomGen = false,
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,
@@ -339,13 +339,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ItemID = 7,
BomGen = false,
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,
@@ -355,13 +355,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ItemID = 8,
BomGen = false,
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,
@@ -371,13 +371,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ItemID = 9,
BomGen = false,
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,
@@ -387,13 +387,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ItemID = 10,
BomGen = false,
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,
@@ -403,13 +403,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ItemID = 11,
BomGen = false,
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,
@@ -419,13 +419,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
new
{
ItemID = 12,
BomGen = false,
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,
@@ -715,13 +715,13 @@ namespace EgwCoreLib.Lux.Data.Migrations
CustomerID = 2,
DealerID = 2,
Description = "Offerta per tre serramenti",
Inserted = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2063),
Modified = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2064),
Inserted = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9764),
Modified = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9766),
OffertState = 0,
RefNum = 1,
RefRev = 1,
RefYear = 2024,
ValidUntil = new DateTime(2025, 9, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2060)
ValidUntil = new DateTime(2025, 9, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9761)
});
});
@@ -799,11 +799,11 @@ namespace EgwCoreLib.Lux.Data.Migrations
BomOk = false,
Cost = 950.0,
Environment = "WINDOW",
Inserted = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2090),
Inserted = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9790),
ItemBOM = "",
ItemOk = false,
ItemSPP = "{}",
Modified = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2092),
Modified = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9791),
Note = "Finestra anta singola 2025",
OfferID = 1,
OfferRowUID = "OFF0000000001",
@@ -818,11 +818,11 @@ namespace EgwCoreLib.Lux.Data.Migrations
BomOk = false,
Cost = 160.0,
Environment = "WINDOW",
Inserted = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2098),
Inserted = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9798),
ItemBOM = "",
ItemOk = false,
ItemSPP = "{}",
Modified = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2100),
Modified = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9799),
Note = "Persiana per Finestra anta singola 2025",
OfferID = 1,
OfferRowUID = "OFF0000000002",
@@ -837,11 +837,11 @@ namespace EgwCoreLib.Lux.Data.Migrations
BomOk = false,
Cost = 200.0,
Environment = "WINDOW",
Inserted = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2105),
Inserted = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9805),
ItemBOM = "",
ItemOk = false,
ItemSPP = "{}",
Modified = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(2107),
Modified = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9806),
Note = "Installazione serramento",
OfferID = 1,
OfferRowUID = "OFF0000000003",
@@ -1382,8 +1382,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 1,
CodDoc = "",
DtCreate = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1806),
DtMod = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1857),
DtCreate = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9506),
DtMod = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9552),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 5.0,
@@ -1395,8 +1395,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 2,
CodDoc = "",
DtCreate = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1860),
DtMod = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1861),
DtCreate = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9555),
DtMod = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9556),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 8.0,
@@ -1408,8 +1408,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 3,
CodDoc = "",
DtCreate = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1863),
DtMod = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1865),
DtCreate = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9559),
DtMod = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9560),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 5.0,
@@ -1421,8 +1421,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 4,
CodDoc = "",
DtCreate = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1867),
DtMod = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1868),
DtCreate = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9562),
DtMod = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9564),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 1.0,
@@ -1434,8 +1434,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 5,
CodDoc = "",
DtCreate = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1870),
DtMod = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1872),
DtCreate = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9566),
DtMod = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9567),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 10.0,
@@ -1447,8 +1447,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 6,
CodDoc = "",
DtCreate = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1874),
DtMod = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1875),
DtCreate = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9569),
DtMod = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9571),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 1.0,
@@ -1460,8 +1460,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 7,
CodDoc = "",
DtCreate = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1878),
DtMod = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1879),
DtCreate = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9573),
DtMod = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9574),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 50.0,
@@ -1473,8 +1473,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 8,
CodDoc = "",
DtCreate = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1881),
DtMod = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1883),
DtCreate = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9576),
DtMod = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9578),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 1.0,
@@ -1486,8 +1486,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 9,
CodDoc = "",
DtCreate = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1885),
DtMod = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1886),
DtCreate = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9580),
DtMod = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9581),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 1.0,
@@ -1499,8 +1499,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
{
StockMovID = 10,
CodDoc = "",
DtCreate = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1888),
DtMod = new DateTime(2025, 8, 8, 10, 21, 23, 588, DateTimeKind.Local).AddTicks(1890),
DtCreate = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9583),
DtMod = new DateTime(2025, 8, 8, 15, 18, 53, 613, DateTimeKind.Local).AddTicks(9585),
MovCod = "CAR",
Note = "DEMO",
QtyRec = 1.0,
+15 -15
View File
@@ -69,24 +69,24 @@ namespace EgwCoreLib.Lux.Data
// inizializzazione dei valori di default x Item di magazzino
modelBuilder.Entity<ItemModel>().HasData(
// barre grezzo
new ItemModel { ItemID = 1, CodGroup = "WindowTrunk", IsService = false, ItemCode = 1001, Description = "BARRA-60x80 generica", SupplCode = "BARR.001", Cost = 20, Margin = 0.3, UM = "#" },
new ItemModel { ItemID = 2, CodGroup = "WindowTrunk", IsService = false, ItemCode = 1002, ExtItemCode = "BARRA-60x80x12000", SupplCode = "ABC.00123.12000", Description = "Barra 60x80, lunghezza 12m", Cost = 16.5, Margin = 0.21, UM = "#" },
new ItemModel { ItemID = 3, CodGroup = "WindowTrunk", IsService = false, ItemCode = 1003, ExtItemCode = "BARRA-60x80x8000", SupplCode = "ABC.00123.8000", Description = "Barra 60x80, lunghezza 8m", Cost = 17.5, Margin = 0.22, UM = "#" },
new ItemModel { ItemID = 4, CodGroup = "WindowTrunk", IsService = false, ItemCode = 1004, ExtItemCode = "BARRA-60x80x16000", SupplCode = "ABC.00123.16000", Description = "Barra 60x80, lunghezza 16m", Cost = 15.5, Margin = 0.2, UM = "#" },
new ItemModel { ItemID = 1, CodGroup = "WindowTrunk", ItemType = Core.Enum.ItemClassType.Buy, IsService = false, ItemCode = 1001, Description = "BARRA-60x80 generica", SupplCode = "BARR.001", Cost = 20, Margin = 0.3, UM = "#" },
new ItemModel { ItemID = 2, CodGroup = "WindowTrunk", ItemType = Core.Enum.ItemClassType.Buy, IsService = false, ItemCode = 1002, ExtItemCode = "BARRA-60x80x12000", SupplCode = "ABC.00123.12000", Description = "Barra 60x80, lunghezza 12m", Cost = 16.5, Margin = 0.21, UM = "#" },
new ItemModel { ItemID = 3, CodGroup = "WindowTrunk", ItemType = Core.Enum.ItemClassType.Buy, IsService = false, ItemCode = 1003, ExtItemCode = "BARRA-60x80x8000", SupplCode = "ABC.00123.8000", Description = "Barra 60x80, lunghezza 8m", Cost = 17.5, Margin = 0.22, UM = "#" },
new ItemModel { ItemID = 4, CodGroup = "WindowTrunk", ItemType = Core.Enum.ItemClassType.Buy, IsService = false, ItemCode = 1004, ExtItemCode = "BARRA-60x80x16000", SupplCode = "ABC.00123.16000", Description = "Barra 60x80, lunghezza 16m", Cost = 15.5, Margin = 0.2, UM = "#" },
// vetri
new ItemModel { ItemID = 5, CodGroup = "WindowGlass", IsService = false, ItemCode = 2001, ExtItemCode = "VETRO-3L-THERMO-800x1000", SupplCode = "V3T.800.1000", Description = "Vetro triplo, basso indice termico, 800x1000", Cost = 300, Margin = 0.20, UM = "m2" },
new ItemModel { ItemID = 6, CodGroup = "WindowGlass", IsService = false, ItemCode = 2002, ExtItemCode = "VETRO-2L-800x1000", SupplCode = "V2.800.1000", Description = "Vetro doppio, 800x1000", Cost = 200, Margin = 0.15, UM = "m2" },
new ItemModel { ItemID = 7, CodGroup = "WindowGlass", IsService = false, ItemCode = 2003, ExtItemCode = "VETRO-3L-800x1000", SupplCode = "V3.800.1000", Description = "Vetro triplo, 800x1000", Cost = 250, Margin = 0.18, UM = "m2" },
new ItemModel { ItemID = 5, CodGroup = "WindowGlass", ItemType = Core.Enum.ItemClassType.Buy, IsService = false, ItemCode = 2001, ExtItemCode = "VETRO-3L-THERMO-800x1000", SupplCode = "V3T.800.1000", Description = "Vetro triplo, basso indice termico, 800x1000", Cost = 300, Margin = 0.20, UM = "m2" },
new ItemModel { ItemID = 6, CodGroup = "WindowGlass", ItemType = Core.Enum.ItemClassType.Buy, IsService = false, ItemCode = 2002, ExtItemCode = "VETRO-2L-800x1000", SupplCode = "V2.800.1000", Description = "Vetro doppio, 800x1000", Cost = 200, Margin = 0.15, UM = "m2" },
new ItemModel { ItemID = 7, CodGroup = "WindowGlass", ItemType = Core.Enum.ItemClassType.Buy, IsService = false, ItemCode = 2003, ExtItemCode = "VETRO-3L-800x1000", SupplCode = "V3.800.1000", Description = "Vetro triplo, 800x1000", Cost = 250, Margin = 0.18, UM = "m2" },
// vernici
new ItemModel { ItemID = 8, CodGroup = "WindowVarnish", IsService = false, ItemCode = 3001, ExtItemCode = "VERN-TRASP", SupplCode = "VT.STD", Description = "Vernice trasparente", Cost = 20, Margin = 0.20, UM = "l" },
new ItemModel { ItemID = 8, CodGroup = "WindowVarnish", ItemType = Core.Enum.ItemClassType.Buy, IsService = false, ItemCode = 3001, ExtItemCode = "VERN-TRASP", SupplCode = "VT.STD", Description = "Vernice trasparente", Cost = 20, Margin = 0.20, UM = "l" },
// ferramenta
new ItemModel { ItemID = 9, CodGroup = "WindowHardware", IsService = false, ItemCode = 5001, ExtItemCode = "KIT-001", SupplCode = "AGB-KIT-001", Description = "Kit standard completo AGB tipo 001", Cost = 65, Margin = 0.20, UM = "#" },
new ItemModel { ItemID = 10, CodGroup = "WindowHardware", IsService = false, ItemCode = 5002, ExtItemCode = "CERN-001", SupplCode = "AGB-CERN-001", Description = "Cerniera AGB tipo 001", Cost = 10, Margin = 0.20, UM = "#" },
new ItemModel { ItemID = 11, CodGroup = "WindowHardware", IsService = false, ItemCode = 5003, ExtItemCode = "SERR-001", SupplCode = "AGB-SERR-001", Description = "Serratura AGB tipo 001", Cost = 15, Margin = 0.20, UM = "#" },
new ItemModel { ItemID = 12, CodGroup = "WindowHardware", IsService = false, ItemCode = 5004, ExtItemCode = "MAN-001", SupplCode = "AGB-MAN-001", Description = "Maniglia AGB tipo 001", Cost = 25, Margin = 0.20, UM = "#" }
new ItemModel { ItemID = 9, CodGroup = "WindowHardware", ItemType = Core.Enum.ItemClassType.Buy, IsService = false, ItemCode = 5001, ExtItemCode = "KIT-001", SupplCode = "AGB-KIT-001", Description = "Kit standard completo AGB tipo 001", Cost = 65, Margin = 0.20, UM = "#" },
new ItemModel { ItemID = 10, CodGroup = "WindowHardware", ItemType = Core.Enum.ItemClassType.Buy, IsService = false, ItemCode = 5002, ExtItemCode = "CERN-001", SupplCode = "AGB-CERN-001", Description = "Cerniera AGB tipo 001", Cost = 10, Margin = 0.20, UM = "#" },
new ItemModel { ItemID = 11, CodGroup = "WindowHardware", ItemType = Core.Enum.ItemClassType.Buy, IsService = false, ItemCode = 5003, ExtItemCode = "SERR-001", SupplCode = "AGB-SERR-001", Description = "Serratura AGB tipo 001", Cost = 15, Margin = 0.20, UM = "#" },
new ItemModel { ItemID = 12, CodGroup = "WindowHardware", ItemType = Core.Enum.ItemClassType.Buy, IsService = false, ItemCode = 5004, ExtItemCode = "MAN-001", SupplCode = "AGB-MAN-001", Description = "Maniglia AGB tipo 001", Cost = 25, Margin = 0.20, UM = "#" }
);
// inizializzazione dei valori di default x Item di giacenza
@@ -203,9 +203,9 @@ namespace EgwCoreLib.Lux.Data
// inizializzazione dei valori di default x OfferRow
modelBuilder.Entity<OfferRowModel>().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 = "{}" },
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 = "{}" },
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 = "{}" }
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 }
);
}
@@ -136,15 +136,13 @@ namespace EgwCoreLib.Lux.Data.Services
/// </summary>
public async Task<bool> FlushCacheAsync()
{
await Task.Delay(50);
bool answ = false;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
await Task.Delay(1);
Stopwatch sw = new Stopwatch();
sw.Start();
RedisValue pattern = new RedisValue($"{redisBaseKey}:*");
answ = await ExecFlushRedisPatternAsync(pattern);
stopWatch.Stop();
Log.Debug($"FlushCacheAsync in {stopWatch.Elapsed.TotalMilliseconds} ms");
sw.Stop();
Log.Debug($"FlushCacheAsync in {sw.Elapsed.TotalMilliseconds} ms");
return answ;
}
@@ -188,7 +186,7 @@ namespace EgwCoreLib.Lux.Data.Services
/// </summary>
/// <param name="OfferID"></param>
/// <returns></returns>
public List<OfferRowModel> OfferRowGetByOffer(int OfferID)
public async Task<List<OfferRowModel>> OfferRowGetByOffer(int OfferID)
{
string source = "DB";
Stopwatch sw = new Stopwatch();
@@ -196,7 +194,7 @@ namespace EgwCoreLib.Lux.Data.Services
List<OfferRowModel>? result = new List<OfferRowModel>();
// cerco in redis...
string currKey = $"{redisBaseKey}:OfferRows:{OfferID}";
RedisValue rawData = redisDb.StringGet(currKey);
RedisValue rawData = await redisDb.StringGetAsync(currKey);
//if (!string.IsNullOrEmpty($"{rawData}"))
if (rawData.HasValue)
{
@@ -208,7 +206,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = dbController.OfferRowGetByOffer(OfferID);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, LongCache);
await redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -219,6 +217,54 @@ namespace EgwCoreLib.Lux.Data.Services
return result;
}
/// <summary>
/// Effettua update dei costi di tutte le righe dell'offerta indicata
/// </summary>
/// <param name="OfferID">Key</param>
/// <returns></returns>
public async Task<bool> OffertUpdateCost(int OfferID)
{
Stopwatch sw = new Stopwatch();
sw.Start();
// calcolo
bool fatto = await dbController.OffertUpdateCost(OfferID);
// svuoto cache...
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Offers:*");
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:OfferRows:*");
sw.Stop();
Log.Debug($"OffertUpdateCost in {sw.Elapsed.TotalMilliseconds} ms");
return fatto;
}
/// <summary>
/// Esegue salvataggio BOM sul DB
/// </summary>
/// <param name="uID">UID dell'item offerta di cui si è ricevuto la BOM</param>
/// <param name="execEnvironment">Environment dell'item</param>
/// <param name="bomContent">BOM serializzata</param>
/// <returns></returns>
public async Task SaveBomAsync(string uID, Constants.EXECENVIRONMENTS execEnvironment, string bomContent)
{
// salvo sul DB il risultato della BOM
if (!string.IsNullOrEmpty(bomContent))
{
try
{
// deserializzo la Bom...
var bomList = JsonConvert.DeserializeObject<List<BomItemDTO>>(bomContent);
if (bomList != null)
{
// verifico 1:1 gli item ricevuti dalla BOM sul DB con eventuale insert
dbController.ItemUpsertFromBom(bomList);
// salvo la BOM nel record del DB relativo all'oggetto richiesto
dbController.OfferUpsertFromBom(uID, bomList);
}
}
catch { }
}
await Task.Delay(1);
}
#endregion Public Methods
#region Protected Fields
@@ -342,35 +388,6 @@ namespace EgwCoreLib.Lux.Data.Services
return answ;
}
/// <summary>
/// Esegue salvataggio BOM sul DB
/// </summary>
/// <param name="uID">UID dell'item offerta di cui si è ricevuto la BOM</param>
/// <param name="execEnvironment">Environment dell'item</param>
/// <param name="bomContent">BOM serializzata</param>
/// <returns></returns>
public async Task SaveBomAsync(string uID, Constants.EXECENVIRONMENTS execEnvironment, string bomContent)
{
// salvo sul DB il risultato della BOM
if (!string.IsNullOrEmpty(bomContent))
{
try
{
// deserializzo la Bom...
var bomList = JsonConvert.DeserializeObject<List<BomItemDTO>>(bomContent);
if (bomList != null)
{
// verifico 1:1 gli item ricevuti dalla BOM sul DB con eventuale insert
dbController.ItemUpsertFromBom(bomList);
// salvo la BOM nel record del DB relativo all'oggetto richiesto
dbController.OfferUpsertFromBom(uID, bomList);
}
}
catch { }
}
await Task.Delay(1);
}
#endregion Protected Methods
#region Private Fields