Re-issue migration + inizio pagina template corretta
This commit is contained in:
@@ -4629,6 +4629,114 @@ namespace EgwCoreLib.Lux.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue il cloning completo di un Template e di TUTTE le relative righe...
|
||||
/// </summary>
|
||||
/// <param name="rec2clone"></param>
|
||||
/// <returns></returns>
|
||||
internal async Task<bool> TemplateCloneAsync(TemplateModel rec2clone)
|
||||
{
|
||||
bool answ = false;
|
||||
//using (DataLayerContext dbCtx = new DataLayerContext(_config))
|
||||
using (DataLayerContext dbCtx = new DataLayerContext())
|
||||
{
|
||||
try
|
||||
{
|
||||
DateTime adesso = DateTime.Now;
|
||||
// recupero offerta...
|
||||
var currRec = dbCtx
|
||||
.DbSetTemplate
|
||||
.Where(x => x.TemplateID == rec2clone.TemplateID)
|
||||
.Include(x => x.TemplateRowNav)
|
||||
.FirstOrDefault();
|
||||
|
||||
// se trovo --> duplico!
|
||||
if (currRec != null)
|
||||
{
|
||||
// recupero ultimo num offerta dell'anno corrente...
|
||||
TemplateModel newRec = new TemplateModel()
|
||||
{
|
||||
Name = rec2clone.Name,
|
||||
Envir = rec2clone.Envir,
|
||||
Description = rec2clone.Description,
|
||||
SourceType = rec2clone.SourceType,
|
||||
};
|
||||
|
||||
// sistemo child...
|
||||
newRec.TemplateRowNav = currRec.TemplateRowNav
|
||||
.Select(c => new TemplateRowModel()
|
||||
{
|
||||
AwaitBom = c.AwaitBom,
|
||||
AwaitPrice = c.AwaitPrice,
|
||||
BomCost = c.BomCost,
|
||||
BomOk = c.BomOk,
|
||||
BomPrice = c.BomPrice,
|
||||
Envir = c.Envir,
|
||||
FileName = c.FileName,
|
||||
FileResource = c.FileResource,
|
||||
FileSize = c.FileSize,
|
||||
Inserted = adesso,
|
||||
ItemBOM = c.ItemBOM,
|
||||
ItemJCD = c.ItemJCD,
|
||||
ItemOk = c.ItemOk,
|
||||
ItemSteps = c.ItemSteps,
|
||||
ItemTags = c.ItemTags,
|
||||
JobID = c.JobID,
|
||||
Note = c.Note,
|
||||
ProdItemQty = c.ProdItemQty,
|
||||
Qty = c.Qty,
|
||||
RowNum = c.RowNum,
|
||||
SellingItemID = c.SellingItemID,
|
||||
SerStruct = c.SerStruct,
|
||||
StepCost = c.StepCost,
|
||||
StepFlowTime = c.StepFlowTime,
|
||||
StepLeadTime = c.StepLeadTime,
|
||||
StepPrice = c.StepPrice,
|
||||
Name = c.Name,
|
||||
TemplateRowUID = c.TemplateRowDtx
|
||||
})
|
||||
.ToList();
|
||||
|
||||
// infine aggiungo riga ordine e relativi child
|
||||
dbCtx.DbSetTemplate.Add(newRec);
|
||||
}
|
||||
|
||||
// salvo TUTTI i cambiamenti...
|
||||
var result = await dbCtx.SaveChangesAsync();
|
||||
answ = result > 0;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione durante TemplateCloneAsync{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Elenco completo Template da DB
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal async Task<List<TemplateModel>> TemplateGetAllAsync()
|
||||
{
|
||||
List<TemplateModel> dbResult = new List<TemplateModel>();
|
||||
//using (DataLayerContext dbCtx = new DataLayerContext(_config))
|
||||
using (DataLayerContext dbCtx = new DataLayerContext())
|
||||
{
|
||||
try
|
||||
{
|
||||
dbResult = await dbCtx
|
||||
.DbSetTemplate
|
||||
.Include(r => r.TemplateRowNav)
|
||||
.ToListAsync();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione durante TemplateGetAllAsync{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
internal bool UpdateCodGroup(List<BomItemDTO> bomList)
|
||||
{
|
||||
bool answ = false;
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
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.Sales
|
||||
@@ -96,18 +91,6 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales
|
||||
get => (TotalCost > 0 && TotalPrice > TotalCost) ? (TotalPrice - TotalCost) / TotalPrice : 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione Customer
|
||||
/// </summary>
|
||||
[ForeignKey("CustomerID")]
|
||||
public virtual CustomerModel CustomerNav { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione Dealer
|
||||
/// </summary>
|
||||
[ForeignKey("DealerID")]
|
||||
public virtual DealerModel DealerNav { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione alle righe offerta
|
||||
/// </summary>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
@@ -32,103 +31,6 @@ namespace EgwCoreLib.Lux.Data.Migrations
|
||||
nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer",
|
||||
keyColumn: "OfferID",
|
||||
keyValue: 1,
|
||||
columns: new[] { "DueDateProm", "DueDateReq", "ValidUntil" },
|
||||
values: new object[] { new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 2, 25, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 2, 26, 16, 26, 31, 274, DateTimeKind.Local).AddTicks(325) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer",
|
||||
keyColumn: "OfferID",
|
||||
keyValue: 2,
|
||||
columns: new[] { "DueDateProm", "DueDateReq", "ValidUntil" },
|
||||
values: new object[] { new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 2, 25, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 2, 26, 16, 26, 31, 274, DateTimeKind.Local).AddTicks(346) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer",
|
||||
keyColumn: "OfferID",
|
||||
keyValue: 3,
|
||||
columns: new[] { "DueDateProm", "DueDateReq", "ValidUntil" },
|
||||
values: new object[] { new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 2, 25, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 2, 26, 16, 26, 31, 274, DateTimeKind.Local).AddTicks(352) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer",
|
||||
keyColumn: "OfferID",
|
||||
keyValue: 4,
|
||||
columns: new[] { "DueDateProm", "DueDateReq", "ValidUntil" },
|
||||
values: new object[] { new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 2, 25, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 2, 26, 16, 26, 31, 274, DateTimeKind.Local).AddTicks(359) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 1,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 2,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 3,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 4,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 5,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 6,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 7,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 8,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 9,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 10,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -146,103 +48,7 @@ namespace EgwCoreLib.Lux.Data.Migrations
|
||||
name: "RawMaterials",
|
||||
table: "production_odl");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer",
|
||||
keyColumn: "OfferID",
|
||||
keyValue: 1,
|
||||
columns: new[] { "DueDateProm", "DueDateReq", "ValidUntil" },
|
||||
values: new object[] { new DateTime(2026, 3, 23, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 2, 21, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 2, 22, 15, 37, 12, 775, DateTimeKind.Local).AddTicks(187) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer",
|
||||
keyColumn: "OfferID",
|
||||
keyValue: 2,
|
||||
columns: new[] { "DueDateProm", "DueDateReq", "ValidUntil" },
|
||||
values: new object[] { new DateTime(2026, 3, 23, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 2, 21, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 2, 22, 15, 37, 12, 775, DateTimeKind.Local).AddTicks(203) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer",
|
||||
keyColumn: "OfferID",
|
||||
keyValue: 3,
|
||||
columns: new[] { "DueDateProm", "DueDateReq", "ValidUntil" },
|
||||
values: new object[] { new DateTime(2026, 3, 23, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 2, 21, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 2, 22, 15, 37, 12, 775, DateTimeKind.Local).AddTicks(219) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer",
|
||||
keyColumn: "OfferID",
|
||||
keyValue: 4,
|
||||
columns: new[] { "DueDateProm", "DueDateReq", "ValidUntil" },
|
||||
values: new object[] { new DateTime(2026, 3, 23, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 2, 21, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 2, 22, 15, 37, 12, 775, DateTimeKind.Local).AddTicks(229) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 1,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 22, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 22, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 2,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 22, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 22, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 3,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 22, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 22, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 4,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 22, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 22, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 5,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 22, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 22, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 6,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 22, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 22, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 7,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 22, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 22, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 8,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 22, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 22, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 9,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 22, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 22, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 10,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 22, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 22, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,240 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EgwCoreLib.Lux.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class TemplateObj : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "SellingItemID",
|
||||
table: "sales_order_row",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "SellingItemID",
|
||||
table: "sales_offer_row",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "SourceType",
|
||||
table: "item_selling_item",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "sales_template",
|
||||
columns: table => new
|
||||
{
|
||||
TemplateID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Envir = table.Column<int>(type: "int", nullable: false),
|
||||
SourceType = table.Column<int>(type: "int", nullable: false),
|
||||
Name = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Description = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CustomerID = table.Column<int>(type: "int", nullable: false),
|
||||
DealerID = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_sales_template", x => x.TemplateID);
|
||||
table.ForeignKey(
|
||||
name: "FK_sales_template_sales_customer_CustomerID",
|
||||
column: x => x.CustomerID,
|
||||
principalTable: "sales_customer",
|
||||
principalColumn: "CustomerID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_sales_template_sales_dealer_DealerID",
|
||||
column: x => x.DealerID,
|
||||
principalTable: "sales_dealer",
|
||||
principalColumn: "DealerID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "sales_template_row",
|
||||
columns: table => new
|
||||
{
|
||||
TemplateRowID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
TemplateID = table.Column<int>(type: "int", nullable: false),
|
||||
RowNum = table.Column<int>(type: "int", nullable: false),
|
||||
Envir = table.Column<int>(type: "int", nullable: false),
|
||||
Name = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
TemplateRowUID = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
SellingItemID = table.Column<int>(type: "int", nullable: false),
|
||||
Qty = table.Column<double>(type: "double", nullable: false),
|
||||
BomCost = table.Column<double>(type: "double", nullable: false),
|
||||
BomPrice = table.Column<double>(type: "double", nullable: false),
|
||||
StepCost = table.Column<double>(type: "double", nullable: false),
|
||||
StepPrice = table.Column<double>(type: "double", nullable: false),
|
||||
StepLeadTime = table.Column<double>(type: "double", nullable: false),
|
||||
StepFlowTime = table.Column<double>(type: "double", nullable: false),
|
||||
SerStruct = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
FileResource = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
FileName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
FileSize = table.Column<long>(type: "bigint", nullable: false),
|
||||
ItemBOM = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ItemJCD = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ItemTags = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ProdItemQty = table.Column<int>(type: "int", nullable: false),
|
||||
JobID = table.Column<int>(type: "int", nullable: false),
|
||||
ItemSteps = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
BomOk = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
ItemOk = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
Note = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
AwaitBom = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
AwaitPrice = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
Inserted = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_sales_template_row", x => x.TemplateRowID);
|
||||
table.ForeignKey(
|
||||
name: "FK_sales_template_row_item_selling_item_SellingItemID",
|
||||
column: x => x.SellingItemID,
|
||||
principalTable: "item_selling_item",
|
||||
principalColumn: "SellingItemID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_sales_template_row_sales_template_TemplateID",
|
||||
column: x => x.TemplateID,
|
||||
principalTable: "sales_template",
|
||||
principalColumn: "TemplateID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "item_selling_item",
|
||||
keyColumn: "SellingItemID",
|
||||
keyValue: 1,
|
||||
column: "SourceType",
|
||||
value: 0);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "item_selling_item",
|
||||
keyColumn: "SellingItemID",
|
||||
keyValue: 2,
|
||||
column: "SourceType",
|
||||
value: 0);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "item_selling_item",
|
||||
keyColumn: "SellingItemID",
|
||||
keyValue: 3,
|
||||
column: "SourceType",
|
||||
value: 0);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "item_selling_item",
|
||||
keyColumn: "SellingItemID",
|
||||
keyValue: 4,
|
||||
column: "SourceType",
|
||||
value: 0);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "item_selling_item",
|
||||
keyColumn: "SellingItemID",
|
||||
keyValue: 5,
|
||||
column: "SourceType",
|
||||
value: 0);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "item_selling_item",
|
||||
keyColumn: "SellingItemID",
|
||||
keyValue: 6,
|
||||
column: "SourceType",
|
||||
value: 0);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "item_selling_item",
|
||||
keyColumn: "SellingItemID",
|
||||
keyValue: 7,
|
||||
column: "SourceType",
|
||||
value: 0);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_sales_template_CustomerID",
|
||||
table: "sales_template",
|
||||
column: "CustomerID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_sales_template_DealerID",
|
||||
table: "sales_template",
|
||||
column: "DealerID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_sales_template_row_SellingItemID",
|
||||
table: "sales_template_row",
|
||||
column: "SellingItemID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_sales_template_row_TemplateID",
|
||||
table: "sales_template_row",
|
||||
column: "TemplateID");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "sales_template_row");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "sales_template");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SourceType",
|
||||
table: "item_selling_item");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "SellingItemID",
|
||||
table: "sales_order_row",
|
||||
type: "int",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "SellingItemID",
|
||||
table: "sales_offer_row",
|
||||
type: "int",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-35
@@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
namespace EgwCoreLib.Lux.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataLayerContext))]
|
||||
[Migration("20260305092809_TemplateObj")]
|
||||
partial class TemplateObj
|
||||
[Migration("20260305145628_AddTemplateObj")]
|
||||
partial class AddTemplateObj
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@@ -1487,7 +1487,7 @@ namespace EgwCoreLib.Lux.Data.Migrations
|
||||
RefNum = 1,
|
||||
RefRev = 1,
|
||||
RefYear = 2025,
|
||||
ValidUntil = new DateTime(2026, 4, 5, 10, 28, 8, 982, DateTimeKind.Local).AddTicks(2126)
|
||||
ValidUntil = new DateTime(2026, 4, 5, 15, 56, 27, 786, DateTimeKind.Local).AddTicks(8365)
|
||||
},
|
||||
new
|
||||
{
|
||||
@@ -1507,7 +1507,7 @@ namespace EgwCoreLib.Lux.Data.Migrations
|
||||
RefNum = 2,
|
||||
RefRev = 1,
|
||||
RefYear = 2025,
|
||||
ValidUntil = new DateTime(2026, 4, 5, 10, 28, 8, 982, DateTimeKind.Local).AddTicks(2142)
|
||||
ValidUntil = new DateTime(2026, 4, 5, 15, 56, 27, 786, DateTimeKind.Local).AddTicks(8376)
|
||||
},
|
||||
new
|
||||
{
|
||||
@@ -1527,7 +1527,7 @@ namespace EgwCoreLib.Lux.Data.Migrations
|
||||
RefNum = 3,
|
||||
RefRev = 1,
|
||||
RefYear = 2025,
|
||||
ValidUntil = new DateTime(2026, 4, 5, 10, 28, 8, 982, DateTimeKind.Local).AddTicks(2162)
|
||||
ValidUntil = new DateTime(2026, 4, 5, 15, 56, 27, 786, DateTimeKind.Local).AddTicks(8382)
|
||||
},
|
||||
new
|
||||
{
|
||||
@@ -1547,7 +1547,7 @@ namespace EgwCoreLib.Lux.Data.Migrations
|
||||
RefNum = 4,
|
||||
RefRev = 1,
|
||||
RefYear = 2025,
|
||||
ValidUntil = new DateTime(2026, 4, 5, 10, 28, 8, 982, DateTimeKind.Local).AddTicks(2176)
|
||||
ValidUntil = new DateTime(2026, 4, 5, 15, 56, 27, 786, DateTimeKind.Local).AddTicks(8388)
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2204,12 +2204,6 @@ namespace EgwCoreLib.Lux.Data.Migrations
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("TemplateID"));
|
||||
|
||||
b.Property<int>("CustomerID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DealerID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
@@ -2226,10 +2220,6 @@ namespace EgwCoreLib.Lux.Data.Migrations
|
||||
|
||||
b.HasKey("TemplateID");
|
||||
|
||||
b.HasIndex("CustomerID");
|
||||
|
||||
b.HasIndex("DealerID");
|
||||
|
||||
b.ToTable("sales_template");
|
||||
});
|
||||
|
||||
@@ -3806,25 +3796,6 @@ namespace EgwCoreLib.Lux.Data.Migrations
|
||||
b.Navigation("SellingItemNav");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.TemplateModel", 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.Navigation("CustomerNav");
|
||||
|
||||
b.Navigation("DealerNav");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.TemplateRowModel", b =>
|
||||
{
|
||||
b.HasOne("EgwCoreLib.Lux.Data.DbModel.Items.SellingItemModel", "SellingItemNav")
|
||||
@@ -0,0 +1,410 @@
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EgwCoreLib.Lux.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddTemplateObj : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "SellingItemID",
|
||||
table: "sales_order_row",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "SellingItemID",
|
||||
table: "sales_offer_row",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "SourceType",
|
||||
table: "item_selling_item",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "sales_template",
|
||||
columns: table => new
|
||||
{
|
||||
TemplateID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Envir = table.Column<int>(type: "int", nullable: false),
|
||||
SourceType = table.Column<int>(type: "int", nullable: false),
|
||||
Name = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Description = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_sales_template", x => x.TemplateID);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "sales_template_row",
|
||||
columns: table => new
|
||||
{
|
||||
TemplateRowID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
TemplateID = table.Column<int>(type: "int", nullable: false),
|
||||
RowNum = table.Column<int>(type: "int", nullable: false),
|
||||
Envir = table.Column<int>(type: "int", nullable: false),
|
||||
Name = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
TemplateRowUID = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
SellingItemID = table.Column<int>(type: "int", nullable: false),
|
||||
Qty = table.Column<double>(type: "double", nullable: false),
|
||||
BomCost = table.Column<double>(type: "double", nullable: false),
|
||||
BomPrice = table.Column<double>(type: "double", nullable: false),
|
||||
StepCost = table.Column<double>(type: "double", nullable: false),
|
||||
StepPrice = table.Column<double>(type: "double", nullable: false),
|
||||
StepLeadTime = table.Column<double>(type: "double", nullable: false),
|
||||
StepFlowTime = table.Column<double>(type: "double", nullable: false),
|
||||
SerStruct = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
FileResource = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
FileName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
FileSize = table.Column<long>(type: "bigint", nullable: false),
|
||||
ItemBOM = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ItemJCD = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ItemTags = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ProdItemQty = table.Column<int>(type: "int", nullable: false),
|
||||
JobID = table.Column<int>(type: "int", nullable: false),
|
||||
ItemSteps = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
BomOk = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
ItemOk = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
Note = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
AwaitBom = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
AwaitPrice = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
Inserted = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_sales_template_row", x => x.TemplateRowID);
|
||||
table.ForeignKey(
|
||||
name: "FK_sales_template_row_item_selling_item_SellingItemID",
|
||||
column: x => x.SellingItemID,
|
||||
principalTable: "item_selling_item",
|
||||
principalColumn: "SellingItemID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_sales_template_row_sales_template_TemplateID",
|
||||
column: x => x.TemplateID,
|
||||
principalTable: "sales_template",
|
||||
principalColumn: "TemplateID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "item_selling_item",
|
||||
keyColumn: "SellingItemID",
|
||||
keyValue: 1,
|
||||
column: "SourceType",
|
||||
value: 0);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "item_selling_item",
|
||||
keyColumn: "SellingItemID",
|
||||
keyValue: 2,
|
||||
column: "SourceType",
|
||||
value: 0);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "item_selling_item",
|
||||
keyColumn: "SellingItemID",
|
||||
keyValue: 3,
|
||||
column: "SourceType",
|
||||
value: 0);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "item_selling_item",
|
||||
keyColumn: "SellingItemID",
|
||||
keyValue: 4,
|
||||
column: "SourceType",
|
||||
value: 0);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "item_selling_item",
|
||||
keyColumn: "SellingItemID",
|
||||
keyValue: 5,
|
||||
column: "SourceType",
|
||||
value: 0);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "item_selling_item",
|
||||
keyColumn: "SellingItemID",
|
||||
keyValue: 6,
|
||||
column: "SourceType",
|
||||
value: 0);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "item_selling_item",
|
||||
keyColumn: "SellingItemID",
|
||||
keyValue: 7,
|
||||
column: "SourceType",
|
||||
value: 0);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer",
|
||||
keyColumn: "OfferID",
|
||||
keyValue: 1,
|
||||
columns: new[] { "DueDateProm", "DueDateReq", "ValidUntil" },
|
||||
values: new object[] { new DateTime(2026, 5, 4, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 4, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 5, 15, 56, 27, 786, DateTimeKind.Local).AddTicks(8365) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer",
|
||||
keyColumn: "OfferID",
|
||||
keyValue: 2,
|
||||
columns: new[] { "DueDateProm", "DueDateReq", "ValidUntil" },
|
||||
values: new object[] { new DateTime(2026, 5, 4, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 4, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 5, 15, 56, 27, 786, DateTimeKind.Local).AddTicks(8376) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer",
|
||||
keyColumn: "OfferID",
|
||||
keyValue: 3,
|
||||
columns: new[] { "DueDateProm", "DueDateReq", "ValidUntil" },
|
||||
values: new object[] { new DateTime(2026, 5, 4, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 4, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 5, 15, 56, 27, 786, DateTimeKind.Local).AddTicks(8382) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer",
|
||||
keyColumn: "OfferID",
|
||||
keyValue: 4,
|
||||
columns: new[] { "DueDateProm", "DueDateReq", "ValidUntil" },
|
||||
values: new object[] { new DateTime(2026, 5, 4, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 4, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 5, 15, 56, 27, 786, DateTimeKind.Local).AddTicks(8388) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 1,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 3, 5, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 3, 5, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 2,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 3, 5, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 3, 5, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 3,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 3, 5, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 3, 5, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 4,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 3, 5, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 3, 5, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 5,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 3, 5, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 3, 5, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 6,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 3, 5, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 3, 5, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 7,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 3, 5, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 3, 5, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 8,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 3, 5, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 3, 5, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 9,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 3, 5, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 3, 5, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 10,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 3, 5, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 3, 5, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_sales_template_row_SellingItemID",
|
||||
table: "sales_template_row",
|
||||
column: "SellingItemID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_sales_template_row_TemplateID",
|
||||
table: "sales_template_row",
|
||||
column: "TemplateID");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "sales_template_row");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "sales_template");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SourceType",
|
||||
table: "item_selling_item");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "SellingItemID",
|
||||
table: "sales_order_row",
|
||||
type: "int",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "SellingItemID",
|
||||
table: "sales_offer_row",
|
||||
type: "int",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer",
|
||||
keyColumn: "OfferID",
|
||||
keyValue: 1,
|
||||
columns: new[] { "DueDateProm", "DueDateReq", "ValidUntil" },
|
||||
values: new object[] { new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 2, 25, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 2, 26, 16, 26, 31, 274, DateTimeKind.Local).AddTicks(325) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer",
|
||||
keyColumn: "OfferID",
|
||||
keyValue: 2,
|
||||
columns: new[] { "DueDateProm", "DueDateReq", "ValidUntil" },
|
||||
values: new object[] { new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 2, 25, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 2, 26, 16, 26, 31, 274, DateTimeKind.Local).AddTicks(346) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer",
|
||||
keyColumn: "OfferID",
|
||||
keyValue: 3,
|
||||
columns: new[] { "DueDateProm", "DueDateReq", "ValidUntil" },
|
||||
values: new object[] { new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 2, 25, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 2, 26, 16, 26, 31, 274, DateTimeKind.Local).AddTicks(352) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer",
|
||||
keyColumn: "OfferID",
|
||||
keyValue: 4,
|
||||
columns: new[] { "DueDateProm", "DueDateReq", "ValidUntil" },
|
||||
values: new object[] { new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 2, 25, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 2, 26, 16, 26, 31, 274, DateTimeKind.Local).AddTicks(359) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 1,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 2,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 3,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 4,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 5,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 6,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 7,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 8,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 9,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "sales_offer_row",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 10,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 1, 26, 0, 0, 0, 0, DateTimeKind.Local) });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1484,7 +1484,7 @@ namespace EgwCoreLib.Lux.Data.Migrations
|
||||
RefNum = 1,
|
||||
RefRev = 1,
|
||||
RefYear = 2025,
|
||||
ValidUntil = new DateTime(2026, 4, 5, 10, 28, 8, 982, DateTimeKind.Local).AddTicks(2126)
|
||||
ValidUntil = new DateTime(2026, 4, 5, 15, 56, 27, 786, DateTimeKind.Local).AddTicks(8365)
|
||||
},
|
||||
new
|
||||
{
|
||||
@@ -1504,7 +1504,7 @@ namespace EgwCoreLib.Lux.Data.Migrations
|
||||
RefNum = 2,
|
||||
RefRev = 1,
|
||||
RefYear = 2025,
|
||||
ValidUntil = new DateTime(2026, 4, 5, 10, 28, 8, 982, DateTimeKind.Local).AddTicks(2142)
|
||||
ValidUntil = new DateTime(2026, 4, 5, 15, 56, 27, 786, DateTimeKind.Local).AddTicks(8376)
|
||||
},
|
||||
new
|
||||
{
|
||||
@@ -1524,7 +1524,7 @@ namespace EgwCoreLib.Lux.Data.Migrations
|
||||
RefNum = 3,
|
||||
RefRev = 1,
|
||||
RefYear = 2025,
|
||||
ValidUntil = new DateTime(2026, 4, 5, 10, 28, 8, 982, DateTimeKind.Local).AddTicks(2162)
|
||||
ValidUntil = new DateTime(2026, 4, 5, 15, 56, 27, 786, DateTimeKind.Local).AddTicks(8382)
|
||||
},
|
||||
new
|
||||
{
|
||||
@@ -1544,7 +1544,7 @@ namespace EgwCoreLib.Lux.Data.Migrations
|
||||
RefNum = 4,
|
||||
RefRev = 1,
|
||||
RefYear = 2025,
|
||||
ValidUntil = new DateTime(2026, 4, 5, 10, 28, 8, 982, DateTimeKind.Local).AddTicks(2176)
|
||||
ValidUntil = new DateTime(2026, 4, 5, 15, 56, 27, 786, DateTimeKind.Local).AddTicks(8388)
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2201,12 +2201,6 @@ namespace EgwCoreLib.Lux.Data.Migrations
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("TemplateID"));
|
||||
|
||||
b.Property<int>("CustomerID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DealerID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
@@ -2223,10 +2217,6 @@ namespace EgwCoreLib.Lux.Data.Migrations
|
||||
|
||||
b.HasKey("TemplateID");
|
||||
|
||||
b.HasIndex("CustomerID");
|
||||
|
||||
b.HasIndex("DealerID");
|
||||
|
||||
b.ToTable("sales_template");
|
||||
});
|
||||
|
||||
@@ -3803,25 +3793,6 @@ namespace EgwCoreLib.Lux.Data.Migrations
|
||||
b.Navigation("SellingItemNav");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.TemplateModel", 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.Navigation("CustomerNav");
|
||||
|
||||
b.Navigation("DealerNav");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.TemplateRowModel", b =>
|
||||
{
|
||||
b.HasOne("EgwCoreLib.Lux.Data.DbModel.Items.SellingItemModel", "SellingItemNav")
|
||||
|
||||
@@ -13,17 +13,9 @@ using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using StackExchange.Redis;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Resources;
|
||||
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.Services
|
||||
{
|
||||
@@ -1920,43 +1912,6 @@ namespace EgwCoreLib.Lux.Data.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Elenco record ProductionOdl Ready (NON Assegnati)
|
||||
/// </summary>
|
||||
/// <param name="reqState"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ProductionODLModel>> ProductionOdlUnassignAsync()
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<ProductionODLModel>? result = new List<ProductionODLModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:ProdOdl:Unassigned";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue && rawData.Length() > 2)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<ProductionODLModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await dbController.ProductionOdlUnassignAsync();
|
||||
// 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<ProductionODLModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"ProductionOdlUnassignAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Assegnazione in blocco degli item agli ODL corrispondenti
|
||||
/// </summary>
|
||||
@@ -2075,37 +2030,6 @@ namespace EgwCoreLib.Lux.Data.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero ODL da UID
|
||||
/// </summary>
|
||||
/// <param name="uID"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ProductionODLModel?> ProdOdlGetByUidAsync(string uID)
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
ProductionODLModel? result = null;
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:ProdOdl:{uID}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue && rawData.Length() > 2)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<ProductionODLModel>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await dbController.ProdOdlGetByUidAsync(uID);
|
||||
// serializzo e salvo con config x evitare loop...
|
||||
rawData = JsonConvert.SerializeObject(result, JSSettings);
|
||||
await redisDb.StringSetAsync(currKey, rawData, LongCache);
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"ProdOdlGetByUidAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco ODL piatto da assegnare
|
||||
/// </summary>
|
||||
@@ -2140,6 +2064,37 @@ namespace EgwCoreLib.Lux.Data.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero ODL da UID
|
||||
/// </summary>
|
||||
/// <param name="uID"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ProductionODLModel?> ProdOdlGetByUidAsync(string uID)
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
ProductionODLModel? result = null;
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:ProdOdl:{uID}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue && rawData.Length() > 2)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<ProductionODLModel>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await dbController.ProdOdlGetByUidAsync(uID);
|
||||
// serializzo e salvo con config x evitare loop...
|
||||
rawData = JsonConvert.SerializeObject(result, JSSettings);
|
||||
await redisDb.StringSetAsync(currKey, rawData, LongCache);
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"ProdOdlGetByUidAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiorna record ProdOdl (se trovato) con ItemListRaw (raw) inviata x calcolo PROD
|
||||
/// </summary>
|
||||
@@ -2224,74 +2179,6 @@ namespace EgwCoreLib.Lux.Data.Services
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
#if false
|
||||
public async Task<List<ProductionAssignModel>> ProdAssignByOrderRow(int OrderRowID)
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<ProductionAssignModel>? result = new List<ProductionAssignModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:ProdAssign:OrdRowId:{OrderRowID}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue && rawData.Length() > 2)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<ProductionAssignModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await dbController.ProdAssignByOrderRow(OrderRowID);
|
||||
// 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<ProductionAssignModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"ProdAssignByOrderRow | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica ed eventualmente crea ProdAssign dato elenco macchine
|
||||
/// </summary>
|
||||
/// <param name="OrderRowID"></param>
|
||||
/// <param name="ListPlant"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ProductionAssignModel>> ProdAssignCheckExist(int OrderRowID, List<string> ListPlant)
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<ProductionAssignModel>? result = new List<ProductionAssignModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:ProdAssign:OrdRowId:{OrderRowID}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue && rawData.Length() > 2)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<ProductionAssignModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await dbController.ProdAssignCheckExist(OrderRowID, ListPlant);
|
||||
// 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<ProductionAssignModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"ProdAssignCheckExist | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
/// Esegue Delete del record ricevuto
|
||||
/// </summary>
|
||||
/// <param name="upsRec"></param>
|
||||
@@ -2552,25 +2439,6 @@ namespace EgwCoreLib.Lux.Data.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Recupero nuovo record BOM diretto dal DB
|
||||
/// </summary>
|
||||
/// <param name="offerRowID"></param>
|
||||
/// <returns></returns>
|
||||
public OfferRowModel? OfferRowGetByOfferRowID(int offerRowID)
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
OfferRowModel? result = null;
|
||||
result = dbController.OfferRowGetByOfferRowID(offerRowID);
|
||||
sw.Stop();
|
||||
Log.Debug($"OfferRowGetByOfferRowID | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Elenco completo Tags disponibili
|
||||
/// </summary>
|
||||
@@ -2605,8 +2473,184 @@ namespace EgwCoreLib.Lux.Data.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue clone completo del template indicato e svuota la cache
|
||||
/// </summary>
|
||||
/// <param name="rec2clone"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> TemplateCloneAsync(TemplateModel rec2clone)
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
// calcolo
|
||||
bool fatto = await dbController.TemplateCloneAsync(rec2clone);
|
||||
// svuoto cache...
|
||||
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Template:*");
|
||||
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:TemplateRows:*");
|
||||
sw.Stop();
|
||||
Log.Debug($"TemplateCloneAsync in {sw.Elapsed.TotalMilliseconds} ms");
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco completo Template da DB
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<TemplateModel>> TemplateGetAllAsync()
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<TemplateModel>? result = new List<TemplateModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:Template:ALL";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
//if (!string.IsNullOrEmpty($"{rawData}"))
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<TemplateModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await dbController.TemplateGetAllAsync();
|
||||
// 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<TemplateModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"TemplateGetAllAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Elenco record ProductionOdl Ready (NON Assegnati)
|
||||
/// </summary>
|
||||
/// <param name="reqState"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ProductionODLModel>> ProductionOdlUnassignAsync()
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<ProductionODLModel>? result = new List<ProductionODLModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:ProdOdl:Unassigned";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue && rawData.Length() > 2)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<ProductionODLModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await dbController.ProductionOdlUnassignAsync();
|
||||
// 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<ProductionODLModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"ProductionOdlUnassignAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
#if false
|
||||
public async Task<List<ProductionAssignModel>> ProdAssignByOrderRow(int OrderRowID)
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<ProductionAssignModel>? result = new List<ProductionAssignModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:ProdAssign:OrdRowId:{OrderRowID}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue && rawData.Length() > 2)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<ProductionAssignModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await dbController.ProdAssignByOrderRow(OrderRowID);
|
||||
// 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<ProductionAssignModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"ProdAssignByOrderRow | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica ed eventualmente crea ProdAssign dato elenco macchine
|
||||
/// </summary>
|
||||
/// <param name="OrderRowID"></param>
|
||||
/// <param name="ListPlant"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ProductionAssignModel>> ProdAssignCheckExist(int OrderRowID, List<string> ListPlant)
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<ProductionAssignModel>? result = new List<ProductionAssignModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:ProdAssign:OrdRowId:{OrderRowID}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue && rawData.Length() > 2)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<ProductionAssignModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await dbController.ProdAssignCheckExist(OrderRowID, ListPlant);
|
||||
// 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<ProductionAssignModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"ProdAssignCheckExist | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Recupero nuovo record BOM diretto dal DB
|
||||
/// </summary>
|
||||
/// <param name="offerRowID"></param>
|
||||
/// <returns></returns>
|
||||
public OfferRowModel? OfferRowGetByOfferRowID(int offerRowID)
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
OfferRowModel? result = null;
|
||||
result = dbController.OfferRowGetByOfferRowID(offerRowID);
|
||||
sw.Stop();
|
||||
Log.Debug($"OfferRowGetByOfferRowID | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>1.1.2603.0512</Version>
|
||||
<Version>1.1.2603.0516</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,5 +1,98 @@
|
||||
<h3>TemplateListMan</h3>
|
||||
|
||||
@code {
|
||||
|
||||
@if (isLoading)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-info">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0 fs-4">
|
||||
Nessun record trovato
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<button class="btn btn-success" @onclick="DoAdd">Nuovo <i class="fa-solid fa-book-medical"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<button class="btn btn-sm btn-primary" title="Reset selezione" @onclick="DoReset"><i class="fa-solid fa-arrow-rotate-right"></i></button>
|
||||
</th>
|
||||
<th>ID</th>
|
||||
<th>Date</th>
|
||||
<th>Stato</th>
|
||||
<th>Codice</th>
|
||||
|
||||
@if (SelRecord == null)
|
||||
{
|
||||
<th>Descrizione</th>
|
||||
}
|
||||
<th class="text-end" title="# Righe"><i class="fa-solid fa-list"></i></th>
|
||||
<th class="text-end" title="# Articoli"><i class="fa-regular fa-file-lines"></i></th>
|
||||
<th class="text-end" title="# Componenti Ordine"><i class="fa-solid fa-folder-tree"></i></th>
|
||||
<th class="text-end">Importo</th>
|
||||
<th class="text-end">Marg.</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr class="@CheckSelect(item)">
|
||||
<td>
|
||||
<button class="btn btn-sm btn-primary" @onclick="() => DoSelect(item)"><i class="fa-solid fa-magnifying-glass"></i></button>
|
||||
<button class="btn btn-sm btn-info" @onclick="() => DoEdit(item)"><i class="fa-solid fa-pencil"></i></button>
|
||||
<button class="btn btn-sm btn-warning" @onclick="() => DoClone(item)" title="Duplica Offerta"><i class="fa-solid fa-wand-magic"></i></button>
|
||||
</td>
|
||||
<td>@item.TemplateID</td>
|
||||
<td>
|
||||
@* <div class="small" title="Inserita"><i class="fa-solid fa-circle"></i> @($"{item.Inserted:yyyy-MM-dd}")</div>
|
||||
<div class="small text-secondary" title="Scadenza"><i class="fa-solid fa-hourglass-half"></i> @($"{item.ValidUntil:yyyy-MM-dd}")</div> *@
|
||||
</td>
|
||||
<td>
|
||||
@* <button class="btn btn-sm btn-outline-dark" @onclick="() => EditState(item)">@item.OffertState</button> *@
|
||||
</td>
|
||||
<td>
|
||||
@* @item.OfferCode *@
|
||||
<div class="small text-secondary">@item.Envir</div>
|
||||
</td>
|
||||
|
||||
@if (SelRecord == null)
|
||||
{
|
||||
<td>@item.Description</td>
|
||||
}
|
||||
<td class="text-end">
|
||||
@item.NumRows
|
||||
</td>
|
||||
<td class="text-end">
|
||||
@item.NumItems
|
||||
</td>
|
||||
<td class="text-end">
|
||||
@item.NumProdItems
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<div class="fw-bold" title="Prezzo Finito">@item.TotalPrice.ToString("C2")</div>
|
||||
<div class="small text-secondary" title="RockBottom Price">(@item.TotalCost.ToString("C2"))</div>
|
||||
</td>
|
||||
<td class="text-end" title="Margine / Sconto MAX applicabile">
|
||||
@item.MaxDiscount.ToString("P2")
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
@if (totalCount >= numRecord)
|
||||
{
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="15">
|
||||
<EgwCoreLib.Razor.DataPager currPage="@currPage" PageSize="@numRecord" totalCount="@totalCount" numPageChanged="SavePage" numRecordChanged="SaveNumRec"></EgwCoreLib.Razor.DataPager>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
}
|
||||
</table>
|
||||
}
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
using EgwCoreLib.Lux.Core;
|
||||
using EgwCoreLib.Lux.Data.DbModel.Sales;
|
||||
using EgwCoreLib.Lux.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
|
||||
namespace Lux.UI.Components.Compo.Templates
|
||||
{
|
||||
public partial class TemplateList
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Modello dell'offerta corrente (bindato dal genitore).
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public string SearchVal { get; set; } = string.Empty;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected int totalCount = 0;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
/// <summary>
|
||||
/// Servizi di accesso ai dati iniettati dal framework.
|
||||
/// </summary>
|
||||
[Inject]
|
||||
protected DataLayerServices DLService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
private EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS CurrEnvir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW;
|
||||
private Enums.ItemSourceType CurrSourceType = Enums.ItemSourceType.Jwd;
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string CheckSelect(TemplateModel curRec)
|
||||
{
|
||||
string answ = "";
|
||||
if (SelRecord != null)
|
||||
{
|
||||
answ = curRec.TemplateID == SelRecord.TemplateID ? "table-info" : "";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected async Task DoClone(TemplateModel rec2clone)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Confermi di voler duplicare interamente il template selezionato?{Environment.NewLine}---------------------------{Environment.NewLine}Env: {rec2clone.Envir} | {rec2clone.Name}{Environment.NewLine}{rec2clone.Description}{Environment.NewLine}Articoli: {rec2clone.NumItems}{Environment.NewLine}---------------------------{Environment.NewLine}Importo: {rec2clone.TotalPrice:C2}"))
|
||||
return;
|
||||
// clona intera offerta + tutte le righe...
|
||||
await DLService.TemplateCloneAsync(rec2clone);
|
||||
await ReloadData();
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
protected void DoEdit(TemplateModel curRec)
|
||||
{
|
||||
EditRecord = curRec;
|
||||
}
|
||||
|
||||
protected void DoReset()
|
||||
{
|
||||
EditRecord = null;
|
||||
SelRecord = null;
|
||||
}
|
||||
|
||||
protected void DoAdd()
|
||||
{
|
||||
DateTime adesso = DateTime.Now;
|
||||
EditRecord = new TemplateModel()
|
||||
{
|
||||
Name = $"New Template {adesso.Year}",
|
||||
Description = $"Nuovo Template {adesso:ddd yyyy.MM.dd HH:mm:ss}",
|
||||
Envir = CurrEnvir,
|
||||
SourceType = CurrSourceType
|
||||
};
|
||||
}
|
||||
|
||||
protected void DoSelect(TemplateModel curRec)
|
||||
{
|
||||
SelRecord = curRec;
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
protected async Task ReloadData()
|
||||
{
|
||||
AllRecords = await DLService.TemplateGetAllAsync();
|
||||
}
|
||||
|
||||
protected void SaveNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
protected void SavePage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
protected void UpdateTable()
|
||||
{
|
||||
ListFilt.Clear();
|
||||
if (!string.IsNullOrEmpty(SearchVal))
|
||||
{
|
||||
ListFilt = AllRecords
|
||||
.Where(x => x.Name.Contains(SearchVal, StringComparison.InvariantCultureIgnoreCase) || x.Description.Contains(SearchVal, StringComparison.InvariantCultureIgnoreCase))
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ListFilt = AllRecords;
|
||||
}
|
||||
totalCount = ListFilt.Count;
|
||||
// gestione paginazione
|
||||
ListFilt
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private List<TemplateModel> AllRecords = new List<TemplateModel>();
|
||||
private int currPage = 1;
|
||||
private TemplateModel? EditRecord = null;
|
||||
private bool isLoading = false;
|
||||
private List<TemplateModel> ListFilt = new List<TemplateModel>();
|
||||
private List<TemplateModel> ListRecords = new List<TemplateModel>();
|
||||
private int numRecord = 10;
|
||||
private TemplateModel? SelRecord = null;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50</UserSecretsId>
|
||||
<Version>1.1.2603.0512</Version>
|
||||
<Version>1.1.2603.0516</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>LUX - Web Windows MES</i>
|
||||
<h4>Versione: 1.1.2603.0512</h4>
|
||||
<h4>Versione: 1.1.2603.0516</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.1.2603.0512
|
||||
1.1.2603.0516
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>1.1.2603.0512</version>
|
||||
<version>1.1.2603.0516</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user