diff --git a/MP.MONO.Data/DbModels/EventLogModel.cs b/MP.MONO.Data/DbModels/EventLogModel.cs
index 7eb5156..43a1fc0 100644
--- a/MP.MONO.Data/DbModels/EventLogModel.cs
+++ b/MP.MONO.Data/DbModels/EventLogModel.cs
@@ -31,7 +31,7 @@ namespace MP.MONO.Data.DbModels
///
/// Tipologia di evento registrato
///
- public int CodEventId { get; set; }
+ public string CodEvent { get; set; } = "";
///
/// Valore opzionale associato
@@ -48,7 +48,7 @@ namespace MP.MONO.Data.DbModels
///
/// Navigazione oggetto Evento
///
- [ForeignKey("CodEventId")]
- public virtual CodEventModel CodEventNav { get; set; } = null!;
+ [ForeignKey("CodEvent")]
+ public virtual EventModel CodEventNav { get; set; } = null!;
}
}
diff --git a/MP.MONO.Data/DbModels/CodEventModel.cs b/MP.MONO.Data/DbModels/EventModel.cs
similarity index 57%
rename from MP.MONO.Data/DbModels/CodEventModel.cs
rename to MP.MONO.Data/DbModels/EventModel.cs
index 5bd6360..07d46da 100644
--- a/MP.MONO.Data/DbModels/CodEventModel.cs
+++ b/MP.MONO.Data/DbModels/EventModel.cs
@@ -9,16 +9,16 @@ namespace MP.MONO.Data.DbModels
///
/// Tabella Codifica Eventi
///
- [Table("CodEvent")]
- public class CodEventModel
+ [Table("Event")]
+ public class EventModel
{
#region Public Properties
///
- /// UID
+ /// UID, da gestire
///
- [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int CodEventId { get; set; }
+ [Key]
+ public string CodEvent { get; set; } = "";
///
/// Descrizione evento
@@ -27,9 +27,14 @@ namespace MP.MONO.Data.DbModels
public string Description { get; set; } = "";
///
- /// Indica se un evento sia generato dalla amcchina (HW) vs generato da utente (SW)
+ /// Indica se un evento sia "user driven" (soft) oppure generato dalla macchina (HW)
///
- public bool IsHw { get; set; } = false;
+ public bool IsUser { get; set; } = false;
+
+ ///
+ /// Indica se un evento sia attivo (quindi selezionabile da ute te se NON HW)
+ ///
+ public bool Active { get; set; } = true;
#endregion Public Properties
}
diff --git a/MP.MONO.Data/MapoMonoContext.cs b/MP.MONO.Data/MapoMonoContext.cs
index 3b90f30..ba02fa5 100644
--- a/MP.MONO.Data/MapoMonoContext.cs
+++ b/MP.MONO.Data/MapoMonoContext.cs
@@ -70,7 +70,7 @@ namespace MP.MONO.Data
///
/// DbSet tipi di eventi
///
- public virtual DbSet DbSetCodEvent { get; set; } = null!;
+ public virtual DbSet DbSetCodEvent { get; set; } = null!;
///
/// DbSet elenco eventi registrati
diff --git a/MP.MONO.Data/Migrations/20220211174007_AddSeedEvents.Designer.cs b/MP.MONO.Data/Migrations/20220211174007_AddSeedEvents.Designer.cs
new file mode 100644
index 0000000..1e0fca5
--- /dev/null
+++ b/MP.MONO.Data/Migrations/20220211174007_AddSeedEvents.Designer.cs
@@ -0,0 +1,730 @@
+//
+using System;
+using MP.MONO.Data;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace MP.MONO.Data.Migrations
+{
+ [DbContext(typeof(MapoMonoContext))]
+ [Migration("20220211174007_AddSeedEvents")]
+ partial class AddSeedEvents
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "6.0.2")
+ .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+ modelBuilder.Entity("MP.MONO.Data.DbModels.AnKeyValModel", b =>
+ {
+ b.Property("KeyName")
+ .HasMaxLength(50)
+ .HasColumnType("varchar(50)");
+
+ b.Property("Descript")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("varchar(250)");
+
+ b.Property("ValFloat")
+ .HasColumnType("int");
+
+ b.Property("ValInt")
+ .HasColumnType("int");
+
+ b.Property("ValString")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("varchar(250)");
+
+ b.HasKey("KeyName");
+
+ b.ToTable("AnKeyVal");
+ });
+
+ modelBuilder.Entity("MP.MONO.Data.DbModels.CodStatusModel", b =>
+ {
+ b.Property("CodStatusId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("CssClass")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("varchar(50)");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("varchar(250)");
+
+ b.Property("Group")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("varchar(50)");
+
+ b.HasKey("CodStatusId");
+
+ b.ToTable("CodStatus");
+ });
+
+ modelBuilder.Entity("MP.MONO.Data.DbModels.ConfigModel", b =>
+ {
+ b.Property("KeyName")
+ .HasMaxLength(50)
+ .HasColumnType("varchar(50)");
+
+ b.Property("Note")
+ .IsRequired()
+ .HasMaxLength(500)
+ .HasColumnType("varchar(500)");
+
+ b.Property("Val")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("varchar(250)");
+
+ b.Property("ValStd")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("varchar(250)");
+
+ b.HasKey("KeyName");
+
+ b.ToTable("Config");
+ });
+
+ modelBuilder.Entity("MP.MONO.Data.DbModels.DataLogModel", b =>
+ {
+ b.Property("DataLogId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("DtRif")
+ .HasColumnType("datetime(6)");
+
+ b.Property("FluxType")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("varchar(250)");
+
+ b.Property("MachineId")
+ .HasColumnType("int");
+
+ b.Property("ValNum")
+ .HasColumnType("double");
+
+ b.Property("ValStr")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("varchar(250)");
+
+ b.HasKey("DataLogId");
+
+ b.HasIndex("MachineId");
+
+ b.ToTable("DataLog");
+ });
+
+ modelBuilder.Entity("MP.MONO.Data.DbModels.DataStAgModel", b =>
+ {
+ b.Property("DataStAgId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("DtRif")
+ .HasColumnType("datetime(6)");
+
+ b.Property("FluxType")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("varchar(250)");
+
+ b.Property("MachineId")
+ .HasColumnType("int");
+
+ b.Property("NumRec")
+ .HasColumnType("double");
+
+ b.Property("ValNumAvg")
+ .HasColumnType("double");
+
+ b.Property("ValNumMax")
+ .HasColumnType("double");
+
+ b.Property("ValNumMin")
+ .HasColumnType("double");
+
+ b.Property("ValStr")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("varchar(250)");
+
+ b.HasKey("DataStAgId");
+
+ b.HasIndex("MachineId");
+
+ b.ToTable("DataStAg");
+ });
+
+ modelBuilder.Entity("MP.MONO.Data.DbModels.EventLogModel", b =>
+ {
+ b.Property("EventLogId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("CodEvent")
+ .IsRequired()
+ .HasColumnType("varchar(255)");
+
+ b.Property("DtRif")
+ .HasColumnType("datetime(6)");
+
+ b.Property("MachineId")
+ .HasColumnType("int");
+
+ b.Property("ValStr")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("varchar(250)");
+
+ b.HasKey("EventLogId");
+
+ b.HasIndex("CodEvent");
+
+ b.HasIndex("MachineId");
+
+ b.ToTable("EventLog");
+ });
+
+ modelBuilder.Entity("MP.MONO.Data.DbModels.EventModel", b =>
+ {
+ b.Property("CodEvent")
+ .HasColumnType("varchar(255)");
+
+ b.Property("Active")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("varchar(250)");
+
+ b.Property("IsUser")
+ .HasColumnType("tinyint(1)");
+
+ b.HasKey("CodEvent");
+
+ b.ToTable("Event");
+
+ b.HasData(
+ new
+ {
+ CodEvent = "",
+ Active = true,
+ Description = "NA",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "Run",
+ Active = true,
+ Description = "Running",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "Setup",
+ Active = true,
+ Description = "Machine Setup",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "ProgEdit",
+ Active = true,
+ Description = "Program Editing",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "Fill",
+ Active = true,
+ Description = "Machine Fill",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "SetError",
+ Active = true,
+ Description = "Error",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "WUpCDown",
+ Active = true,
+ Description = "Warm Up / CoolDown Machine",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "ContrPOnSDown",
+ Active = true,
+ Description = "Controller PowerOn / ShutDown",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "ProgMissing",
+ Active = true,
+ Description = "Program Missing",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "HRMissing",
+ Active = true,
+ Description = "HR Missing",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "Maint",
+ Active = true,
+ Description = "Maintenance",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "Clean",
+ Active = true,
+ Description = "MAchine CleanUp",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "SetPowerOff",
+ Active = true,
+ Description = "Power OFF Declaration",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "Init",
+ Active = true,
+ Description = "Init",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "PowerOff",
+ Active = true,
+ Description = "Power OFF",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "PowerOn",
+ Active = true,
+ Description = "Power ON",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "Cycle",
+ Active = true,
+ Description = "Machining",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "EndCycle",
+ Active = true,
+ Description = "End machining",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "Error",
+ Active = true,
+ Description = "Error",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "PzCount",
+ Active = true,
+ Description = "Item Count(+1)",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "StartPall",
+ Active = true,
+ Description = "Start pallet",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "EndPall",
+ Active = true,
+ Description = "End pallet",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "Manual",
+ Active = true,
+ Description = "Manual",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "LineOutFull",
+ Active = true,
+ Description = "Line Out Full",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "LineInEmpty",
+ Active = true,
+ Description = "Line In Empty",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "TimeoutCycle",
+ Active = true,
+ Description = "Timeout Std CycleTime",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "RawMatMiss",
+ Active = true,
+ Description = "Raw Material Missing",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "Emergency",
+ Active = true,
+ Description = "Emergency",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "ToolReplace",
+ Active = true,
+ Description = "Tool Replacement",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "CncAlam",
+ Active = true,
+ Description = "CNC Alarm",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "PlcAlam",
+ Active = true,
+ Description = "PLC Alarm",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "Warning",
+ Active = true,
+ Description = "Warning State",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "SetMessage",
+ Active = true,
+ Description = "User Message Set",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "Message",
+ Active = true,
+ Description = "Machine Message",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "PzIncr",
+ Active = true,
+ Description = "Item Count Increment",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "PzSet",
+ Active = true,
+ Description = "Item Count Set",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "Comm",
+ Active = true,
+ Description = "User Comment",
+ IsUser = true
+ });
+ });
+
+ modelBuilder.Entity("MP.MONO.Data.DbModels.MachineModel", b =>
+ {
+ b.Property("MachineId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("BuildYear")
+ .HasColumnType("int");
+
+ b.Property("Code")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("varchar(50)");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("varchar(250)");
+
+ b.Property("Model")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("varchar(250)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("varchar(250)");
+
+ b.Property("Serial")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("varchar(250)");
+
+ b.HasKey("MachineId");
+
+ b.ToTable("Machine");
+
+ b.HasData(
+ new
+ {
+ MachineId = 1,
+ BuildYear = 2022,
+ Code = "",
+ Description = "Default SIM Machine",
+ Model = "Egalware SIM",
+ Name = "EGW-SIM-Machine",
+ Serial = "SN-0000-0000-0000"
+ });
+ });
+
+ modelBuilder.Entity("MP.MONO.Data.DbModels.ProdLogModel", b =>
+ {
+ b.Property("ProdLogId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("DtRif")
+ .HasColumnType("datetime(6)");
+
+ b.Property("EvType")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("ExtRef")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("MachineId")
+ .HasColumnType("int");
+
+ b.Property("ValNum")
+ .HasColumnType("double");
+
+ b.Property("ValStr")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("varchar(250)");
+
+ b.HasKey("ProdLogId");
+
+ b.HasIndex("MachineId");
+
+ b.ToTable("ProdLog");
+ });
+
+ modelBuilder.Entity("MP.MONO.Data.DbModels.StatusLogModel", b =>
+ {
+ b.Property("EventLogId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("CodStatusId")
+ .HasColumnType("int");
+
+ b.Property("DtRif")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Duration")
+ .HasColumnType("float");
+
+ b.Property("MachineId")
+ .HasColumnType("int");
+
+ b.Property("ValStr")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("varchar(250)");
+
+ b.HasKey("EventLogId");
+
+ b.HasIndex("CodStatusId");
+
+ b.HasIndex("MachineId");
+
+ b.ToTable("StatusLog");
+ });
+
+ modelBuilder.Entity("MP.MONO.Data.DbModels.StatusStAgModel", b =>
+ {
+ b.Property("DataStAgId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("CodStatusId")
+ .HasColumnType("int");
+
+ b.Property("DtRif")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Duration")
+ .HasColumnType("float");
+
+ b.Property("MachineId")
+ .HasColumnType("int");
+
+ b.Property("ValStr")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("varchar(250)");
+
+ b.HasKey("DataStAgId");
+
+ b.HasIndex("CodStatusId");
+
+ b.HasIndex("MachineId");
+
+ b.ToTable("StatusStAg");
+ });
+
+ modelBuilder.Entity("MP.MONO.Data.DbModels.DataLogModel", b =>
+ {
+ b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav")
+ .WithMany()
+ .HasForeignKey("MachineId")
+ .OnDelete(DeleteBehavior.Restrict)
+ .IsRequired();
+
+ b.Navigation("MachineNav");
+ });
+
+ modelBuilder.Entity("MP.MONO.Data.DbModels.DataStAgModel", b =>
+ {
+ b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav")
+ .WithMany()
+ .HasForeignKey("MachineId")
+ .OnDelete(DeleteBehavior.Restrict)
+ .IsRequired();
+
+ b.Navigation("MachineNav");
+ });
+
+ modelBuilder.Entity("MP.MONO.Data.DbModels.EventLogModel", b =>
+ {
+ b.HasOne("MP.MONO.Data.DbModels.EventModel", "CodEventNav")
+ .WithMany()
+ .HasForeignKey("CodEvent")
+ .OnDelete(DeleteBehavior.Restrict)
+ .IsRequired();
+
+ b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav")
+ .WithMany()
+ .HasForeignKey("MachineId")
+ .OnDelete(DeleteBehavior.Restrict)
+ .IsRequired();
+
+ b.Navigation("CodEventNav");
+
+ b.Navigation("MachineNav");
+ });
+
+ modelBuilder.Entity("MP.MONO.Data.DbModels.ProdLogModel", b =>
+ {
+ b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav")
+ .WithMany()
+ .HasForeignKey("MachineId")
+ .OnDelete(DeleteBehavior.Restrict)
+ .IsRequired();
+
+ b.Navigation("MachineNav");
+ });
+
+ modelBuilder.Entity("MP.MONO.Data.DbModels.StatusLogModel", b =>
+ {
+ b.HasOne("MP.MONO.Data.DbModels.CodStatusModel", "CodStatusNav")
+ .WithMany()
+ .HasForeignKey("CodStatusId")
+ .OnDelete(DeleteBehavior.Restrict)
+ .IsRequired();
+
+ b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav")
+ .WithMany()
+ .HasForeignKey("MachineId")
+ .OnDelete(DeleteBehavior.Restrict)
+ .IsRequired();
+
+ b.Navigation("CodStatusNav");
+
+ b.Navigation("MachineNav");
+ });
+
+ modelBuilder.Entity("MP.MONO.Data.DbModels.StatusStAgModel", b =>
+ {
+ b.HasOne("MP.MONO.Data.DbModels.CodStatusModel", "CodStatusNav")
+ .WithMany()
+ .HasForeignKey("CodStatusId")
+ .OnDelete(DeleteBehavior.Restrict)
+ .IsRequired();
+
+ b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav")
+ .WithMany()
+ .HasForeignKey("MachineId")
+ .OnDelete(DeleteBehavior.Restrict)
+ .IsRequired();
+
+ b.Navigation("CodStatusNav");
+
+ b.Navigation("MachineNav");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/MP.MONO.Data/Migrations/20220211174007_AddSeedEvents.cs b/MP.MONO.Data/Migrations/20220211174007_AddSeedEvents.cs
new file mode 100644
index 0000000..9d69963
--- /dev/null
+++ b/MP.MONO.Data/Migrations/20220211174007_AddSeedEvents.cs
@@ -0,0 +1,164 @@
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace MP.MONO.Data.Migrations
+{
+ public partial class AddSeedEvents : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_EventLog_CodEvent_CodEventId",
+ table: "EventLog");
+
+ migrationBuilder.DropTable(
+ name: "CodEvent");
+
+ migrationBuilder.DropIndex(
+ name: "IX_EventLog_CodEventId",
+ table: "EventLog");
+
+ migrationBuilder.DropColumn(
+ name: "CodEventId",
+ table: "EventLog");
+
+ migrationBuilder.AddColumn(
+ name: "CodEvent",
+ table: "EventLog",
+ type: "varchar(255)",
+ nullable: false,
+ defaultValue: "")
+ .Annotation("MySql:CharSet", "utf8mb4");
+
+ migrationBuilder.CreateTable(
+ name: "Event",
+ columns: table => new
+ {
+ CodEvent = table.Column(type: "varchar(255)", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ Description = table.Column(type: "varchar(250)", maxLength: 250, nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ IsUser = table.Column(type: "tinyint(1)", nullable: false),
+ Active = table.Column(type: "tinyint(1)", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Event", x => x.CodEvent);
+ })
+ .Annotation("MySql:CharSet", "utf8mb4");
+
+ migrationBuilder.InsertData(
+ table: "Event",
+ columns: new[] { "CodEvent", "Active", "Description", "IsUser" },
+ values: new object[,]
+ {
+ { "", true, "NA", false },
+ { "Clean", true, "MAchine CleanUp", true },
+ { "CncAlam", true, "CNC Alarm", false },
+ { "Comm", true, "User Comment", true },
+ { "ContrPOnSDown", true, "Controller PowerOn / ShutDown", false },
+ { "Cycle", true, "Machining", false },
+ { "Emergency", true, "Emergency", false },
+ { "EndCycle", true, "End machining", false },
+ { "EndPall", true, "End pallet", false },
+ { "Error", true, "Error", false },
+ { "Fill", true, "Machine Fill", true },
+ { "HRMissing", true, "HR Missing", true },
+ { "Init", true, "Init", false },
+ { "LineInEmpty", true, "Line In Empty", false },
+ { "LineOutFull", true, "Line Out Full", false },
+ { "Maint", true, "Maintenance", true },
+ { "Manual", true, "Manual", false },
+ { "Message", true, "Machine Message", false },
+ { "PlcAlam", true, "PLC Alarm", false },
+ { "PowerOff", true, "Power OFF", false },
+ { "PowerOn", true, "Power ON", false },
+ { "ProgEdit", true, "Program Editing", true },
+ { "ProgMissing", true, "Program Missing", true },
+ { "PzCount", true, "Item Count(+1)", false },
+ { "PzIncr", true, "Item Count Increment", false },
+ { "PzSet", true, "Item Count Set", false },
+ { "RawMatMiss", true, "Raw Material Missing", true },
+ { "Run", true, "Running", true },
+ { "SetError", true, "Error", true },
+ { "SetMessage", true, "User Message Set", true },
+ { "SetPowerOff", true, "Power OFF Declaration", true },
+ { "Setup", true, "Machine Setup", true },
+ { "StartPall", true, "Start pallet", false },
+ { "TimeoutCycle", true, "Timeout Std CycleTime", false },
+ { "ToolReplace", true, "Tool Replacement", true },
+ { "Warning", true, "Warning State", false },
+ { "WUpCDown", true, "Warm Up / CoolDown Machine", false }
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_EventLog_CodEvent",
+ table: "EventLog",
+ column: "CodEvent");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_EventLog_Event_CodEvent",
+ table: "EventLog",
+ column: "CodEvent",
+ principalTable: "Event",
+ principalColumn: "CodEvent",
+ onDelete: ReferentialAction.Restrict);
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_EventLog_Event_CodEvent",
+ table: "EventLog");
+
+ migrationBuilder.DropTable(
+ name: "Event");
+
+ migrationBuilder.DropIndex(
+ name: "IX_EventLog_CodEvent",
+ table: "EventLog");
+
+ migrationBuilder.DropColumn(
+ name: "CodEvent",
+ table: "EventLog");
+
+ migrationBuilder.AddColumn(
+ name: "CodEventId",
+ table: "EventLog",
+ type: "int",
+ nullable: false,
+ defaultValue: 0);
+
+ migrationBuilder.CreateTable(
+ name: "CodEvent",
+ columns: table => new
+ {
+ CodEventId = table.Column(type: "int", nullable: false)
+ .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
+ Description = table.Column(type: "varchar(250)", maxLength: 250, nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ IsHw = table.Column(type: "tinyint(1)", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_CodEvent", x => x.CodEventId);
+ })
+ .Annotation("MySql:CharSet", "utf8mb4");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_EventLog_CodEventId",
+ table: "EventLog",
+ column: "CodEventId");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_EventLog_CodEvent_CodEventId",
+ table: "EventLog",
+ column: "CodEventId",
+ principalTable: "CodEvent",
+ principalColumn: "CodEventId",
+ onDelete: ReferentialAction.Restrict);
+ }
+ }
+}
diff --git a/MP.MONO.Data/Migrations/MapoMonoContextModelSnapshot.cs b/MP.MONO.Data/Migrations/MapoMonoContextModelSnapshot.cs
index 4c8653f..76293be 100644
--- a/MP.MONO.Data/Migrations/MapoMonoContextModelSnapshot.cs
+++ b/MP.MONO.Data/Migrations/MapoMonoContextModelSnapshot.cs
@@ -46,25 +46,6 @@ namespace MP.MONO.Data.Migrations
b.ToTable("AnKeyVal");
});
- modelBuilder.Entity("MP.MONO.Data.DbModels.CodEventModel", b =>
- {
- b.Property("CodEventId")
- .ValueGeneratedOnAdd()
- .HasColumnType("int");
-
- b.Property("Description")
- .IsRequired()
- .HasMaxLength(250)
- .HasColumnType("varchar(250)");
-
- b.Property("IsHw")
- .HasColumnType("tinyint(1)");
-
- b.HasKey("CodEventId");
-
- b.ToTable("CodEvent");
- });
-
modelBuilder.Entity("MP.MONO.Data.DbModels.CodStatusModel", b =>
{
b.Property("CodStatusId")
@@ -196,8 +177,9 @@ namespace MP.MONO.Data.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("int");
- b.Property("CodEventId")
- .HasColumnType("int");
+ b.Property("CodEvent")
+ .IsRequired()
+ .HasColumnType("varchar(255)");
b.Property("DtRif")
.HasColumnType("datetime(6)");
@@ -212,13 +194,295 @@ namespace MP.MONO.Data.Migrations
b.HasKey("EventLogId");
- b.HasIndex("CodEventId");
+ b.HasIndex("CodEvent");
b.HasIndex("MachineId");
b.ToTable("EventLog");
});
+ modelBuilder.Entity("MP.MONO.Data.DbModels.EventModel", b =>
+ {
+ b.Property("CodEvent")
+ .HasColumnType("varchar(255)");
+
+ b.Property("Active")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("varchar(250)");
+
+ b.Property("IsUser")
+ .HasColumnType("tinyint(1)");
+
+ b.HasKey("CodEvent");
+
+ b.ToTable("Event");
+
+ b.HasData(
+ new
+ {
+ CodEvent = "",
+ Active = true,
+ Description = "NA",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "Run",
+ Active = true,
+ Description = "Running",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "Setup",
+ Active = true,
+ Description = "Machine Setup",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "ProgEdit",
+ Active = true,
+ Description = "Program Editing",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "Fill",
+ Active = true,
+ Description = "Machine Fill",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "SetError",
+ Active = true,
+ Description = "Error",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "WUpCDown",
+ Active = true,
+ Description = "Warm Up / CoolDown Machine",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "ContrPOnSDown",
+ Active = true,
+ Description = "Controller PowerOn / ShutDown",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "ProgMissing",
+ Active = true,
+ Description = "Program Missing",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "HRMissing",
+ Active = true,
+ Description = "HR Missing",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "Maint",
+ Active = true,
+ Description = "Maintenance",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "Clean",
+ Active = true,
+ Description = "MAchine CleanUp",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "SetPowerOff",
+ Active = true,
+ Description = "Power OFF Declaration",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "Init",
+ Active = true,
+ Description = "Init",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "PowerOff",
+ Active = true,
+ Description = "Power OFF",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "PowerOn",
+ Active = true,
+ Description = "Power ON",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "Cycle",
+ Active = true,
+ Description = "Machining",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "EndCycle",
+ Active = true,
+ Description = "End machining",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "Error",
+ Active = true,
+ Description = "Error",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "PzCount",
+ Active = true,
+ Description = "Item Count(+1)",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "StartPall",
+ Active = true,
+ Description = "Start pallet",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "EndPall",
+ Active = true,
+ Description = "End pallet",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "Manual",
+ Active = true,
+ Description = "Manual",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "LineOutFull",
+ Active = true,
+ Description = "Line Out Full",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "LineInEmpty",
+ Active = true,
+ Description = "Line In Empty",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "TimeoutCycle",
+ Active = true,
+ Description = "Timeout Std CycleTime",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "RawMatMiss",
+ Active = true,
+ Description = "Raw Material Missing",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "Emergency",
+ Active = true,
+ Description = "Emergency",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "ToolReplace",
+ Active = true,
+ Description = "Tool Replacement",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "CncAlam",
+ Active = true,
+ Description = "CNC Alarm",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "PlcAlam",
+ Active = true,
+ Description = "PLC Alarm",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "Warning",
+ Active = true,
+ Description = "Warning State",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "SetMessage",
+ Active = true,
+ Description = "User Message Set",
+ IsUser = true
+ },
+ new
+ {
+ CodEvent = "Message",
+ Active = true,
+ Description = "Machine Message",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "PzIncr",
+ Active = true,
+ Description = "Item Count Increment",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "PzSet",
+ Active = true,
+ Description = "Item Count Set",
+ IsUser = false
+ },
+ new
+ {
+ CodEvent = "Comm",
+ Active = true,
+ Description = "User Comment",
+ IsUser = true
+ });
+ });
+
modelBuilder.Entity("MP.MONO.Data.DbModels.MachineModel", b =>
{
b.Property("MachineId")
@@ -393,9 +657,9 @@ namespace MP.MONO.Data.Migrations
modelBuilder.Entity("MP.MONO.Data.DbModels.EventLogModel", b =>
{
- b.HasOne("MP.MONO.Data.DbModels.CodEventModel", "CodEventNav")
+ b.HasOne("MP.MONO.Data.DbModels.EventModel", "CodEventNav")
.WithMany()
- .HasForeignKey("CodEventId")
+ .HasForeignKey("CodEvent")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
diff --git a/MP.MONO.Data/ModelBuilderExtensions.cs b/MP.MONO.Data/ModelBuilderExtensions.cs
index 148ca0b..34d1810 100644
--- a/MP.MONO.Data/ModelBuilderExtensions.cs
+++ b/MP.MONO.Data/ModelBuilderExtensions.cs
@@ -16,6 +16,49 @@ namespace MP.MONO.Data
modelBuilder.Entity().HasData(
new MachineModel { MachineId = 1, Serial = "SN-0000-0000-0000", Model = "Egalware SIM", Name= "EGW-SIM-Machine", Description = "Default SIM Machine" }
);
+
+ // initi valori default x eventi
+ modelBuilder.Entity().HasData(
+ new EventModel { CodEvent = "", Description = "NA", IsUser= false}
+ , new EventModel { CodEvent = "Run", Description = "Running", IsUser = true }
+ , new EventModel { CodEvent = "Setup", Description = "Machine Setup", IsUser = true }
+ , new EventModel { CodEvent = "ProgEdit", Description = "Program Editing", IsUser = true }
+ , new EventModel { CodEvent = "Fill", Description = "Machine Fill", IsUser = true }
+ , new EventModel { CodEvent = "SetError", Description = "Error", IsUser = true }
+ , new EventModel { CodEvent = "WUpCDown", Description = "Warm Up / CoolDown Machine", IsUser = false }
+ , new EventModel { CodEvent = "ContrPOnSDown", Description = "Controller PowerOn / ShutDown", IsUser = false }
+ , new EventModel { CodEvent = "ProgMissing", Description = "Program Missing", IsUser = true }
+ , new EventModel { CodEvent = "HRMissing", Description = "HR Missing", IsUser = true }
+ , new EventModel { CodEvent = "Maint", Description = "Maintenance", IsUser = true }
+ , new EventModel { CodEvent = "Clean", Description = "MAchine CleanUp", IsUser = true }
+ , new EventModel { CodEvent = "SetPowerOff", Description = "Power OFF Declaration", IsUser = true }
+ , new EventModel { CodEvent = "Init", Description = "Init", IsUser = false }
+ , new EventModel { CodEvent = "PowerOff", Description = "Power OFF", IsUser = false }
+ , new EventModel { CodEvent = "PowerOn", Description = "Power ON", IsUser = false }
+ , new EventModel { CodEvent = "Cycle", Description = "Machining", IsUser = false }
+ , new EventModel { CodEvent = "EndCycle", Description = "End machining", IsUser = false }
+ , new EventModel { CodEvent = "Error", Description = "Error", IsUser = false }
+ , new EventModel { CodEvent = "PzCount", Description = "Item Count(+1)", IsUser = false }
+ , new EventModel { CodEvent = "StartPall", Description = "Start pallet", IsUser = false }
+ , new EventModel { CodEvent = "EndPall", Description = "End pallet", IsUser = false }
+ , new EventModel { CodEvent = "Manual", Description = "Manual", IsUser = false }
+ , new EventModel { CodEvent = "LineOutFull", Description = "Line Out Full", IsUser = false }
+ , new EventModel { CodEvent = "LineInEmpty", Description = "Line In Empty", IsUser = false }
+ , new EventModel { CodEvent = "TimeoutCycle", Description = "Timeout Std CycleTime", IsUser = false }
+ , new EventModel { CodEvent = "RawMatMiss", Description = "Raw Material Missing", IsUser = true}
+ , new EventModel { CodEvent = "Emergency", Description = "Emergency", IsUser = false }
+ , new EventModel { CodEvent = "ToolReplace", Description = "Tool Replacement", IsUser = true }
+ , new EventModel { CodEvent = "CncAlam", Description = "CNC Alarm", IsUser = false }
+ , new EventModel { CodEvent = "PlcAlam", Description = "PLC Alarm", IsUser = false }
+ , new EventModel { CodEvent = "Warning", Description = "Warning State", IsUser = false }
+ , new EventModel { CodEvent = "SetMessage", Description = "User Message Set", IsUser = true }
+ , new EventModel { CodEvent = "Message", Description = "Machine Message", IsUser = false }
+ , new EventModel { CodEvent = "PzIncr", Description = "Item Count Increment", IsUser = false }
+ , new EventModel { CodEvent = "PzSet", Description = "Item Count Set", IsUser = false }
+ , new EventModel { CodEvent = "Comm", Description = "User Comment", IsUser = true }
+ );
+
+ // init valori default x stati
#if false
// inizializzazione dei valori di default x USER
modelBuilder.Entity().HasData(